diff --git a/.github/ISSUE_TEMPLATE/ffi.md b/.github/ISSUE_TEMPLATE/ffi.md new file mode 100644 index 000000000..9c42a774e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ffi.md @@ -0,0 +1,5 @@ +--- +name: "package:ffi" +about: "Create a bug or file a feature request against package:ffi." +labels: "package:ffi" +--- diff --git a/.github/ISSUE_TEMPLATE/objective_c.md b/.github/ISSUE_TEMPLATE/objective_c.md index 63039fbd6..97f1aaacf 100644 --- a/.github/ISSUE_TEMPLATE/objective_c.md +++ b/.github/ISSUE_TEMPLATE/objective_c.md @@ -3,4 +3,3 @@ name: "package:objective_c" about: "Create a bug or file a feature request against package:objective_c." labels: "package:objective_c" --- - diff --git a/.github/labeler.yml b/.github/labeler.yml index 6db74365c..bcbd0bee6 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -2,40 +2,44 @@ 'type-infra': - changed-files: - - any-glob-to-any-file: '.github/**' + - any-glob-to-any-file: '.github/**' -'package:ffigen': +'package:ffi': - changed-files: - - any-glob-to-any-file: 'pkgs/ffigen/**' + - any-glob-to-any-file: 'pkgs/ffi/**' -'package:jnigen': +'package:ffigen': - changed-files: - - any-glob-to-any-file: 'pkgs/jnigen/**' + - any-glob-to-any-file: 'pkgs/ffigen/**' 'package:jni': - changed-files: - - any-glob-to-any-file: 'pkgs/jni/**' + - any-glob-to-any-file: 'pkgs/jni/**' + +'package:jnigen': + - changed-files: + - any-glob-to-any-file: 'pkgs/jnigen/**' 'package:native_assets_builder': - changed-files: - - any-glob-to-any-file: 'pkgs/native_assets_builder/**' + - any-glob-to-any-file: 'pkgs/native_assets_builder/**' 'package:native_assets_cli': - changed-files: - - any-glob-to-any-file: 'pkgs/native_assets_cli/**' + - any-glob-to-any-file: 'pkgs/native_assets_cli/**' 'package:native_toolchain_c': - changed-files: - - any-glob-to-any-file: 'pkgs/native_toolchain_c/**' + - any-glob-to-any-file: 'pkgs/native_toolchain_c/**' 'package:objective_c': - changed-files: - - any-glob-to-any-file: 'pkgs/objective_c/**' + - any-glob-to-any-file: 'pkgs/objective_c/**' -'package:swiftgen': +'package:swift2objc': - changed-files: - - any-glob-to-any-file: 'pkgs/swiftgen/**' + - any-glob-to-any-file: 'pkgs/swift2objc/**' -'package:swift2objc': +'package:swiftgen': - changed-files: - - any-glob-to-any-file: 'pkgs/swiftgen/swift2objc/**' + - any-glob-to-any-file: 'pkgs/swiftgen/**' diff --git a/.github/workflows/ffi.yaml b/.github/workflows/ffi.yaml index 2e6692fec..e521a3caf 100644 --- a/.github/workflows/ffi.yaml +++ b/.github/workflows/ffi.yaml @@ -31,8 +31,8 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} - id: install @@ -61,8 +61,8 @@ jobs: os: [ubuntu-latest] sdk: [beta, dev] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} - id: install diff --git a/.github/workflows/ffigen.yml b/.github/workflows/ffigen.yml index 22c151b4d..a5a0cc5f1 100644 --- a/.github/workflows/ffigen.yml +++ b/.github/workflows/ffigen.yml @@ -31,8 +31,8 @@ jobs: # strategy: # fail-fast: false # steps: - # - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - # - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + # - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + # - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # with: # channel: 'stable' # - id: install @@ -53,8 +53,8 @@ jobs: # run: # working-directory: pkgs/ffigen/ # steps: - # - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - # - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + # - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + # - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # with: # channel: 'stable' # - name: Install dependencies @@ -74,8 +74,8 @@ jobs: run: working-directory: pkgs/ffigen/ steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' - name: Install dependencies @@ -151,8 +151,8 @@ jobs: # run: # working-directory: pkgs/ffigen/ # steps: - # - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - # - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + # - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + # - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # with: # channel: "master" # - name: Install dependencies diff --git a/.github/workflows/ffigen_weekly.yml b/.github/workflows/ffigen_weekly.yml index e1304365a..863eac384 100644 --- a/.github/workflows/ffigen_weekly.yml +++ b/.github/workflows/ffigen_weekly.yml @@ -27,8 +27,8 @@ jobs: run: working-directory: pkgs/ffigen/ steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' - name: Install dependencies diff --git a/.github/workflows/jnigen.yaml b/.github/workflows/jnigen.yaml index e64bf7f9e..462c84f10 100644 --- a/.github/workflows/jnigen.yaml +++ b/.github/workflows/jnigen.yaml @@ -40,15 +40,16 @@ jobs: matrix: sdk: [stable] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: ${{ matrix.sdk }} cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a + - uses: axel-op/googlejavaformat-action@0dc4ef525e7ed73d8dff50b1b062a4d441d014b5 name: 'Check Java formatting with google-java-format' with: + version: 'v1.24.0' args: '--set-exit-if-changed' - id: install name: Install dependencies @@ -75,13 +76,13 @@ jobs: os: [ubuntu-latest] sdk: [stable, beta] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: ${{ matrix.sdk }} cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -112,7 +113,7 @@ jobs: - name: Collect coverage run: dart pub global run coverage:test_with_coverage - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: flag-name: jnigen github-token: ${{ secrets.GITHUB_TOKEN }} @@ -126,19 +127,20 @@ jobs: run: working-directory: ./pkgs/jni steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' - - uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a + - uses: axel-op/googlejavaformat-action@0dc4ef525e7ed73d8dff50b1b062a4d441d014b5 name: 'Check Java formatting with google-java-format' with: + version: 'v1.24.0' args: '--set-exit-if-changed' - name: install clang tools & CMake run: | @@ -164,13 +166,13 @@ jobs: run: working-directory: ./pkgs/jni steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -188,7 +190,7 @@ jobs: - name: Collect coverage run: dart pub global run coverage:test_with_coverage - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: flag-name: jni github-token: ${{ secrets.GITHUB_TOKEN }} @@ -213,13 +215,13 @@ jobs: run: working-directory: ./pkgs/jni steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -235,18 +237,18 @@ jobs: run: working-directory: ./pkgs/jnigen steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Setup clang uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d with: version: latest platform: x64 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -266,13 +268,13 @@ jobs: run: working-directory: ./pkgs/jni steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'temurin' java-version: '17' @@ -287,17 +289,17 @@ jobs: run: working-directory: ./pkgs/jnigen steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Setup clang format uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 with: brew: clang-format - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'temurin' java-version: '17' @@ -314,13 +316,13 @@ jobs: run: working-directory: ./pkgs/jni/example steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -338,13 +340,13 @@ jobs: run: working-directory: ./pkgs/jni/example steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -358,12 +360,12 @@ jobs: run: working-directory: ./pkgs/jni/example steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true @@ -377,13 +379,13 @@ jobs: run: working-directory: ./pkgs/jnigen/example/pdfbox_plugin steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b with: distribution: 'zulu' java-version: '17' @@ -416,7 +418,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Coveralls finished - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c,swift2objc" github-token: ${{ secrets.github_token }} diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml index c88245d2b..84ea83274 100644 --- a/.github/workflows/native.yaml +++ b/.github/workflows/native.yaml @@ -7,7 +7,7 @@ permissions: read-all on: pull_request: - branches: [main] + # No `branches:` to enable stacked PRs on GitHub. paths: - ".github/workflows/native.yaml" - "pkgs/native_assets_builder/**" @@ -44,9 +44,9 @@ jobs: working-directory: pkgs/${{ matrix.package }} steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} @@ -120,6 +120,15 @@ jobs: - run: dart pub get -C example/link/app_with_asset_treeshaking/ if: ${{ matrix.package == 'native_assets_cli' }} + - run: dart pub get -C test_data/fail_build/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/depend_on_fail_build/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/depend_on_fail_build_app/ + if: ${{ matrix.package == 'native_assets_builder' }} + - run: dart analyze --fatal-infos # Run on dev to ensure we're not depending on deprecated SDK things. @@ -133,6 +142,9 @@ jobs: - run: dart --enable-experiment=native-assets test working-directory: pkgs/${{ matrix.package }}/example/build/native_dynamic_linking/ + # TODO(https://github.com/dart-lang/native/issues/190): Enable on windows once + # https://github.com/dart-lang/sdk/commit/903eea6bfb8ee405587f0866a1d1e92eea45d29e + # has landed in dev channel. if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change && matrix.os != 'windows' }} - run: dart --enable-experiment=native-assets test @@ -162,7 +174,7 @@ jobs: run: dart pub global run coverage:test_with_coverage - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: flag-name: ${{ matrix.package }}_${{ matrix.os }} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -173,7 +185,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c,swift2objc" github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/native_toolchain_c.yaml b/.github/workflows/native_toolchain_c.yaml index f438d2ba8..5af91a33d 100644 --- a/.github/workflows/native_toolchain_c.yaml +++ b/.github/workflows/native_toolchain_c.yaml @@ -32,9 +32,9 @@ jobs: working-directory: pkgs/${{ matrix.package }} steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} diff --git a/.github/workflows/objective_c.yaml b/.github/workflows/objective_c.yaml index 5a9d94361..2c2ee64cb 100644 --- a/.github/workflows/objective_c.yaml +++ b/.github/workflows/objective_c.yaml @@ -30,8 +30,8 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' - id: install @@ -51,8 +51,8 @@ jobs: run: working-directory: pkgs/objective_c/ steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' - name: Install dependencies @@ -67,14 +67,14 @@ jobs: # any git-diffs at this point, it means the generated code is outdated. run: if [[ -n $(git status --porcelain | tee /dev/stderr) ]]; then echo -e "\nDIFF:"; git diff; false; fi - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: flag-name: objective_c github-token: ${{ secrets.GITHUB_TOKEN }} parallel: true path-to-lcov: pkgs/objective_c/coverage/lcov.info - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c,swift2objc" github-token: ${{ secrets.GITHUB_TOKEN }} @@ -87,8 +87,8 @@ jobs: run: working-directory: pkgs/objective_c/example/ steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 with: channel: 'stable' - name: Install dependencies diff --git a/.github/workflows/swift2objc.yaml b/.github/workflows/swift2objc.yaml index 26446a011..ddd79dd8e 100644 --- a/.github/workflows/swift2objc.yaml +++ b/.github/workflows/swift2objc.yaml @@ -28,8 +28,8 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: stable - id: install @@ -49,8 +49,8 @@ jobs: run: working-directory: pkgs/swift2objc/ steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: stable - name: Install dependencies @@ -58,14 +58,14 @@ jobs: - name: Run VM tests and collect coverage run: dart run coverage:test_with_coverage --scope-output=swift2objc - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: flag-name: swift2objc github-token: ${{ secrets.GITHUB_TOKEN }} parallel: true path-to-lcov: pkgs/swift2objc/coverage/lcov.info - name: Upload coverage - uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 + uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 with: carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c,swift2objc" github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 284111fec..b432d9de0 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,29 @@ building and bundling. ## Packages -| Package | Description | Version | -| --- | --- | --- | -| [ffi](pkgs/ffi/) | Utilities for working with Foreign Function Interface (FFI) code. | [![pub package](https://img.shields.io/pub/v/ffi.svg)](https://pub.dev/packages/ffi) | -| [ffigen](pkgs/ffigen/) | Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files. | [![pub package](https://img.shields.io/pub/v/ffigen.svg)](https://pub.dev/packages/ffigen) | -| [objective_c](pkgs/objective_c/) | A library to access Objective C from Flutter that acts as a support library for package:ffigen. | [![pub package](https://img.shields.io/pub/v/objective_c.svg)](https://pub.dev/packages/objective_c) | -| [jni](pkgs/jni/) | A library to access JNI from Dart and Flutter that acts as a support library for `package:jnigen`. | [![pub package](https://img.shields.io/pub/v/jni.svg)](https://pub.dev/packages/jni) | -| [jnigen](pkgs/jnigen/) | A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine. | [![pub package](https://img.shields.io/pub/v/jnigen.svg)](https://pub.dev/packages/jnigen) | -| [swift2objc](pkgs/swift2objc/) | Generates ObjC compatibility wrappers for Swift APIs. | [![pub package](https://img.shields.io/pub/v/swift2objc.svg)](https://pub.dev/packages/swift2objc) | -| [swiftgen](pkgs/swiftgen/) | A Dart bindings generator for Swift. | [![pub package](https://img.shields.io/pub/v/swiftgen.svg)](https://pub.dev/packages/swiftgen) | -| [native_assets_builder](pkgs/native_assets_builder/) | This package is the backend that invokes build hooks. | [![pub package](https://img.shields.io/pub/v/native_assets_builder.svg)](https://pub.dev/packages/native_assets_builder) | -| [native_assets_cli](pkgs/native_assets_cli/) | A library that contains the argument and file formats for implementing a native assets CLI. | [![pub package](https://img.shields.io/pub/v/native_assets_cli.svg)](https://pub.dev/packages/native_assets_cli) | -| [native_toolchain_c](pkgs/native_toolchain_c/) | A library to invoke the native C compiler installed on the host machine. | [![pub package](https://img.shields.io/pub/v/native_toolchain_c.svg)](https://pub.dev/packages/native_toolchain_c) | +| Package | Description | Issues | Version | +| --- | --- | --- | --- | +| [ffi](pkgs/ffi/) | Utilities for working with Foreign Function Interface (FFI) code. | [![issues](https://img.shields.io/badge/package:ffi-4774bc)][ffi_issues] | [![pub package](https://img.shields.io/pub/v/ffi.svg)](https://pub.dev/packages/ffi) | +| [ffigen](pkgs/ffigen/) | Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files. | [![issues](https://img.shields.io/badge/package:ffigen-4774bc)][ffigen_issues] | [![pub package](https://img.shields.io/pub/v/ffigen.svg)](https://pub.dev/packages/ffigen) | +| [jni](pkgs/jni/) | A library to access JNI from Dart and Flutter that acts as a support library for package:jnigen. | [![issues](https://img.shields.io/badge/package:jni-4774bc)][jni_issues] | [![pub package](https://img.shields.io/pub/v/jni.svg)](https://pub.dev/packages/jni) | +| [jnigen](pkgs/jnigen/) | A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine. | [![issues](https://img.shields.io/badge/package:jnigen-4774bc)][jnigen_issues] | [![pub package](https://img.shields.io/pub/v/jnigen.svg)](https://pub.dev/packages/jnigen) | +| [native_assets_builder](pkgs/native_assets_builder/) | This package is the backend that invokes build hooks. | [![issues](https://img.shields.io/badge/package:native__assets__builder-4774bc)][native_assets_builder_issues] | | +| [native_assets_cli](pkgs/native_assets_cli/) | A library that contains the argument and file formats for implementing a native assets CLI. | [![issues](https://img.shields.io/badge/package:native__assets__cli-4774bc)][native_assets_cli_issues] | | +| [native_toolchain_c](pkgs/native_toolchain_c/) | A library to invoke the native C compiler installed on the host machine. | [![issues](https://img.shields.io/badge/package:native__toolchain__c-4774bc)][native_toolchain_c_issues] | | +| [objective_c](pkgs/objective_c/) | A library to access Objective C from Flutter that acts as a support library for package:ffigen. | [![issues](https://img.shields.io/badge/package:objective__c-4774bc)][objective_c_issues] | [![pub package](https://img.shields.io/pub/v/objective_c.svg)](https://pub.dev/packages/objective_c) | +| [swift2objc](pkgs/swift2objc/) | A tool for generating bindings that allow interop between Dart and Swift code. | [![issues](https://img.shields.io/badge/package:swift2objc-4774bc)][swift2objc_issues] | [![pub package](https://img.shields.io/pub/v/swift2objc.svg)](https://pub.dev/packages/swift2objc) | +| [swiftgen](pkgs/swiftgen/) | A tool for generating bindings that allow interop between Dart and Swift code. | [![issues](https://img.shields.io/badge/package:swiftgen-4774bc)][swiftgen_issues] | [![pub package](https://img.shields.io/pub/v/swiftgen.svg)](https://pub.dev/packages/swiftgen) | + +[ffi_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Affi +[ffigen_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Affigen +[jni_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ajni +[jnigen_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ajnigen +[native_assets_builder_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Anative_assets_builder +[native_assets_cli_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Anative_assets_cli +[native_toolchain_c_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Anative_toolchain_c +[objective_c_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aobjective_c +[swift2objc_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aswift2objc +[swiftgen_issues]: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aswiftgen ## External packages diff --git a/pkgs/ffi/pubspec.yaml b/pkgs/ffi/pubspec.yaml index 1a3e9d240..55261524e 100644 --- a/pkgs/ffi/pubspec.yaml +++ b/pkgs/ffi/pubspec.yaml @@ -2,6 +2,7 @@ name: ffi version: 2.1.3 description: Utilities for working with Foreign Function Interface (FFI) code. repository: https://github.com/dart-lang/native/tree/main/pkgs/ffi +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Affi topics: - interop diff --git a/pkgs/ffigen/CHANGELOG.md b/pkgs/ffigen/CHANGELOG.md index 46c97e3b8..964eaee34 100644 --- a/pkgs/ffigen/CHANGELOG.md +++ b/pkgs/ffigen/CHANGELOG.md @@ -1,6 +1,40 @@ -## 15.1.0-wip +## 16.0.1-wip + +- Ensure that required symbols are available to FFI even when the final binary + is linked with `-dead_strip`. +- Handle dart typedefs in import/export of symbol files. + +## 16.0.0 - Ensure all protocols referenced in bindings are available at runtime. +- Use `package:dart_style` directly to format generated Dart code, rather than + subprocessing to `dart format`. +- Use package:objective_c 4.0.0 +- Fix various small bugs todo with config filters: + - https://github.com/dart-lang/native/issues/1582 + - https://github.com/dart-lang/native/issues/1594 + - https://github.com/dart-lang/native/issues/1595 +- Fix [a bug](https://github.com/dart-lang/native/issues/1701) where nullable + typealiases were treated as non-null. +- Allow static and instance methods to have the same name: + https://github.com/dart-lang/native/issues/1136 +- __Breaking change__: Change the way ObjC categories are generated. Instead of + inserting their methods into the interface, generate Dart extension methods. + For instance methods this makes no difference to user code (as long as the + extension methods are imported correctly). But for static methods it means + `MyInterface.staticMethod` must change to `MyCategory.staticMethod`. + Categories are included/excluded by the `objc-categories` config entry. +- Add `include-transitive-objc-interfaces`, `include-transitive-objc-protocols`, + and `include-transitive-objc-categories` config flags, which control whether + transitively included ObjC interfaces, protocols, and categories are + generated. +- __Breaking change__: `include-transitive-objc-interfaces` defaults to false, + which changes the default behavior from pulling in all transitive deps, to + generating them as stubs. `include-transitive-objc-protocols` defaults to + false, and `include-transitive-objc-categories` defaults to true, but these + both replicate the existing behavior. +- Fix [bugs](https://github.com/dart-lang/native/issues/1220) caused by + mismatches between ObjC and Dart's inheritance rules. ## 15.0.0 diff --git a/pkgs/ffigen/README.md b/pkgs/ffigen/README.md index 4ddf5255a..5077f7139 100644 --- a/pkgs/ffigen/README.md +++ b/pkgs/ffigen/README.md @@ -719,12 +719,14 @@ external-versions: - objc-interfaces

objc-protocols + objc-interfaces

+ objc-protocols

+ objc-categories - Filters for Objective C interface and protocol declarations. This option - works the same as other declaration filters like `functions` and - `structs`. + Filters for Objective C interface, protocol, and category declarations. + This option works the same as other declaration filters like `functions` + and `structs`. @@ -745,6 +747,10 @@ objc-protocols: include: # Generates bindings for a specific protocol. - MyProtocol +objc-category: + include: + # Generates bindings for a specific category. + - MyCategory ``` @@ -752,12 +758,15 @@ objc-protocols: - objc-interfaces.module

objc-protocols.module + objc-interfaces.module

+ objc-protocols.module Adds a module prefix to the interface/protocol name when loading it from the dylib. This is only relevent for ObjC headers that are generated wrappers for a Swift library. See example/swift for more information. +

+ This is not necessary for objc-categories. @@ -782,7 +791,9 @@ objc-interfaces: - objc-interfaces.member-filter

objc-protocols.member-filter + objc-interfaces.member-filter

+ objc-protocols.member-filter

+ objc-categories.member-filter Filters interface and protocol methods and properties. This is a map from @@ -806,10 +817,67 @@ objc-protocols: NS.*: # Matches all protocols starting with NS. exclude: - copy.* # Remove all copy methods from these protocols. +objc-categories: + member-filter: + MyCategory: + include: + - init.* # Include all init methods. ``` + + + + include-transitive-objc-interfaces

+ include-transitive-objc-protocols + + + By default, Objective-C interfaces and protocols that are not directly + included by the inclusion rules, but are transitively depended on by + the inclusions, are not fully code genned. Transitively included + interfaces are generated as stubs, and transitive protocols are omitted. +

+ If these flags are enabled, transitively included interfaces and protocols + are fully code genned. +

+ Default: false + + + +```yaml +include-transitive-objc-interfaces: true +include-transitive-objc-protocols: true +``` + + + + + + include-transitive-objc-categories + + + By default, if an Objective-C interface is included in the bindings, all + the categories that extend it are also included. To filter them, set this + flag to false, then use objc-categories to include/exclude particular + categories. +

+ Transitive categories are generated by default because it's not always + obvious from the Apple documentation which interface methods are declared + directly in the interface, and which are declared in categories. So it may + appear that the interface is missing methods, when in fact those methods + are part of a category. This would be a difficult problem to diagnose if + transitive categories were not generated by default. +

+ Default: true + + + +```yaml +include-transitive-objc-categories: false +``` + + diff --git a/pkgs/ffigen/example/libclang-example/generated_bindings.dart b/pkgs/ffigen/example/libclang-example/generated_bindings.dart index 3373a0f3e..3285e6587 100644 --- a/pkgs/ffigen/example/libclang-example/generated_bindings.dart +++ b/pkgs/ffigen/example/libclang-example/generated_bindings.dart @@ -7672,10 +7672,25 @@ typedef NativeClang_disposeStringSet = ffi.Void Function( typedef DartClang_disposeStringSet = void Function( ffi.Pointer set1); +/// An "index" that consists of a set of translation units that would +/// typically be linked together into an executable or library. +typedef CXIndex = ffi.Pointer; + final class CXTargetInfoImpl extends ffi.Opaque {} +/// An opaque type representing target information for a given translation +/// unit. +typedef CXTargetInfo = ffi.Pointer; + final class CXTranslationUnitImpl extends ffi.Opaque {} +/// A single translation unit, which resides in an index. +typedef CXTranslationUnit = ffi.Pointer; + +/// Opaque pointer representing client data that will be passed through +/// to various callbacks and visitors. +typedef CXClientData = ffi.Pointer; + /// Provides the contents of a file that has not yet been saved to disk. /// /// Each CXUnsavedFile instance provides the name of a file on the @@ -7695,6 +7710,37 @@ final class CXUnsavedFile extends ffi.Struct { external int Length; } +/// Describes the availability of a particular entity, which indicates +/// whether the use of this entity will result in a warning or error due to +/// it being deprecated or unavailable. +enum CXAvailabilityKind { + /// The entity is available. + CXAvailability_Available(0), + + /// The entity is available, but has been deprecated (and its use is + /// not recommended). + CXAvailability_Deprecated(1), + + /// The entity is not available; any use of it will be an error. + CXAvailability_NotAvailable(2), + + /// The entity is available, but not accessible; any use of it will be + /// an error. + CXAvailability_NotAccessible(3); + + final int value; + const CXAvailabilityKind(this.value); + + static CXAvailabilityKind fromValue(int value) => switch (value) { + 0 => CXAvailability_Available, + 1 => CXAvailability_Deprecated, + 2 => CXAvailability_NotAvailable, + 3 => CXAvailability_NotAccessible, + _ => + throw ArgumentError("Unknown value for CXAvailabilityKind: $value"), + }; +} + /// Describes a version number of the form major.minor.subminor. final class CXVersion extends ffi.Struct { /// The major version number, e.g., the '10' in '10.7.3'. A negative @@ -7715,9 +7761,6 @@ final class CXVersion extends ffi.Struct { external int Subminor; } -/// An "index" that consists of a set of translation units that would -/// typically be linked together into an executable or library. -typedef CXIndex = ffi.Pointer; typedef NativeClang_createIndex = CXIndex Function( ffi.Int excludeDeclarationsFromPCH, ffi.Int displayDiagnostics); typedef DartClang_createIndex = CXIndex Function( @@ -7789,9 +7832,6 @@ typedef NativeClang_getFileUniqueID = ffi.Int Function( CXFile file, ffi.Pointer outID); typedef DartClang_getFileUniqueID = int Function( CXFile file, ffi.Pointer outID); - -/// A single translation unit, which resides in an index. -typedef CXTranslationUnit = ffi.Pointer; typedef NativeClang_isFileMultipleIncludeGuarded = ffi.UnsignedInt Function( CXTranslationUnit tu, CXFile file); typedef DartClang_isFileMultipleIncludeGuarded = int Function( @@ -7963,15 +8003,51 @@ typedef NativeClang_disposeSourceRangeList = ffi.Void Function( typedef DartClang_disposeSourceRangeList = void Function( ffi.Pointer ranges); +/// Describes the severity of a particular diagnostic. +enum CXDiagnosticSeverity { + /// A diagnostic that has been suppressed, e.g., by a command-line + /// option. + CXDiagnostic_Ignored(0), + + /// This diagnostic is a note that should be attached to the + /// previous (non-note) diagnostic. + CXDiagnostic_Note(1), + + /// This diagnostic indicates suspicious code that may not be + /// wrong. + CXDiagnostic_Warning(2), + + /// This diagnostic indicates that the code is ill-formed. + CXDiagnostic_Error(3), + + /// This diagnostic indicates that the code is ill-formed such + /// that future parser recovery is unlikely to produce useful + /// results. + CXDiagnostic_Fatal(4); + + final int value; + const CXDiagnosticSeverity(this.value); + + static CXDiagnosticSeverity fromValue(int value) => switch (value) { + 0 => CXDiagnostic_Ignored, + 1 => CXDiagnostic_Note, + 2 => CXDiagnostic_Warning, + 3 => CXDiagnostic_Error, + 4 => CXDiagnostic_Fatal, + _ => + throw ArgumentError("Unknown value for CXDiagnosticSeverity: $value"), + }; +} + +/// A single diagnostic, containing the diagnostic's severity, +/// location, text, source ranges, and fix-it hints. +typedef CXDiagnostic = ffi.Pointer; + /// A group of CXDiagnostics. typedef CXDiagnosticSet = ffi.Pointer; typedef NativeClang_getNumDiagnosticsInSet = ffi.UnsignedInt Function( CXDiagnosticSet Diags); typedef DartClang_getNumDiagnosticsInSet = int Function(CXDiagnosticSet Diags); - -/// A single diagnostic, containing the diagnostic's severity, -/// location, text, source ranges, and fix-it hints. -typedef CXDiagnostic = ffi.Pointer; typedef NativeClang_getDiagnosticInSet = CXDiagnostic Function( CXDiagnosticSet Diags, ffi.UnsignedInt Index); typedef DartClang_getDiagnosticInSet = CXDiagnostic Function( @@ -8043,43 +8119,6 @@ typedef DartClang_formatDiagnostic = CXString Function( typedef NativeClang_defaultDiagnosticDisplayOptions = ffi.UnsignedInt Function(); typedef DartClang_defaultDiagnosticDisplayOptions = int Function(); - -/// Describes the severity of a particular diagnostic. -enum CXDiagnosticSeverity { - /// A diagnostic that has been suppressed, e.g., by a command-line - /// option. - CXDiagnostic_Ignored(0), - - /// This diagnostic is a note that should be attached to the - /// previous (non-note) diagnostic. - CXDiagnostic_Note(1), - - /// This diagnostic indicates suspicious code that may not be - /// wrong. - CXDiagnostic_Warning(2), - - /// This diagnostic indicates that the code is ill-formed. - CXDiagnostic_Error(3), - - /// This diagnostic indicates that the code is ill-formed such - /// that future parser recovery is unlikely to produce useful - /// results. - CXDiagnostic_Fatal(4); - - final int value; - const CXDiagnosticSeverity(this.value); - - static CXDiagnosticSeverity fromValue(int value) => switch (value) { - 0 => CXDiagnostic_Ignored, - 1 => CXDiagnostic_Note, - 2 => CXDiagnostic_Warning, - 3 => CXDiagnostic_Error, - 4 => CXDiagnostic_Fatal, - _ => - throw ArgumentError("Unknown value for CXDiagnosticSeverity: $value"), - }; -} - typedef NativeClang_getDiagnosticSeverity = ffi.UnsignedInt Function( CXDiagnostic arg0); typedef DartClang_getDiagnosticSeverity = int Function(CXDiagnostic arg0); @@ -8363,10 +8402,6 @@ typedef NativeClang_disposeCXTUResourceUsage = ffi.Void Function( CXTUResourceUsage usage); typedef DartClang_disposeCXTUResourceUsage = void Function( CXTUResourceUsage usage); - -/// An opaque type representing target information for a given translation -/// unit. -typedef CXTargetInfo = ffi.Pointer; typedef NativeClang_getTranslationUnitTargetInfo = CXTargetInfo Function( CXTranslationUnit CTUnit); typedef DartClang_getTranslationUnitTargetInfo = CXTargetInfo Function( @@ -9597,38 +9632,6 @@ enum CXVisibilityKind { typedef NativeClang_getCursorVisibility = ffi.UnsignedInt Function( CXCursor cursor); typedef DartClang_getCursorVisibility = int Function(CXCursor cursor); - -/// Describes the availability of a particular entity, which indicates -/// whether the use of this entity will result in a warning or error due to -/// it being deprecated or unavailable. -enum CXAvailabilityKind { - /// The entity is available. - CXAvailability_Available(0), - - /// The entity is available, but has been deprecated (and its use is - /// not recommended). - CXAvailability_Deprecated(1), - - /// The entity is not available; any use of it will be an error. - CXAvailability_NotAvailable(2), - - /// The entity is available, but not accessible; any use of it will be - /// an error. - CXAvailability_NotAccessible(3); - - final int value; - const CXAvailabilityKind(this.value); - - static CXAvailabilityKind fromValue(int value) => switch (value) { - 0 => CXAvailability_Available, - 1 => CXAvailability_Deprecated, - 2 => CXAvailability_NotAvailable, - 3 => CXAvailability_NotAccessible, - _ => - throw ArgumentError("Unknown value for CXAvailabilityKind: $value"), - }; -} - typedef NativeClang_getCursorAvailability = ffi.UnsignedInt Function( CXCursor cursor); typedef DartClang_getCursorAvailability = int Function(CXCursor cursor); @@ -10038,6 +10041,64 @@ enum CXTypeKind { } } +/// Describes the calling convention of a function type +enum CXCallingConv { + CXCallingConv_Default(0), + CXCallingConv_C(1), + CXCallingConv_X86StdCall(2), + CXCallingConv_X86FastCall(3), + CXCallingConv_X86ThisCall(4), + CXCallingConv_X86Pascal(5), + CXCallingConv_AAPCS(6), + CXCallingConv_AAPCS_VFP(7), + CXCallingConv_X86RegCall(8), + CXCallingConv_IntelOclBicc(9), + CXCallingConv_Win64(10), + CXCallingConv_X86_64SysV(11), + CXCallingConv_X86VectorCall(12), + CXCallingConv_Swift(13), + CXCallingConv_PreserveMost(14), + CXCallingConv_PreserveAll(15), + CXCallingConv_AArch64VectorCall(16), + CXCallingConv_Invalid(100), + CXCallingConv_Unexposed(200); + + static const CXCallingConv_X86_64Win64 = CXCallingConv_Win64; + + final int value; + const CXCallingConv(this.value); + + static CXCallingConv fromValue(int value) => switch (value) { + 0 => CXCallingConv_Default, + 1 => CXCallingConv_C, + 2 => CXCallingConv_X86StdCall, + 3 => CXCallingConv_X86FastCall, + 4 => CXCallingConv_X86ThisCall, + 5 => CXCallingConv_X86Pascal, + 6 => CXCallingConv_AAPCS, + 7 => CXCallingConv_AAPCS_VFP, + 8 => CXCallingConv_X86RegCall, + 9 => CXCallingConv_IntelOclBicc, + 10 => CXCallingConv_Win64, + 11 => CXCallingConv_X86_64SysV, + 12 => CXCallingConv_X86VectorCall, + 13 => CXCallingConv_Swift, + 14 => CXCallingConv_PreserveMost, + 15 => CXCallingConv_PreserveAll, + 16 => CXCallingConv_AArch64VectorCall, + 100 => CXCallingConv_Invalid, + 200 => CXCallingConv_Unexposed, + _ => throw ArgumentError("Unknown value for CXCallingConv: $value"), + }; + + @override + String toString() { + if (this == CXCallingConv_Win64) + return "CXCallingConv.CXCallingConv_Win64, CXCallingConv.CXCallingConv_X86_64Win64"; + return super.toString(); + } +} + /// The type of an element in the abstract syntax tree. final class CXType extends ffi.Struct { @ffi.UnsignedInt() @@ -10070,9 +10131,6 @@ typedef DartClang_Cursor_getNumArguments = int Function(CXCursor C); typedef NativeClang_Cursor_getArgument = CXCursor Function( CXCursor C, ffi.UnsignedInt i); typedef DartClang_Cursor_getArgument = CXCursor Function(CXCursor C, int i); -typedef NativeClang_Cursor_getNumTemplateArguments = ffi.Int Function( - CXCursor C); -typedef DartClang_Cursor_getNumTemplateArguments = int Function(CXCursor C); /// Describes the kind of a template argument. /// @@ -10109,6 +10167,9 @@ enum CXTemplateArgumentKind { }; } +typedef NativeClang_Cursor_getNumTemplateArguments = ffi.Int Function( + CXCursor C); +typedef DartClang_Cursor_getNumTemplateArguments = int Function(CXCursor C); typedef NativeClang_Cursor_getTemplateArgumentKind = ffi.UnsignedInt Function( CXCursor C, ffi.UnsignedInt I); typedef DartClang_Cursor_getTemplateArgumentKind = int Function( @@ -10160,65 +10221,6 @@ typedef NativeClang_Type_getObjCEncoding = CXString Function(CXType type); typedef DartClang_Type_getObjCEncoding = CXString Function(CXType type); typedef NativeClang_getTypeKindSpelling = CXString Function(ffi.UnsignedInt K); typedef DartClang_getTypeKindSpelling = CXString Function(int K); - -/// Describes the calling convention of a function type -enum CXCallingConv { - CXCallingConv_Default(0), - CXCallingConv_C(1), - CXCallingConv_X86StdCall(2), - CXCallingConv_X86FastCall(3), - CXCallingConv_X86ThisCall(4), - CXCallingConv_X86Pascal(5), - CXCallingConv_AAPCS(6), - CXCallingConv_AAPCS_VFP(7), - CXCallingConv_X86RegCall(8), - CXCallingConv_IntelOclBicc(9), - CXCallingConv_Win64(10), - CXCallingConv_X86_64SysV(11), - CXCallingConv_X86VectorCall(12), - CXCallingConv_Swift(13), - CXCallingConv_PreserveMost(14), - CXCallingConv_PreserveAll(15), - CXCallingConv_AArch64VectorCall(16), - CXCallingConv_Invalid(100), - CXCallingConv_Unexposed(200); - - static const CXCallingConv_X86_64Win64 = CXCallingConv_Win64; - - final int value; - const CXCallingConv(this.value); - - static CXCallingConv fromValue(int value) => switch (value) { - 0 => CXCallingConv_Default, - 1 => CXCallingConv_C, - 2 => CXCallingConv_X86StdCall, - 3 => CXCallingConv_X86FastCall, - 4 => CXCallingConv_X86ThisCall, - 5 => CXCallingConv_X86Pascal, - 6 => CXCallingConv_AAPCS, - 7 => CXCallingConv_AAPCS_VFP, - 8 => CXCallingConv_X86RegCall, - 9 => CXCallingConv_IntelOclBicc, - 10 => CXCallingConv_Win64, - 11 => CXCallingConv_X86_64SysV, - 12 => CXCallingConv_X86VectorCall, - 13 => CXCallingConv_Swift, - 14 => CXCallingConv_PreserveMost, - 15 => CXCallingConv_PreserveAll, - 16 => CXCallingConv_AArch64VectorCall, - 100 => CXCallingConv_Invalid, - 200 => CXCallingConv_Unexposed, - _ => throw ArgumentError("Unknown value for CXCallingConv: $value"), - }; - - @override - String toString() { - if (this == CXCallingConv_Win64) - return "CXCallingConv.CXCallingConv_Win64, CXCallingConv.CXCallingConv_X86_64Win64"; - return super.toString(); - } -} - typedef NativeClang_getFunctionTypeCallingConv = ffi.UnsignedInt Function( CXType T); typedef DartClang_getFunctionTypeCallingConv = int Function(CXType T); @@ -10321,12 +10323,6 @@ typedef DartClang_Cursor_isAnonymousRecordDecl = int Function(CXCursor C); typedef NativeClang_Cursor_isInlineNamespace = ffi.UnsignedInt Function( CXCursor C); typedef DartClang_Cursor_isInlineNamespace = int Function(CXCursor C); -typedef NativeClang_Type_getNumTemplateArguments = ffi.Int Function(CXType T); -typedef DartClang_Type_getNumTemplateArguments = int Function(CXType T); -typedef NativeClang_Type_getTemplateArgumentAsType = CXType Function( - CXType T, ffi.UnsignedInt i); -typedef DartClang_Type_getTemplateArgumentAsType = CXType Function( - CXType T, int i); enum CXRefQualifierKind { /// No ref-qualifier was provided. @@ -10350,6 +10346,12 @@ enum CXRefQualifierKind { }; } +typedef NativeClang_Type_getNumTemplateArguments = ffi.Int Function(CXType T); +typedef DartClang_Type_getNumTemplateArguments = int Function(CXType T); +typedef NativeClang_Type_getTemplateArgumentAsType = CXType Function( + CXType T, ffi.UnsignedInt i); +typedef DartClang_Type_getTemplateArgumentAsType = CXType Function( + CXType T, int i); typedef NativeClang_Type_getCXXRefQualifier = ffi.UnsignedInt Function( CXType T); typedef DartClang_Type_getCXXRefQualifier = int Function(CXType T); @@ -10453,9 +10455,6 @@ enum CXChildVisitResult { }; } -/// Opaque pointer representing client data that will be passed through -/// to various callbacks and visitors. -typedef CXClientData = ffi.Pointer; typedef CXCursorVisitorFunction = ffi.UnsignedInt Function( CXCursor cursor, CXCursor parent, CXClientData client_data); typedef DartCXCursorVisitorFunction = CXChildVisitResult Function( @@ -10750,19 +10749,6 @@ typedef NativeClang_getCursorReferenceNameRange = CXSourceRange Function( typedef DartClang_getCursorReferenceNameRange = CXSourceRange Function( CXCursor C, int NameFlags, int PieceIndex); -/// Describes a single preprocessing token. -final class CXToken extends ffi.Struct { - @ffi.Array.multi([4]) - external ffi.Array int_data; - - external ffi.Pointer ptr_data; -} - -typedef NativeClang_getToken = ffi.Pointer Function( - CXTranslationUnit TU, CXSourceLocation Location); -typedef DartClang_getToken = ffi.Pointer Function( - CXTranslationUnit TU, CXSourceLocation Location); - /// Describes a kind of token. enum CXTokenKind { /// A token that contains some kind of punctuation. @@ -10793,6 +10779,18 @@ enum CXTokenKind { }; } +/// Describes a single preprocessing token. +final class CXToken extends ffi.Struct { + @ffi.Array.multi([4]) + external ffi.Array int_data; + + external ffi.Pointer ptr_data; +} + +typedef NativeClang_getToken = ffi.Pointer Function( + CXTranslationUnit TU, CXSourceLocation Location); +typedef DartClang_getToken = ffi.Pointer Function( + CXTranslationUnit TU, CXSourceLocation Location); typedef NativeClang_getTokenKind = ffi.UnsignedInt Function(CXToken arg0); typedef DartClang_getTokenKind = int Function(CXToken arg0); typedef NativeClang_getTokenSpelling = CXString Function( @@ -11230,11 +11228,6 @@ typedef NativeClang_getInclusions = ffi.Void Function( typedef DartClang_getInclusions = void Function( CXTranslationUnit tu, CXInclusionVisitor visitor, CXClientData client_data); -/// Evaluation result of a cursor -typedef CXEvalResult = ffi.Pointer; -typedef NativeClang_Cursor_Evaluate = CXEvalResult Function(CXCursor C); -typedef DartClang_Cursor_Evaluate = CXEvalResult Function(CXCursor C); - enum CXEvalResultKind { CXEval_Int(1), CXEval_Float(2), @@ -11259,6 +11252,10 @@ enum CXEvalResultKind { }; } +/// Evaluation result of a cursor +typedef CXEvalResult = ffi.Pointer; +typedef NativeClang_Cursor_Evaluate = CXEvalResult Function(CXCursor C); +typedef DartClang_Cursor_Evaluate = CXEvalResult Function(CXCursor C); typedef NativeClang_EvalResult_getKind = ffi.UnsignedInt Function( CXEvalResult E); typedef DartClang_EvalResult_getKind = int Function(CXEvalResult E); @@ -11366,6 +11363,20 @@ typedef NativeClang_findIncludesInFile = ffi.UnsignedInt Function( typedef DartClang_findIncludesInFile = int Function( CXTranslationUnit TU, CXFile file, CXCursorAndRangeVisitor visitor); +/// The client's data object that is associated with a CXFile. +typedef CXIdxClientFile = ffi.Pointer; + +/// The client's data object that is associated with a semantic entity. +typedef CXIdxClientEntity = ffi.Pointer; + +/// The client's data object that is associated with a semantic container +/// of entities. +typedef CXIdxClientContainer = ffi.Pointer; + +/// The client's data object that is associated with an AST file (PCH +/// or module). +typedef CXIdxClientASTFile = ffi.Pointer; + /// Source location passed to index callbacks. final class CXIdxLoc extends ffi.Struct { @ffi.Array.multi([2]) @@ -11415,35 +11426,6 @@ final class CXIdxImportedASTFileInfo extends ffi.Struct { external int isImplicit; } -enum CXIdxAttrKind { - CXIdxAttr_Unexposed(0), - CXIdxAttr_IBAction(1), - CXIdxAttr_IBOutlet(2), - CXIdxAttr_IBOutletCollection(3); - - final int value; - const CXIdxAttrKind(this.value); - - static CXIdxAttrKind fromValue(int value) => switch (value) { - 0 => CXIdxAttr_Unexposed, - 1 => CXIdxAttr_IBAction, - 2 => CXIdxAttr_IBOutlet, - 3 => CXIdxAttr_IBOutletCollection, - _ => throw ArgumentError("Unknown value for CXIdxAttrKind: $value"), - }; -} - -final class CXIdxAttrInfo extends ffi.Struct { - @ffi.UnsignedInt() - external int kindAsInt; - - CXIdxAttrKind get kind => CXIdxAttrKind.fromValue(kindAsInt); - - external CXCursor cursor; - - external CXIdxLoc loc; -} - enum CXIdxEntityKind { CXIdxEntity_Unexposed(0), CXIdxEntity_Typedef(1), @@ -11508,6 +11490,27 @@ enum CXIdxEntityKind { }; } +enum CXIdxEntityLanguage { + CXIdxEntityLang_None(0), + CXIdxEntityLang_C(1), + CXIdxEntityLang_ObjC(2), + CXIdxEntityLang_CXX(3), + CXIdxEntityLang_Swift(4); + + final int value; + const CXIdxEntityLanguage(this.value); + + static CXIdxEntityLanguage fromValue(int value) => switch (value) { + 0 => CXIdxEntityLang_None, + 1 => CXIdxEntityLang_C, + 2 => CXIdxEntityLang_ObjC, + 3 => CXIdxEntityLang_CXX, + 4 => CXIdxEntityLang_Swift, + _ => + throw ArgumentError("Unknown value for CXIdxEntityLanguage: $value"), + }; +} + /// Extra C++ template information for an entity. This can apply to: /// CXIdxEntity_Function /// CXIdxEntity_CXXClass @@ -11535,27 +11538,35 @@ enum CXIdxEntityCXXTemplateKind { }; } -enum CXIdxEntityLanguage { - CXIdxEntityLang_None(0), - CXIdxEntityLang_C(1), - CXIdxEntityLang_ObjC(2), - CXIdxEntityLang_CXX(3), - CXIdxEntityLang_Swift(4); +enum CXIdxAttrKind { + CXIdxAttr_Unexposed(0), + CXIdxAttr_IBAction(1), + CXIdxAttr_IBOutlet(2), + CXIdxAttr_IBOutletCollection(3); final int value; - const CXIdxEntityLanguage(this.value); + const CXIdxAttrKind(this.value); - static CXIdxEntityLanguage fromValue(int value) => switch (value) { - 0 => CXIdxEntityLang_None, - 1 => CXIdxEntityLang_C, - 2 => CXIdxEntityLang_ObjC, - 3 => CXIdxEntityLang_CXX, - 4 => CXIdxEntityLang_Swift, - _ => - throw ArgumentError("Unknown value for CXIdxEntityLanguage: $value"), + static CXIdxAttrKind fromValue(int value) => switch (value) { + 0 => CXIdxAttr_Unexposed, + 1 => CXIdxAttr_IBAction, + 2 => CXIdxAttr_IBOutlet, + 3 => CXIdxAttr_IBOutletCollection, + _ => throw ArgumentError("Unknown value for CXIdxAttrKind: $value"), }; } +final class CXIdxAttrInfo extends ffi.Struct { + @ffi.UnsignedInt() + external int kindAsInt; + + CXIdxAttrKind get kind => CXIdxAttrKind.fromValue(kindAsInt); + + external CXCursor cursor; + + external CXIdxLoc loc; +} + final class CXIdxEntityInfo extends ffi.Struct { @ffi.UnsignedInt() external int kindAsInt; @@ -11817,6 +11828,67 @@ final class CXIdxEntityRefInfo extends ffi.Struct { CXSymbolRole get role => CXSymbolRole.fromValue(roleAsInt); } +/// A group of callbacks used by #clang_indexSourceFile and +/// #clang_indexTranslationUnit. +final class IndexerCallbacks extends ffi.Struct { + /// Called periodically to check whether indexing should be aborted. + /// Should return 0 to continue, and non-zero to abort. + external ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + CXClientData client_data, ffi.Pointer reserved)>> + abortQuery; + + /// Called at the end of indexing; passes the complete diagnostic set. + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + CXClientData, CXDiagnosticSet, ffi.Pointer)>> + diagnostic; + + external ffi.Pointer< + ffi.NativeFunction< + CXIdxClientFile Function(CXClientData client_data, CXFile mainFile, + ffi.Pointer reserved)>> enteredMainFile; + + /// Called when a file gets \#included/\#imported. + external ffi.Pointer< + ffi.NativeFunction< + CXIdxClientFile Function( + CXClientData, ffi.Pointer)>> + ppIncludedFile; + + /// Called when a AST file (PCH or module) gets imported. + /// + /// AST files will not get indexed (there will not be callbacks to index all + /// the entities in an AST file). The recommended action is that, if the AST + /// file is not already indexed, to initiate a new indexing job specific to + /// the AST file. + external ffi.Pointer< + ffi.NativeFunction< + CXIdxClientASTFile Function( + CXClientData, ffi.Pointer)>> + importedASTFile; + + /// Called at the beginning of indexing a translation unit. + external ffi.Pointer< + ffi.NativeFunction< + CXIdxClientContainer Function( + CXClientData client_data, ffi.Pointer reserved)>> + startedTranslationUnit; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(CXClientData, ffi.Pointer)>> + indexDeclaration; + + /// Called to index a reference of an entity. + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(CXClientData, ffi.Pointer)>> + indexEntityReference; +} + typedef NativeClang_index_isEntityObjCContainerKind = ffi.Int Function( ffi.UnsignedInt arg0); typedef DartClang_index_isEntityObjCContainerKind = int Function(int arg0); @@ -11861,10 +11933,6 @@ typedef NativeClang_index_getCXXClassDeclInfo ffi.Pointer arg0); typedef DartClang_index_getCXXClassDeclInfo = ffi.Pointer Function(ffi.Pointer arg0); - -/// The client's data object that is associated with a semantic container -/// of entities. -typedef CXIdxClientContainer = ffi.Pointer; typedef NativeClang_index_getClientContainer = CXIdxClientContainer Function( ffi.Pointer arg0); typedef DartClang_index_getClientContainer = CXIdxClientContainer Function( @@ -11873,9 +11941,6 @@ typedef NativeClang_index_setClientContainer = ffi.Void Function( ffi.Pointer arg0, CXIdxClientContainer arg1); typedef DartClang_index_setClientContainer = void Function( ffi.Pointer arg0, CXIdxClientContainer arg1); - -/// The client's data object that is associated with a semantic entity. -typedef CXIdxClientEntity = ffi.Pointer; typedef NativeClang_index_getClientEntity = CXIdxClientEntity Function( ffi.Pointer arg0); typedef DartClang_index_getClientEntity = CXIdxClientEntity Function( @@ -11892,75 +11957,6 @@ typedef NativeClang_IndexAction_create = CXIndexAction Function(CXIndex CIdx); typedef DartClang_IndexAction_create = CXIndexAction Function(CXIndex CIdx); typedef NativeClang_IndexAction_dispose = ffi.Void Function(CXIndexAction arg0); typedef DartClang_IndexAction_dispose = void Function(CXIndexAction arg0); - -/// The client's data object that is associated with a CXFile. -typedef CXIdxClientFile = ffi.Pointer; - -/// The client's data object that is associated with an AST file (PCH -/// or module). -typedef CXIdxClientASTFile = ffi.Pointer; - -/// A group of callbacks used by #clang_indexSourceFile and -/// #clang_indexTranslationUnit. -final class IndexerCallbacks extends ffi.Struct { - /// Called periodically to check whether indexing should be aborted. - /// Should return 0 to continue, and non-zero to abort. - external ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - CXClientData client_data, ffi.Pointer reserved)>> - abortQuery; - - /// Called at the end of indexing; passes the complete diagnostic set. - external ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - CXClientData, CXDiagnosticSet, ffi.Pointer)>> - diagnostic; - - external ffi.Pointer< - ffi.NativeFunction< - CXIdxClientFile Function(CXClientData client_data, CXFile mainFile, - ffi.Pointer reserved)>> enteredMainFile; - - /// Called when a file gets \#included/\#imported. - external ffi.Pointer< - ffi.NativeFunction< - CXIdxClientFile Function( - CXClientData, ffi.Pointer)>> - ppIncludedFile; - - /// Called when a AST file (PCH or module) gets imported. - /// - /// AST files will not get indexed (there will not be callbacks to index all - /// the entities in an AST file). The recommended action is that, if the AST - /// file is not already indexed, to initiate a new indexing job specific to - /// the AST file. - external ffi.Pointer< - ffi.NativeFunction< - CXIdxClientASTFile Function( - CXClientData, ffi.Pointer)>> - importedASTFile; - - /// Called at the beginning of indexing a translation unit. - external ffi.Pointer< - ffi.NativeFunction< - CXIdxClientContainer Function( - CXClientData client_data, ffi.Pointer reserved)>> - startedTranslationUnit; - - external ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(CXClientData, ffi.Pointer)>> - indexDeclaration; - - /// Called to index a reference of an entity. - external ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(CXClientData, ffi.Pointer)>> - indexEntityReference; -} - typedef NativeClang_indexSourceFile = ffi.Int Function( CXIndexAction arg0, CXClientData client_data, diff --git a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart index 2d1445a21..1949f0b09 100644 --- a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart +++ b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart @@ -10,40995 +10,8 @@ // ignore_for_file: type=lint import 'dart:ffi' as ffi; import 'package:objective_c/objective_c.dart' as objc; -import 'package:ffi/ffi.dart' as pkg_ffi; -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ksby9f( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1k41wmu( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_sjfpmz( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1j7ar3u( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_rvgf02( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ukcdfq( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1tjlcwl( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hepzs( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_117qins( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_9w6y6n( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_tenbla( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hfhq9m( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1ej8563( - ffi.Pointer block, -); - -late final _class_NSProgress = objc.getClass("NSProgress"); -late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); -final _objc_msgSend_l8lotg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_currentProgress = objc.registerName("currentProgress"); -final _objc_msgSend_1unuoxw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_progressWithTotalUnitCount_ = - objc.registerName("progressWithTotalUnitCount:"); -final _objc_msgSend_n9eq1n = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int64)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_discreteProgressWithTotalUnitCount_ = - objc.registerName("discreteProgressWithTotalUnitCount:"); -late final _sel_progressWithTotalUnitCount_parent_pendingUnitCount_ = - objc.registerName("progressWithTotalUnitCount:parent:pendingUnitCount:"); -final _objc_msgSend_105mybv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int64, - ffi.Pointer, - ffi.Int64)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - int)>(); -typedef instancetype = ffi.Pointer; -typedef Dartinstancetype = objc.ObjCObjectBase; -late final _sel_initWithParent_userInfo_ = - objc.registerName("initWithParent:userInfo:"); -final _objc_msgSend_iq11qg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_becomeCurrentWithPendingUnitCount_ = - objc.registerName("becomeCurrentWithPendingUnitCount:"); -final _objc_msgSend_rrr3q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Int64)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -void _ObjCBlock_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, -) => - block.ref.target - .cast>() - .asFunction()(); -ffi.Pointer _ObjCBlock_ffiVoid_fnPtrCallable = ffi.Pointer - .fromFunction)>( - _ObjCBlock_ffiVoid_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_closureTrampoline( - ffi.Pointer block, -) => - (objc.getBlockClosure(block) as void Function())(); -ffi.Pointer _ObjCBlock_ffiVoid_closureCallable = ffi.Pointer - .fromFunction)>( - _ObjCBlock_ffiVoid_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_listenerTrampoline( - ffi.Pointer block, -) { - (objc.getBlockClosure(block) as void Function())(); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable)> - _ObjCBlock_ffiVoid_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer> ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction(void Function() fn) => - objc.ObjCBlock( - objc.newClosureBlock(_ObjCBlock_ffiVoid_closureCallable, () => fn()), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener(void Function() fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_listenerCallable.nativeFunction.cast(), () => fn()); - final wrapper = _wrapListenerBlock_ksby9f(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_CallExtension - on objc.ObjCBlock { - void call() => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block)>>() - .asFunction)>()( - ref.pointer, - ); -} - -late final _sel_performAsCurrentWithPendingUnitCount_usingBlock_ = - objc.registerName("performAsCurrentWithPendingUnitCount:usingBlock:"); -final _objc_msgSend_19q84do = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int64, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_resignCurrent = objc.registerName("resignCurrent"); -final _objc_msgSend_ksby9f = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_addChild_withPendingUnitCount_ = - objc.registerName("addChild:withPendingUnitCount:"); -final _objc_msgSend_2citz1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Int64)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_totalUnitCount = objc.registerName("totalUnitCount"); -final _objc_msgSend_1voti03 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Int64 Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setTotalUnitCount_ = objc.registerName("setTotalUnitCount:"); -late final _sel_completedUnitCount = objc.registerName("completedUnitCount"); -late final _sel_setCompletedUnitCount_ = - objc.registerName("setCompletedUnitCount:"); -late final _sel_localizedDescription = - objc.registerName("localizedDescription"); -late final _sel_setLocalizedDescription_ = - objc.registerName("setLocalizedDescription:"); -final _objc_msgSend_ukcdfq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_localizedAdditionalDescription = - objc.registerName("localizedAdditionalDescription"); -late final _sel_setLocalizedAdditionalDescription_ = - objc.registerName("setLocalizedAdditionalDescription:"); -late final _sel_isCancellable = objc.registerName("isCancellable"); -final _objc_msgSend_olxnu1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setCancellable_ = objc.registerName("setCancellable:"); -final _objc_msgSend_117qins = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Bool)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, bool)>(); -late final _sel_isPausable = objc.registerName("isPausable"); -late final _sel_setPausable_ = objc.registerName("setPausable:"); -late final _sel_isCancelled = objc.registerName("isCancelled"); -late final _sel_isPaused = objc.registerName("isPaused"); -late final _sel_cancellationHandler = objc.registerName("cancellationHandler"); -final _objc_msgSend_2osec1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setCancellationHandler_ = - objc.registerName("setCancellationHandler:"); -void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock, ffi.Pointer, ffi.Pointer)> - fromFunction(void Function(objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) fn) => - objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2) => fn( - objc.ObjCObjectBase(arg0, retain: true, release: true), - objc.ObjCObjectBase(arg1, retain: true, release: true), - arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> listener( - void Function( - objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn(objc.ObjCObjectBase(arg0, retain: false, release: true), - objc.ObjCObjectBase(arg1, retain: false, release: true), arg2)); - final wrapper = _wrapListenerBlock_1k41wmu(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> { - void call(objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2); -} - -final _objc_msgSend_4daxhl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_pausingHandler = objc.registerName("pausingHandler"); -late final _sel_setPausingHandler_ = objc.registerName("setPausingHandler:"); -late final _sel_resumingHandler = objc.registerName("resumingHandler"); -late final _sel_setResumingHandler_ = objc.registerName("setResumingHandler:"); -late final _sel_setUserInfoObject_forKey_ = - objc.registerName("setUserInfoObject:forKey:"); -final _objc_msgSend_1tjlcwl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isIndeterminate = objc.registerName("isIndeterminate"); -late final _sel_fractionCompleted = objc.registerName("fractionCompleted"); -final _objc_msgSend_10noklm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_10noklmFpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isFinished = objc.registerName("isFinished"); -late final _sel_cancel = objc.registerName("cancel"); -late final _sel_pause = objc.registerName("pause"); -late final _sel_resume = objc.registerName("resume"); -late final _sel_userInfo = objc.registerName("userInfo"); -late final _sel_kind = objc.registerName("kind"); -late final _sel_setKind_ = objc.registerName("setKind:"); -late final _sel_estimatedTimeRemaining = - objc.registerName("estimatedTimeRemaining"); -late final _sel_setEstimatedTimeRemaining_ = - objc.registerName("setEstimatedTimeRemaining:"); -late final _sel_throughput = objc.registerName("throughput"); -late final _sel_setThroughput_ = objc.registerName("setThroughput:"); -late final _sel_fileOperationKind = objc.registerName("fileOperationKind"); -late final _sel_setFileOperationKind_ = - objc.registerName("setFileOperationKind:"); -late final _sel_fileURL = objc.registerName("fileURL"); -late final _sel_setFileURL_ = objc.registerName("setFileURL:"); -late final _sel_fileTotalCount = objc.registerName("fileTotalCount"); -late final _sel_setFileTotalCount_ = objc.registerName("setFileTotalCount:"); -late final _sel_fileCompletedCount = objc.registerName("fileCompletedCount"); -late final _sel_setFileCompletedCount_ = - objc.registerName("setFileCompletedCount:"); -late final _sel_publish = objc.registerName("publish"); -late final _sel_unpublish = objc.registerName("unpublish"); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSProgress_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSProgress_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock? Function(NSProgress)>`. -abstract final class ObjCBlock_ffiVoid_NSProgress { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock? Function(NSProgress)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.ObjCBlock? Function( - NSProgress)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock? Function(NSProgress)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock? Function(NSProgress)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSProgress_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.ObjCBlock? Function(NSProgress)> fromFunction( - objc.ObjCBlock? Function(NSProgress) fn) => - objc.ObjCBlock? Function(NSProgress)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSProgress_closureCallable, - (ffi.Pointer arg0) => - fn(NSProgress.castFromPointer(arg0, retain: true, release: true)) - ?.ref - .retainAndAutorelease() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock? Function(NSProgress)>`. -extension ObjCBlock_ffiVoid_NSProgress_CallExtension on objc - .ObjCBlock? Function(NSProgress)> { - objc.ObjCBlock? call(NSProgress arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer)>() - (ref.pointer, arg0.ref.pointer) - .address == - 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer( - ref.pointer.ref.invoke - .cast Function(ffi.Pointer block, ffi.Pointer arg0)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0.ref.pointer), - retain: true, - release: true); -} - -late final _sel_addSubscriberForFileURL_withPublishingHandler_ = - objc.registerName("addSubscriberForFileURL:withPublishingHandler:"); -final _objc_msgSend_1kkhn3j = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_removeSubscriber_ = objc.registerName("removeSubscriber:"); -late final _sel_isOld = objc.registerName("isOld"); -late final _sel_init = objc.registerName("init"); -late final _sel_new = objc.registerName("new"); - -final class _NSZone extends ffi.Opaque {} - -late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); -final _objc_msgSend_1b3ihd0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<_NSZone>)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<_NSZone>)>(); -late final _sel_alloc = objc.registerName("alloc"); -late final _sel_cancelPreviousPerformRequestsWithTarget_selector_object_ = objc - .registerName("cancelPreviousPerformRequestsWithTarget:selector:object:"); -final _objc_msgSend_cqxsqq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_cancelPreviousPerformRequestsWithTarget_ = - objc.registerName("cancelPreviousPerformRequestsWithTarget:"); -late final _sel_accessInstanceVariablesDirectly = - objc.registerName("accessInstanceVariablesDirectly"); -late final _sel_useStoredAccessor = objc.registerName("useStoredAccessor"); -late final _sel_keyPathsForValuesAffectingValueForKey_ = - objc.registerName("keyPathsForValuesAffectingValueForKey:"); -final _objc_msgSend_juohf7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_automaticallyNotifiesObserversForKey_ = - objc.registerName("automaticallyNotifiesObserversForKey:"); -late final _sel_setKeys_triggerChangeNotificationsForDependentKey_ = - objc.registerName("setKeys:triggerChangeNotificationsForDependentKey:"); -late final _sel_classFallbacksForKeyedArchiver = - objc.registerName("classFallbacksForKeyedArchiver"); -late final _sel_classForKeyedUnarchiver = - objc.registerName("classForKeyedUnarchiver"); - -/// NSProgress -class NSProgress extends objc.NSObject { - NSProgress._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSProgress] that points to the same underlying object as [other]. - NSProgress.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSProgress] that wraps the given raw object pointer. - NSProgress.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSProgress]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSProgress); - } - - /// currentProgress - static NSProgress? currentProgress() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProgress, _sel_currentProgress); - return _ret.address == 0 - ? null - : NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// progressWithTotalUnitCount: - static NSProgress progressWithTotalUnitCount_(int unitCount) { - final _ret = _objc_msgSend_n9eq1n( - _class_NSProgress, _sel_progressWithTotalUnitCount_, unitCount); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// discreteProgressWithTotalUnitCount: - static NSProgress discreteProgressWithTotalUnitCount_(int unitCount) { - final _ret = _objc_msgSend_n9eq1n( - _class_NSProgress, _sel_discreteProgressWithTotalUnitCount_, unitCount); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// progressWithTotalUnitCount:parent:pendingUnitCount: - static NSProgress progressWithTotalUnitCount_parent_pendingUnitCount_( - int unitCount, NSProgress parent, int portionOfParentTotalUnitCount) { - final _ret = _objc_msgSend_105mybv( - _class_NSProgress, - _sel_progressWithTotalUnitCount_parent_pendingUnitCount_, - unitCount, - parent.ref.pointer, - portionOfParentTotalUnitCount); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithParent:userInfo: - NSProgress initWithParent_userInfo_( - NSProgress? parentProgressOrNil, objc.ObjCObjectBase? userInfoOrNil) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithParent_userInfo_, - parentProgressOrNil?.ref.pointer ?? ffi.nullptr, - userInfoOrNil?.ref.pointer ?? ffi.nullptr); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// becomeCurrentWithPendingUnitCount: - void becomeCurrentWithPendingUnitCount_(int unitCount) { - _objc_msgSend_rrr3q( - this.ref.pointer, _sel_becomeCurrentWithPendingUnitCount_, unitCount); - } - - /// performAsCurrentWithPendingUnitCount:usingBlock: - void performAsCurrentWithPendingUnitCount_usingBlock_( - int unitCount, objc.ObjCBlock work) { - _objc_msgSend_19q84do( - this.ref.pointer, - _sel_performAsCurrentWithPendingUnitCount_usingBlock_, - unitCount, - work.ref.pointer); - } - - /// resignCurrent - void resignCurrent() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resignCurrent); - } - - /// addChild:withPendingUnitCount: - void addChild_withPendingUnitCount_(NSProgress child, int inUnitCount) { - _objc_msgSend_2citz1(this.ref.pointer, _sel_addChild_withPendingUnitCount_, - child.ref.pointer, inUnitCount); - } - - /// totalUnitCount - int get totalUnitCount { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_totalUnitCount); - } - - /// setTotalUnitCount: - set totalUnitCount(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setTotalUnitCount_, value); - } - - /// completedUnitCount - int get completedUnitCount { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_completedUnitCount); - } - - /// setCompletedUnitCount: - set completedUnitCount(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setCompletedUnitCount_, value); - } - - /// localizedDescription - objc.NSString get localizedDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedDescription); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocalizedDescription: - set localizedDescription(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocalizedDescription_, value.ref.pointer); - } - - /// localizedAdditionalDescription - objc.NSString get localizedAdditionalDescription { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_localizedAdditionalDescription); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocalizedAdditionalDescription: - set localizedAdditionalDescription(objc.NSString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setLocalizedAdditionalDescription_, value.ref.pointer); - } - - /// isCancellable - bool get cancellable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isCancellable); - } - - /// setCancellable: - set cancellable(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setCancellable_, value); - } - - /// isPausable - bool get pausable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isPausable); - } - - /// setPausable: - set pausable(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setPausable_, value); - } - - /// isCancelled - bool get cancelled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isCancelled); - } - - /// isPaused - bool get paused { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isPaused); - } - - /// cancellationHandler - objc.ObjCBlock? get cancellationHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_cancellationHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setCancellationHandler: - set cancellationHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setCancellationHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// pausingHandler - objc.ObjCBlock? get pausingHandler { - final _ret = _objc_msgSend_2osec1(this.ref.pointer, _sel_pausingHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setPausingHandler: - set pausingHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setPausingHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// resumingHandler - objc.ObjCBlock? get resumingHandler { - final _ret = _objc_msgSend_2osec1(this.ref.pointer, _sel_resumingHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setResumingHandler: - set resumingHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setResumingHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setUserInfoObject:forKey: - void setUserInfoObject_forKey_( - objc.ObjCObjectBase? objectOrNil, objc.NSString key) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_setUserInfoObject_forKey_, - objectOrNil?.ref.pointer ?? ffi.nullptr, key.ref.pointer); - } - - /// isIndeterminate - bool get indeterminate { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isIndeterminate); - } - - /// fractionCompleted - double get fractionCompleted { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_fractionCompleted) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_fractionCompleted); - } - - /// isFinished - bool get finished { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isFinished); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// pause - void pause() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_pause); - } - - /// resume - void resume() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resume); - } - - /// userInfo - objc.ObjCObjectBase get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// kind - objc.NSString? get kind { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_kind); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setKind: - set kind(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setKind_, value?.ref.pointer ?? ffi.nullptr); - } - - /// estimatedTimeRemaining - objc.NSNumber? get estimatedTimeRemaining { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_estimatedTimeRemaining); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setEstimatedTimeRemaining: - set estimatedTimeRemaining(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setEstimatedTimeRemaining_, value?.ref.pointer ?? ffi.nullptr); - } - - /// throughput - objc.NSNumber? get throughput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_throughput); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setThroughput: - set throughput(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setThroughput_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// fileOperationKind - objc.NSString? get fileOperationKind { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileOperationKind); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileOperationKind: - set fileOperationKind(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setFileOperationKind_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// fileURL - objc.NSURL? get fileURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileURL: - set fileURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFileURL_, value?.ref.pointer ?? ffi.nullptr); - } - - /// fileTotalCount - objc.NSNumber? get fileTotalCount { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileTotalCount); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileTotalCount: - set fileTotalCount(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setFileTotalCount_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// fileCompletedCount - objc.NSNumber? get fileCompletedCount { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileCompletedCount); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileCompletedCount: - set fileCompletedCount(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setFileCompletedCount_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// publish - void publish() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_publish); - } - - /// unpublish - void unpublish() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_unpublish); - } - - /// addSubscriberForFileURL:withPublishingHandler: - static objc.ObjCObjectBase addSubscriberForFileURL_withPublishingHandler_( - objc.NSURL url, - objc.ObjCBlock? Function(NSProgress)> - publishingHandler) { - final _ret = _objc_msgSend_1kkhn3j( - _class_NSProgress, - _sel_addSubscriberForFileURL_withPublishingHandler_, - url.ref.pointer, - publishingHandler.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// removeSubscriber: - static void removeSubscriber_(objc.ObjCObjectBase subscriber) { - _objc_msgSend_ukcdfq( - _class_NSProgress, _sel_removeSubscriber_, subscriber.ref.pointer); - } - - /// isOld - bool get old { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isOld); - } - - /// init - NSProgress init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSProgress new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProgress, _sel_new); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSProgress allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSProgress, _sel_allocWithZone_, zone); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSProgress alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProgress, _sel_alloc); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSProgress, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSProgress, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSProgress, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSProgress, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSProgress, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSProgress, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSProgress, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSProgress, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSProgress, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSBundle = objc.getClass("NSBundle"); -late final _sel_mainBundle = objc.registerName("mainBundle"); -late final _sel_bundleWithPath_ = objc.registerName("bundleWithPath:"); -late final _sel_initWithPath_ = objc.registerName("initWithPath:"); -late final _sel_bundleWithURL_ = objc.registerName("bundleWithURL:"); -late final _sel_initWithURL_ = objc.registerName("initWithURL:"); -late final _sel_bundleForClass_ = objc.registerName("bundleForClass:"); -late final _sel_bundleWithIdentifier_ = - objc.registerName("bundleWithIdentifier:"); -late final _sel_allBundles = objc.registerName("allBundles"); -late final _sel_allFrameworks = objc.registerName("allFrameworks"); -late final _sel_load = objc.registerName("load"); -late final _sel_isLoaded = objc.registerName("isLoaded"); -late final _sel_unload = objc.registerName("unload"); -late final _sel_preflightAndReturnError_ = - objc.registerName("preflightAndReturnError:"); -final _objc_msgSend_1rk90ll = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_loadAndReturnError_ = objc.registerName("loadAndReturnError:"); -late final _sel_bundleURL = objc.registerName("bundleURL"); -late final _sel_resourceURL = objc.registerName("resourceURL"); -late final _sel_executableURL = objc.registerName("executableURL"); -late final _sel_URLForAuxiliaryExecutable_ = - objc.registerName("URLForAuxiliaryExecutable:"); -late final _sel_privateFrameworksURL = - objc.registerName("privateFrameworksURL"); -late final _sel_sharedFrameworksURL = objc.registerName("sharedFrameworksURL"); -late final _sel_sharedSupportURL = objc.registerName("sharedSupportURL"); -late final _sel_builtInPlugInsURL = objc.registerName("builtInPlugInsURL"); -late final _sel_appStoreReceiptURL = objc.registerName("appStoreReceiptURL"); -late final _sel_bundlePath = objc.registerName("bundlePath"); -late final _sel_resourcePath = objc.registerName("resourcePath"); -late final _sel_executablePath = objc.registerName("executablePath"); -late final _sel_pathForAuxiliaryExecutable_ = - objc.registerName("pathForAuxiliaryExecutable:"); -late final _sel_privateFrameworksPath = - objc.registerName("privateFrameworksPath"); -late final _sel_sharedFrameworksPath = - objc.registerName("sharedFrameworksPath"); -late final _sel_sharedSupportPath = objc.registerName("sharedSupportPath"); -late final _sel_builtInPlugInsPath = objc.registerName("builtInPlugInsPath"); -late final _sel_URLForResource_withExtension_subdirectory_inBundleWithURL_ = - objc.registerName( - "URLForResource:withExtension:subdirectory:inBundleWithURL:"); -final _objc_msgSend_1qje3rk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_URLsForResourcesWithExtension_subdirectory_inBundleWithURL_ = - objc.registerName( - "URLsForResourcesWithExtension:subdirectory:inBundleWithURL:"); -final _objc_msgSend_aud7dn = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_URLForResource_withExtension_ = - objc.registerName("URLForResource:withExtension:"); -late final _sel_URLForResource_withExtension_subdirectory_ = - objc.registerName("URLForResource:withExtension:subdirectory:"); -late final _sel_URLForResource_withExtension_subdirectory_localization_ = objc - .registerName("URLForResource:withExtension:subdirectory:localization:"); -late final _sel_URLsForResourcesWithExtension_subdirectory_ = - objc.registerName("URLsForResourcesWithExtension:subdirectory:"); -late final _sel_URLsForResourcesWithExtension_subdirectory_localization_ = objc - .registerName("URLsForResourcesWithExtension:subdirectory:localization:"); -late final _sel_pathForResource_ofType_inDirectory_ = - objc.registerName("pathForResource:ofType:inDirectory:"); -late final _sel_pathsForResourcesOfType_inDirectory_ = - objc.registerName("pathsForResourcesOfType:inDirectory:"); -late final _sel_pathForResource_ofType_ = - objc.registerName("pathForResource:ofType:"); -late final _sel_pathForResource_ofType_inDirectory_forLocalization_ = - objc.registerName("pathForResource:ofType:inDirectory:forLocalization:"); -late final _sel_pathsForResourcesOfType_inDirectory_forLocalization_ = - objc.registerName("pathsForResourcesOfType:inDirectory:forLocalization:"); -late final _sel_localizedStringForKey_value_table_ = - objc.registerName("localizedStringForKey:value:table:"); -late final _class_NSAttributedString = objc.getClass("NSAttributedString"); -late final _sel_copyWithZone_ = objc.registerName("copyWithZone:"); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, ffi.Pointer<_NSZone>))(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_NSZone { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1)>> ptr) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer<_NSZone>) fn) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureCallable, - (ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1) => - fn(arg0, arg1).ref.retainAndReturnPointer()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_NSZone_CallExtension - on objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>()(ref.pointer, arg0, arg1), - retain: false, - release: true); -} - -late final _sel_mutableCopyWithZone_ = - objc.registerName("mutableCopyWithZone:"); -late final _sel_encodeWithCoder_ = objc.registerName("encodeWithCoder:"); -void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock, objc.NSCoder)>`. -abstract final class ObjCBlock_ffiVoid_ffiVoid_NSCoder { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock, objc.NSCoder)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - objc.NSCoder)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.NSCoder)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, objc.NSCoder)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.NSCoder)> - fromFunction(void Function(ffi.Pointer, objc.NSCoder) fn) => - objc.ObjCBlock, objc.NSCoder)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn( - arg0, - objc.NSCoder.castFromPointer(arg1, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock, objc.NSCoder)> - listener(void Function(ffi.Pointer, objc.NSCoder) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0, - objc.NSCoder.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_sjfpmz(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, objc.NSCoder)>(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock, objc.NSCoder)>`. -extension ObjCBlock_ffiVoid_ffiVoid_NSCoder_CallExtension - on objc.ObjCBlock, objc.NSCoder)> { - void call(ffi.Pointer arg0, objc.NSCoder arg1) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer); -} - -late final _sel_initWithCoder_ = objc.registerName("initWithCoder:"); -instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable = - ffi.Pointer.fromFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline) - .cast(); -instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as instancetype Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable = - ffi.Pointer.fromFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>`. -abstract final class ObjCBlock_instancetype_ffiVoid_NSCoder { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, - objc.NSCoder)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => - objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)>( - objc.newPointerBlock( - _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)> fromFunction( - Dartinstancetype? Function(ffi.Pointer, objc.NSCoder) fn) => - objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>( - objc.newClosureBlock( - _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, objc.NSCoder.castFromPointer(arg1, retain: true, release: true)) - ?.ref - .retainAndReturnPointer() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>`. -extension ObjCBlock_instancetype_ffiVoid_NSCoder_CallExtension - on objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)> { - Dartinstancetype? call(ffi.Pointer arg0, objc.NSCoder arg1) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction, ffi.Pointer, ffi.Pointer)>() - (ref.pointer, arg0, arg1.ref.pointer) - .address == - 0 - ? null - : objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast block, ffi.Pointer arg0, ffi.Pointer arg1)>>() - .asFunction, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0, arg1.ref.pointer), - retain: false, - release: true); -} - -late final _sel_supportsSecureCoding = - objc.registerName("supportsSecureCoding"); -bool _ObjCBlock_bool_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_bool_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as bool Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_bool_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_bool_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - bool Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock(_ObjCBlock_bool_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_bool_ffiVoid_CallExtension - on objc.ObjCBlock)> { - bool call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_string = objc.registerName("string"); -late final _sel_attributesAtIndex_effectiveRange_ = - objc.registerName("attributesAtIndex:effectiveRange:"); -final _objc_msgSend_1lz7qql = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, ffi.Pointer)>(); -late final _sel_length = objc.registerName("length"); -final _objc_msgSend_eldhrq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_attribute_atIndex_effectiveRange_ = - objc.registerName("attribute:atIndex:effectiveRange:"); -final _objc_msgSend_6erk1e = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_attributedSubstringFromRange_ = - objc.registerName("attributedSubstringFromRange:"); -final _objc_msgSend_176f8tz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>(); -late final _sel_attributesAtIndex_longestEffectiveRange_inRange_ = - objc.registerName("attributesAtIndex:longestEffectiveRange:inRange:"); -final _objc_msgSend_7mxs62 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_attribute_atIndex_longestEffectiveRange_inRange_ = - objc.registerName("attribute:atIndex:longestEffectiveRange:inRange:"); -final _objc_msgSend_1hy2clh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_isEqualToAttributedString_ = - objc.registerName("isEqualToAttributedString:"); -late final _sel_initWithString_ = objc.registerName("initWithString:"); -late final _sel_initWithString_attributes_ = - objc.registerName("initWithString:attributes:"); -late final _sel_initWithAttributedString_ = - objc.registerName("initWithAttributedString:"); - -enum NSAttributedStringEnumerationOptions { - NSAttributedStringEnumerationReverse(2), - NSAttributedStringEnumerationLongestEffectiveRangeNotRequired(1048576); - - final int value; - const NSAttributedStringEnumerationOptions(this.value); - - static NSAttributedStringEnumerationOptions fromValue(int value) => - switch (value) { - 2 => NSAttributedStringEnumerationReverse, - 1048576 => - NSAttributedStringEnumerationLongestEffectiveRangeNotRequired, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringEnumerationOptions: $value"), - }; -} - -void _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - objc.NSRange arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, objc.NSRange, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_NSDictionary_NSRange_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock)> - fromFunctionPointer(ffi.Pointer arg0, objc.NSRange arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDictionary, objc.NSRange, ffi.Pointer)> - fromFunction(void Function(objc.NSDictionary, objc.NSRange, ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureCallable, - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn(objc.NSDictionary.castFromPointer(arg0, retain: true, release: true), arg1, arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> listener( - void Function(objc.NSDictionary, objc.NSRange, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn( - objc.NSDictionary.castFromPointer(arg0, - retain: false, release: true), - arg1, - arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSDictionary, objc.NSRange, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> { - void call(objc.NSDictionary arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1, arg2); -} - -late final _sel_enumerateAttributesInRange_options_usingBlock_ = - objc.registerName("enumerateAttributesInRange:options:usingBlock:"); -final _objc_msgSend_1g4s41q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - int, - ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - objc.NSRange arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, objc.NSRange, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange, ffi.Pointer)> - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock?, objc.NSRange, ffi.Pointer)>`. -abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock?, objc.NSRange, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer arg0, objc.NSRange arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, ffi.Pointer)> - fromFunction(void Function(objc.ObjCObjectBase?, objc.NSRange, ffi.Pointer) fn) => - objc.ObjCBlock?, objc.NSRange, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureCallable, - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn(arg0.address == 0 ? null : objc.ObjCObjectBase(arg0, retain: true, release: true), arg1, arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> listener( - void Function(objc.ObjCObjectBase?, objc.NSRange, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.ObjCObjectBase(arg0, retain: false, release: true), - arg1, - arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock?, objc.NSRange, ffi.Pointer)>`. -extension ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> { - void call(objc.ObjCObjectBase? arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1, arg2); -} - -late final _sel_enumerateAttribute_inRange_options_usingBlock_ = - objc.registerName("enumerateAttribute:inRange:options:usingBlock:"); -final _objc_msgSend_o0ok8d = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - int, - ffi.Pointer)>(); -late final _class_NSAttributedStringMarkdownParsingOptions = - objc.getClass("NSAttributedStringMarkdownParsingOptions"); -late final _sel_allowsExtendedAttributes = - objc.registerName("allowsExtendedAttributes"); -late final _sel_setAllowsExtendedAttributes_ = - objc.registerName("setAllowsExtendedAttributes:"); - -enum NSAttributedStringMarkdownInterpretedSyntax { - NSAttributedStringMarkdownInterpretedSyntaxFull(0), - NSAttributedStringMarkdownInterpretedSyntaxInlineOnly(1), - NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace(2); - - final int value; - const NSAttributedStringMarkdownInterpretedSyntax(this.value); - - static NSAttributedStringMarkdownInterpretedSyntax fromValue(int value) => - switch (value) { - 0 => NSAttributedStringMarkdownInterpretedSyntaxFull, - 1 => NSAttributedStringMarkdownInterpretedSyntaxInlineOnly, - 2 => - NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringMarkdownInterpretedSyntax: $value"), - }; -} - -late final _sel_interpretedSyntax = objc.registerName("interpretedSyntax"); -final _objc_msgSend_1pa46zt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setInterpretedSyntax_ = - objc.registerName("setInterpretedSyntax:"); -final _objc_msgSend_1fjzvvc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSAttributedStringMarkdownParsingFailurePolicy { - NSAttributedStringMarkdownParsingFailureReturnError(0), - NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible(1); - - final int value; - const NSAttributedStringMarkdownParsingFailurePolicy(this.value); - - static NSAttributedStringMarkdownParsingFailurePolicy fromValue(int value) => - switch (value) { - 0 => NSAttributedStringMarkdownParsingFailureReturnError, - 1 => - NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringMarkdownParsingFailurePolicy: $value"), - }; -} - -late final _sel_failurePolicy = objc.registerName("failurePolicy"); -final _objc_msgSend_gdi6fo = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setFailurePolicy_ = objc.registerName("setFailurePolicy:"); -final _objc_msgSend_9ynxkb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_languageCode = objc.registerName("languageCode"); -late final _sel_setLanguageCode_ = objc.registerName("setLanguageCode:"); -late final _sel_appliesSourcePositionAttributes = - objc.registerName("appliesSourcePositionAttributes"); -late final _sel_setAppliesSourcePositionAttributes_ = - objc.registerName("setAppliesSourcePositionAttributes:"); -late final _sel_self = objc.registerName("self"); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock Function(ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock Function(ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer) fn) => - objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension on objc - .ObjCBlock Function(ffi.Pointer)> { - objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -late final _sel_retain = objc.registerName("retain"); -late final _sel_autorelease = objc.registerName("autorelease"); - -/// NSAttributedStringMarkdownParsingOptions -class NSAttributedStringMarkdownParsingOptions extends objc.NSObject { - NSAttributedStringMarkdownParsingOptions._( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSAttributedStringMarkdownParsingOptions] that points to the same underlying object as [other]. - NSAttributedStringMarkdownParsingOptions.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSAttributedStringMarkdownParsingOptions] that wraps the given raw object pointer. - NSAttributedStringMarkdownParsingOptions.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSAttributedStringMarkdownParsingOptions]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_NSAttributedStringMarkdownParsingOptions); - } - - /// init - NSAttributedStringMarkdownParsingOptions init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// allowsExtendedAttributes - bool get allowsExtendedAttributes { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExtendedAttributes); - } - - /// setAllowsExtendedAttributes: - set allowsExtendedAttributes(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsExtendedAttributes_, value); - } - - /// interpretedSyntax - NSAttributedStringMarkdownInterpretedSyntax get interpretedSyntax { - final _ret = - _objc_msgSend_1pa46zt(this.ref.pointer, _sel_interpretedSyntax); - return NSAttributedStringMarkdownInterpretedSyntax.fromValue(_ret); - } - - /// setInterpretedSyntax: - set interpretedSyntax(NSAttributedStringMarkdownInterpretedSyntax value) { - return _objc_msgSend_1fjzvvc( - this.ref.pointer, _sel_setInterpretedSyntax_, value.value); - } - - /// failurePolicy - NSAttributedStringMarkdownParsingFailurePolicy get failurePolicy { - final _ret = _objc_msgSend_gdi6fo(this.ref.pointer, _sel_failurePolicy); - return NSAttributedStringMarkdownParsingFailurePolicy.fromValue(_ret); - } - - /// setFailurePolicy: - set failurePolicy(NSAttributedStringMarkdownParsingFailurePolicy value) { - return _objc_msgSend_9ynxkb( - this.ref.pointer, _sel_setFailurePolicy_, value.value); - } - - /// languageCode - objc.NSString? get languageCode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_languageCode); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLanguageCode: - set languageCode(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setLanguageCode_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// appliesSourcePositionAttributes - bool get appliesSourcePositionAttributes { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_appliesSourcePositionAttributes); - } - - /// setAppliesSourcePositionAttributes: - set appliesSourcePositionAttributes(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAppliesSourcePositionAttributes_, value); - } - - /// new - static NSAttributedStringMarkdownParsingOptions new1() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, _sel_new); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSAttributedStringMarkdownParsingOptions allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_allocWithZone_, - zone); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSAttributedStringMarkdownParsingOptions alloc() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, _sel_alloc); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSAttributedStringMarkdownParsingOptions, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_NSAttributedStringMarkdownParsingOptions, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSAttributedStringMarkdownParsingOptions, - _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_keyPathsForValuesAffectingValueForKey_, - key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSAttributedStringMarkdownParsingOptions, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSAttributedStringMarkdownParsingOptions self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSAttributedStringMarkdownParsingOptions retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSAttributedStringMarkdownParsingOptions autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_initWithContentsOfMarkdownFileAtURL_options_baseURL_error_ = - objc.registerName( - "initWithContentsOfMarkdownFileAtURL:options:baseURL:error:"); -final _objc_msgSend_w9wiqt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_initWithMarkdown_options_baseURL_error_ = - objc.registerName("initWithMarkdown:options:baseURL:error:"); -late final _sel_initWithMarkdownString_options_baseURL_error_ = - objc.registerName("initWithMarkdownString:options:baseURL:error:"); - -enum NSAttributedStringFormattingOptions { - NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging(1), - NSAttributedStringFormattingApplyReplacementIndexAttribute(2); - - final int value; - const NSAttributedStringFormattingOptions(this.value); - - static NSAttributedStringFormattingOptions fromValue(int value) => - switch (value) { - 1 => NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging, - 2 => NSAttributedStringFormattingApplyReplacementIndexAttribute, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringFormattingOptions: $value"), - }; -} - -late final _sel_initWithFormat_options_locale_ = - objc.registerName("initWithFormat:options:locale:"); -final _objc_msgSend_4x8h9q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_localizedAttributedStringWithFormat_ = - objc.registerName("localizedAttributedStringWithFormat:"); -late final _sel_localizedAttributedStringWithFormat_options_ = - objc.registerName("localizedAttributedStringWithFormat:options:"); -final _objc_msgSend_1vfncet = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_initWithFormat_options_locale_context_ = - objc.registerName("initWithFormat:options:locale:context:"); -final _objc_msgSend_xvcwe5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_localizedAttributedStringWithFormat_context_ = - objc.registerName("localizedAttributedStringWithFormat:context:"); -late final _sel_localizedAttributedStringWithFormat_options_context_ = - objc.registerName("localizedAttributedStringWithFormat:options:context:"); -late final _sel_attributedStringByInflectingString = - objc.registerName("attributedStringByInflectingString"); - -/// NSAttributedString -class NSAttributedString extends objc.NSObject { - NSAttributedString._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSAttributedString] that points to the same underlying object as [other]. - NSAttributedString.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSAttributedString] that wraps the given raw object pointer. - NSAttributedString.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSAttributedString]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSAttributedString); - } - - /// string - objc.NSString get string { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_string); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// attributesAtIndex:effectiveRange: - objc.NSDictionary attributesAtIndex_effectiveRange_( - int location, ffi.Pointer range) { - final _ret = _objc_msgSend_1lz7qql(this.ref.pointer, - _sel_attributesAtIndex_effectiveRange_, location, range); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// length - int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); - } - - /// attribute:atIndex:effectiveRange: - objc.ObjCObjectBase? attribute_atIndex_effectiveRange_( - objc.NSString attrName, int location, ffi.Pointer range) { - final _ret = _objc_msgSend_6erk1e( - this.ref.pointer, - _sel_attribute_atIndex_effectiveRange_, - attrName.ref.pointer, - location, - range); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributedSubstringFromRange: - NSAttributedString attributedSubstringFromRange_(objc.NSRange range) { - final _ret = _objc_msgSend_176f8tz( - this.ref.pointer, _sel_attributedSubstringFromRange_, range); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// attributesAtIndex:longestEffectiveRange:inRange: - objc.NSDictionary attributesAtIndex_longestEffectiveRange_inRange_( - int location, ffi.Pointer range, objc.NSRange rangeLimit) { - final _ret = _objc_msgSend_7mxs62( - this.ref.pointer, - _sel_attributesAtIndex_longestEffectiveRange_inRange_, - location, - range, - rangeLimit); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// attribute:atIndex:longestEffectiveRange:inRange: - objc.ObjCObjectBase? attribute_atIndex_longestEffectiveRange_inRange_( - objc.NSString attrName, - int location, - ffi.Pointer range, - objc.NSRange rangeLimit) { - final _ret = _objc_msgSend_1hy2clh( - this.ref.pointer, - _sel_attribute_atIndex_longestEffectiveRange_inRange_, - attrName.ref.pointer, - location, - range, - rangeLimit); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// isEqualToAttributedString: - bool isEqualToAttributedString_(NSAttributedString other) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToAttributedString_, other.ref.pointer); - } - - /// initWithString: - NSAttributedString initWithString_(objc.NSString str) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, str.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithString:attributes: - NSAttributedString initWithString_attributes_( - objc.NSString str, objc.NSDictionary? attrs) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithString_attributes_, - str.ref.pointer, - attrs?.ref.pointer ?? ffi.nullptr); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithAttributedString: - NSAttributedString initWithAttributedString_(NSAttributedString attrStr) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithAttributedString_, attrStr.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// enumerateAttributesInRange:options:usingBlock: - void enumerateAttributesInRange_options_usingBlock_( - objc.NSRange enumerationRange, - NSAttributedStringEnumerationOptions opts, - objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> - block) { - _objc_msgSend_1g4s41q( - this.ref.pointer, - _sel_enumerateAttributesInRange_options_usingBlock_, - enumerationRange, - opts.value, - block.ref.pointer); - } - - /// enumerateAttribute:inRange:options:usingBlock: - void enumerateAttribute_inRange_options_usingBlock_( - objc.NSString attrName, - objc.NSRange enumerationRange, - NSAttributedStringEnumerationOptions opts, - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> - block) { - _objc_msgSend_o0ok8d( - this.ref.pointer, - _sel_enumerateAttribute_inRange_options_usingBlock_, - attrName.ref.pointer, - enumerationRange, - opts.value, - block.ref.pointer); - } - - /// initWithContentsOfMarkdownFileAtURL:options:baseURL:error: - NSAttributedString? - initWithContentsOfMarkdownFileAtURL_options_baseURL_error_( - objc.NSURL markdownFile, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfMarkdownFileAtURL_options_baseURL_error_, - markdownFile.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdown:options:baseURL:error: - NSAttributedString? initWithMarkdown_options_baseURL_error_( - objc.NSData markdown, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdown_options_baseURL_error_, - markdown.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdownString:options:baseURL:error: - NSAttributedString? initWithMarkdownString_options_baseURL_error_( - objc.NSString markdownString, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdownString_options_baseURL_error_, - markdownString.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithFormat:options:locale: - NSAttributedString initWithFormat_options_locale_(NSAttributedString format, - NSAttributedStringFormattingOptions options, objc.NSLocale? locale) { - final _ret = _objc_msgSend_4x8h9q( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat: - static NSAttributedString localizedAttributedStringWithFormat_( - NSAttributedString format) { - final _ret = _objc_msgSend_juohf7(_class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_, format.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options: - static NSAttributedString localizedAttributedStringWithFormat_options_( - NSAttributedString format, NSAttributedStringFormattingOptions options) { - final _ret = _objc_msgSend_1vfncet( - _class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_options_, - format.ref.pointer, - options.value); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithFormat:options:locale:context: - NSAttributedString initWithFormat_options_locale_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSLocale? locale, - objc.NSDictionary context) { - final _ret = _objc_msgSend_xvcwe5( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_context_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr, - context.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat:context: - static NSAttributedString localizedAttributedStringWithFormat_context_( - NSAttributedString format, objc.NSDictionary context) { - final _ret = _objc_msgSend_iq11qg( - _class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_context_, - format.ref.pointer, - context.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options:context: - static NSAttributedString - localizedAttributedStringWithFormat_options_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSDictionary context) { - final _ret = _objc_msgSend_4x8h9q( - _class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_options_context_, - format.ref.pointer, - options.value, - context.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// attributedStringByInflectingString - NSAttributedString attributedStringByInflectingString() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_attributedStringByInflectingString); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSAttributedString init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSAttributedString new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSAttributedString, _sel_new); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSAttributedString allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSAttributedString, _sel_allocWithZone_, zone); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSAttributedString alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSAttributedString, _sel_alloc); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSAttributedString, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSAttributedString, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSAttributedString, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSAttributedString, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSAttributedString, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedString, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedString, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSAttributedString self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSAttributedString retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSAttributedString autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSAttributedString, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSAttributedString? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_localizedAttributedStringForKey_value_table_ = - objc.registerName("localizedAttributedStringForKey:value:table:"); -late final _sel_bundleIdentifier = objc.registerName("bundleIdentifier"); -late final _sel_infoDictionary = objc.registerName("infoDictionary"); -late final _sel_localizedInfoDictionary = - objc.registerName("localizedInfoDictionary"); -late final _sel_objectForInfoDictionaryKey_ = - objc.registerName("objectForInfoDictionaryKey:"); -late final _sel_classNamed_ = objc.registerName("classNamed:"); -late final _sel_principalClass = objc.registerName("principalClass"); -late final _sel_preferredLocalizations = - objc.registerName("preferredLocalizations"); -late final _sel_localizations = objc.registerName("localizations"); -late final _sel_developmentLocalization = - objc.registerName("developmentLocalization"); -late final _sel_preferredLocalizationsFromArray_ = - objc.registerName("preferredLocalizationsFromArray:"); -late final _sel_preferredLocalizationsFromArray_forPreferences_ = - objc.registerName("preferredLocalizationsFromArray:forPreferences:"); -late final _sel_executableArchitectures = - objc.registerName("executableArchitectures"); -late final _sel_setPreservationPriority_forTags_ = - objc.registerName("setPreservationPriority:forTags:"); -final _objc_msgSend_13ndgwe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer)>(); -late final _sel_preservationPriorityForTag_ = - objc.registerName("preservationPriorityForTag:"); -final _objc_msgSend_om71r5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Double Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_om71r5Fpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Double Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - -/// NSBundle -class NSBundle extends objc.NSObject { - NSBundle._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSBundle] that points to the same underlying object as [other]. - NSBundle.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSBundle] that wraps the given raw object pointer. - NSBundle.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSBundle]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSBundle); - } - - /// mainBundle - static NSBundle getMainBundle() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_mainBundle); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// bundleWithPath: - static NSBundle? bundleWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleWithPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithPath: - NSBundle? initWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// bundleWithURL: - static NSBundle? bundleWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleWithURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithURL: - NSBundle? initWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// bundleForClass: - static NSBundle bundleForClass_(objc.ObjCObjectBase aClass) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleForClass_, aClass.ref.pointer); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// bundleWithIdentifier: - static NSBundle? bundleWithIdentifier_(objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleWithIdentifier_, identifier.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// allBundles - static objc.NSArray getAllBundles() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_allBundles); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allFrameworks - static objc.NSArray getAllFrameworks() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_allFrameworks); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// load - bool load() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_load); - } - - /// isLoaded - bool get loaded { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLoaded); - } - - /// unload - bool unload() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_unload); - } - - /// preflightAndReturnError: - bool preflightAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_preflightAndReturnError_, error); - } - - /// loadAndReturnError: - bool loadAndReturnError_(ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_loadAndReturnError_, error); - } - - /// bundleURL - objc.NSURL get bundleURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bundleURL); - return objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// resourceURL - objc.NSURL? get resourceURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_resourceURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// executableURL - objc.NSURL? get executableURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executableURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForAuxiliaryExecutable: - objc.NSURL? URLForAuxiliaryExecutable_(objc.NSString executableName) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_URLForAuxiliaryExecutable_, executableName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// privateFrameworksURL - objc.NSURL? get privateFrameworksURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_privateFrameworksURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedFrameworksURL - objc.NSURL? get sharedFrameworksURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedFrameworksURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedSupportURL - objc.NSURL? get sharedSupportURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedSupportURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// builtInPlugInsURL - objc.NSURL? get builtInPlugInsURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_builtInPlugInsURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// appStoreReceiptURL - objc.NSURL? get appStoreReceiptURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_appStoreReceiptURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// bundlePath - objc.NSString get bundlePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bundlePath); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// resourcePath - objc.NSString? get resourcePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_resourcePath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// executablePath - objc.NSString? get executablePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executablePath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForAuxiliaryExecutable: - objc.NSString? pathForAuxiliaryExecutable_(objc.NSString executableName) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_pathForAuxiliaryExecutable_, executableName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// privateFrameworksPath - objc.NSString? get privateFrameworksPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_privateFrameworksPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedFrameworksPath - objc.NSString? get sharedFrameworksPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedFrameworksPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedSupportPath - objc.NSString? get sharedSupportPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedSupportPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// builtInPlugInsPath - objc.NSString? get builtInPlugInsPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_builtInPlugInsPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension:subdirectory:inBundleWithURL: - static objc.NSURL? URLForResource_withExtension_subdirectory_inBundleWithURL_( - objc.NSString? name, - objc.NSString? ext, - objc.NSString? subpath, - objc.NSURL bundleURL) { - final _ret = _objc_msgSend_1qje3rk( - _class_NSBundle, - _sel_URLForResource_withExtension_subdirectory_inBundleWithURL_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - bundleURL.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForResourcesWithExtension:subdirectory:inBundleWithURL: - static objc.NSArray? - URLsForResourcesWithExtension_subdirectory_inBundleWithURL_( - objc.NSString? ext, objc.NSString? subpath, objc.NSURL bundleURL) { - final _ret = _objc_msgSend_aud7dn( - _class_NSBundle, - _sel_URLsForResourcesWithExtension_subdirectory_inBundleWithURL_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - bundleURL.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension: - objc.NSURL? URLForResource_withExtension_( - objc.NSString? name, objc.NSString? ext) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_URLForResource_withExtension_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension:subdirectory: - objc.NSURL? URLForResource_withExtension_subdirectory_( - objc.NSString? name, objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_URLForResource_withExtension_subdirectory_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension:subdirectory:localization: - objc.NSURL? URLForResource_withExtension_subdirectory_localization_( - objc.NSString? name, - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_1qje3rk( - this.ref.pointer, - _sel_URLForResource_withExtension_subdirectory_localization_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForResourcesWithExtension:subdirectory: - objc.NSArray? URLsForResourcesWithExtension_subdirectory_( - objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_URLsForResourcesWithExtension_subdirectory_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForResourcesWithExtension:subdirectory:localization: - objc.NSArray? URLsForResourcesWithExtension_subdirectory_localization_( - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_URLsForResourcesWithExtension_subdirectory_localization_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForResource:ofType:inDirectory: - objc.NSString? pathForResource_ofType_inDirectory_( - objc.NSString? name, objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_pathForResource_ofType_inDirectory_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathsForResourcesOfType:inDirectory: - objc.NSArray pathsForResourcesOfType_inDirectory_( - objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_pathsForResourcesOfType_inDirectory_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForResource:ofType: - objc.NSString? pathForResource_ofType_( - objc.NSString? name, objc.NSString? ext) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_pathForResource_ofType_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForResource:ofType:inDirectory:forLocalization: - objc.NSString? pathForResource_ofType_inDirectory_forLocalization_( - objc.NSString? name, - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_1qje3rk( - this.ref.pointer, - _sel_pathForResource_ofType_inDirectory_forLocalization_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathsForResourcesOfType:inDirectory:forLocalization: - objc.NSArray pathsForResourcesOfType_inDirectory_forLocalization_( - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_pathsForResourcesOfType_inDirectory_forLocalization_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedStringForKey:value:table: - objc.NSString localizedStringForKey_value_table_( - objc.NSString key, objc.NSString? value, objc.NSString? tableName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_localizedStringForKey_value_table_, - key.ref.pointer, - value?.ref.pointer ?? ffi.nullptr, - tableName?.ref.pointer ?? ffi.nullptr); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedAttributedStringForKey:value:table: - NSAttributedString localizedAttributedStringForKey_value_table_( - objc.NSString key, objc.NSString? value, objc.NSString? tableName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_localizedAttributedStringForKey_value_table_, - key.ref.pointer, - value?.ref.pointer ?? ffi.nullptr, - tableName?.ref.pointer ?? ffi.nullptr); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// bundleIdentifier - objc.NSString? get bundleIdentifier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bundleIdentifier); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// infoDictionary - objc.NSDictionary? get infoDictionary { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_infoDictionary); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedInfoDictionary - objc.NSDictionary? get localizedInfoDictionary { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedInfoDictionary); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// objectForInfoDictionaryKey: - objc.ObjCObjectBase? objectForInfoDictionaryKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_objectForInfoDictionaryKey_, key.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// classNamed: - objc.ObjCObjectBase? classNamed_(objc.NSString className) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_classNamed_, className.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// principalClass - objc.ObjCObjectBase? get principalClass { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_principalClass); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// preferredLocalizations - objc.NSArray get preferredLocalizations { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredLocalizations); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localizations - objc.NSArray get localizations { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizations); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// developmentLocalization - objc.NSString? get developmentLocalization { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_developmentLocalization); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// preferredLocalizationsFromArray: - static objc.NSArray preferredLocalizationsFromArray_( - objc.NSArray localizationsArray) { - final _ret = _objc_msgSend_juohf7(_class_NSBundle, - _sel_preferredLocalizationsFromArray_, localizationsArray.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// preferredLocalizationsFromArray:forPreferences: - static objc.NSArray preferredLocalizationsFromArray_forPreferences_( - objc.NSArray localizationsArray, objc.NSArray? preferencesArray) { - final _ret = _objc_msgSend_iq11qg( - _class_NSBundle, - _sel_preferredLocalizationsFromArray_forPreferences_, - localizationsArray.ref.pointer, - preferencesArray?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// executableArchitectures - objc.NSArray? get executableArchitectures { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executableArchitectures); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setPreservationPriority:forTags: - void setPreservationPriority_forTags_(double priority, objc.NSSet tags) { - _objc_msgSend_13ndgwe(this.ref.pointer, - _sel_setPreservationPriority_forTags_, priority, tags.ref.pointer); - } - - /// preservationPriorityForTag: - double preservationPriorityForTag_(objc.NSString tag) { - return objc.useMsgSendVariants - ? _objc_msgSend_om71r5Fpret( - this.ref.pointer, _sel_preservationPriorityForTag_, tag.ref.pointer) - : _objc_msgSend_om71r5(this.ref.pointer, - _sel_preservationPriorityForTag_, tag.ref.pointer); - } - - /// init - NSBundle init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSBundle new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_new); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSBundle allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSBundle, _sel_allocWithZone_, zone); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSBundle alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_alloc); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSBundle, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSBundle, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSBundle, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSBundle, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSBundle, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSBundle, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSBundle, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSBundle, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSBundle, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSBundle self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSBundle retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSBundle autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSMutableAttributedString = - objc.getClass("NSMutableAttributedString"); -late final _sel_replaceCharactersInRange_withString_ = - objc.registerName("replaceCharactersInRange:withString:"); -final _objc_msgSend_85e5ih = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_setAttributes_range_ = - objc.registerName("setAttributes:range:"); -final _objc_msgSend_lusc9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_mutableString = objc.registerName("mutableString"); -late final _sel_addAttribute_value_range_ = - objc.registerName("addAttribute:value:range:"); -final _objc_msgSend_1fmqvtu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_addAttributes_range_ = - objc.registerName("addAttributes:range:"); -late final _sel_removeAttribute_range_ = - objc.registerName("removeAttribute:range:"); -late final _sel_replaceCharactersInRange_withAttributedString_ = - objc.registerName("replaceCharactersInRange:withAttributedString:"); -late final _sel_insertAttributedString_atIndex_ = - objc.registerName("insertAttributedString:atIndex:"); -final _objc_msgSend_cjm5ga = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_appendAttributedString_ = - objc.registerName("appendAttributedString:"); -late final _sel_deleteCharactersInRange_ = - objc.registerName("deleteCharactersInRange:"); -final _objc_msgSend_9xf7uy = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>(); -late final _sel_setAttributedString_ = - objc.registerName("setAttributedString:"); -late final _sel_beginEditing = objc.registerName("beginEditing"); -late final _sel_endEditing = objc.registerName("endEditing"); -late final _sel_appendLocalizedFormat_ = - objc.registerName("appendLocalizedFormat:"); - -/// NSMutableAttributedString -class NSMutableAttributedString extends NSAttributedString { - NSMutableAttributedString._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMutableAttributedString] that points to the same underlying object as [other]. - NSMutableAttributedString.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMutableAttributedString] that wraps the given raw object pointer. - NSMutableAttributedString.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMutableAttributedString]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableAttributedString); - } - - /// replaceCharactersInRange:withString: - void replaceCharactersInRange_withString_( - objc.NSRange range, objc.NSString str) { - _objc_msgSend_85e5ih(this.ref.pointer, - _sel_replaceCharactersInRange_withString_, range, str.ref.pointer); - } - - /// setAttributes:range: - void setAttributes_range_(objc.NSDictionary? attrs, objc.NSRange range) { - _objc_msgSend_lusc9(this.ref.pointer, _sel_setAttributes_range_, - attrs?.ref.pointer ?? ffi.nullptr, range); - } - - /// mutableString - objc.NSMutableString get mutableString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mutableString); - return objc.NSMutableString.castFromPointer(_ret, - retain: true, release: true); - } - - /// addAttribute:value:range: - void addAttribute_value_range_( - objc.NSString name, objc.ObjCObjectBase value, objc.NSRange range) { - _objc_msgSend_1fmqvtu(this.ref.pointer, _sel_addAttribute_value_range_, - name.ref.pointer, value.ref.pointer, range); - } - - /// addAttributes:range: - void addAttributes_range_(objc.NSDictionary attrs, objc.NSRange range) { - _objc_msgSend_lusc9( - this.ref.pointer, _sel_addAttributes_range_, attrs.ref.pointer, range); - } - - /// removeAttribute:range: - void removeAttribute_range_(objc.NSString name, objc.NSRange range) { - _objc_msgSend_lusc9( - this.ref.pointer, _sel_removeAttribute_range_, name.ref.pointer, range); - } - - /// replaceCharactersInRange:withAttributedString: - void replaceCharactersInRange_withAttributedString_( - objc.NSRange range, NSAttributedString attrString) { - _objc_msgSend_85e5ih( - this.ref.pointer, - _sel_replaceCharactersInRange_withAttributedString_, - range, - attrString.ref.pointer); - } - - /// insertAttributedString:atIndex: - void insertAttributedString_atIndex_(NSAttributedString attrString, int loc) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertAttributedString_atIndex_, - attrString.ref.pointer, loc); - } - - /// appendAttributedString: - void appendAttributedString_(NSAttributedString attrString) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_appendAttributedString_, attrString.ref.pointer); - } - - /// deleteCharactersInRange: - void deleteCharactersInRange_(objc.NSRange range) { - _objc_msgSend_9xf7uy( - this.ref.pointer, _sel_deleteCharactersInRange_, range); - } - - /// setAttributedString: - void setAttributedString_(NSAttributedString attrString) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAttributedString_, attrString.ref.pointer); - } - - /// beginEditing - void beginEditing() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_beginEditing); - } - - /// endEditing - void endEditing() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_endEditing); - } - - /// appendLocalizedFormat: - void appendLocalizedFormat_(NSAttributedString format) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_appendLocalizedFormat_, format.ref.pointer); - } - - /// initWithString: - NSMutableAttributedString initWithString_(objc.NSString str) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, str.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithString:attributes: - NSMutableAttributedString initWithString_attributes_( - objc.NSString str, objc.NSDictionary? attrs) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithString_attributes_, - str.ref.pointer, - attrs?.ref.pointer ?? ffi.nullptr); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithAttributedString: - NSMutableAttributedString initWithAttributedString_( - NSAttributedString attrStr) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithAttributedString_, attrStr.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithContentsOfMarkdownFileAtURL:options:baseURL:error: - NSMutableAttributedString? - initWithContentsOfMarkdownFileAtURL_options_baseURL_error_( - objc.NSURL markdownFile, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfMarkdownFileAtURL_options_baseURL_error_, - markdownFile.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdown:options:baseURL:error: - NSMutableAttributedString? initWithMarkdown_options_baseURL_error_( - objc.NSData markdown, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdown_options_baseURL_error_, - markdown.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdownString:options:baseURL:error: - NSMutableAttributedString? initWithMarkdownString_options_baseURL_error_( - objc.NSString markdownString, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdownString_options_baseURL_error_, - markdownString.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithFormat:options:locale: - NSMutableAttributedString initWithFormat_options_locale_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSLocale? locale) { - final _ret = _objc_msgSend_4x8h9q( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat: - static NSMutableAttributedString localizedAttributedStringWithFormat_( - NSAttributedString format) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_, format.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options: - static NSMutableAttributedString localizedAttributedStringWithFormat_options_( - NSAttributedString format, NSAttributedStringFormattingOptions options) { - final _ret = _objc_msgSend_1vfncet( - _class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_options_, - format.ref.pointer, - options.value); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithFormat:options:locale:context: - NSMutableAttributedString initWithFormat_options_locale_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSLocale? locale, - objc.NSDictionary context) { - final _ret = _objc_msgSend_xvcwe5( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_context_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr, - context.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat:context: - static NSMutableAttributedString localizedAttributedStringWithFormat_context_( - NSAttributedString format, objc.NSDictionary context) { - final _ret = _objc_msgSend_iq11qg( - _class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_context_, - format.ref.pointer, - context.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options:context: - static NSMutableAttributedString - localizedAttributedStringWithFormat_options_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSDictionary context) { - final _ret = _objc_msgSend_4x8h9q( - _class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_options_context_, - format.ref.pointer, - options.value, - context.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSMutableAttributedString init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSMutableAttributedString new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMutableAttributedString, _sel_new); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSMutableAttributedString allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMutableAttributedString, _sel_allocWithZone_, zone); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSMutableAttributedString alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMutableAttributedString, _sel_alloc); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMutableAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMutableAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMutableAttributedString, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSMutableAttributedString, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableAttributedString, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableAttributedString, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMutableAttributedString, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableAttributedString, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableAttributedString, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMutableAttributedString self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSMutableAttributedString retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSMutableAttributedString autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableAttributedString, _sel_supportsSecureCoding); - } - - /// initWithCoder: - NSMutableAttributedString? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _class_NSFormatter = objc.getClass("NSFormatter"); -late final _sel_stringForObjectValue_ = - objc.registerName("stringForObjectValue:"); -late final _sel_attributedStringForObjectValue_withDefaultAttributes_ = - objc.registerName("attributedStringForObjectValue:withDefaultAttributes:"); -late final _sel_editingStringForObjectValue_ = - objc.registerName("editingStringForObjectValue:"); -late final _sel_getObjectValue_forString_errorDescription_ = - objc.registerName("getObjectValue:forString:errorDescription:"); -final _objc_msgSend_1tdtroe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_isPartialStringValid_newEditingString_errorDescription_ = objc - .registerName("isPartialStringValid:newEditingString:errorDescription:"); -final _objc_msgSend_to8xlo = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription_ = - objc.registerName( - "isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:"); -final _objc_msgSend_1hu6x2w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer>)>(); - -/// NSFormatter -class NSFormatter extends objc.NSObject { - NSFormatter._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFormatter] that points to the same underlying object as [other]. - NSFormatter.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFormatter] that wraps the given raw object pointer. - NSFormatter.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFormatter]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFormatter); - } - - /// stringForObjectValue: - objc.NSString? stringForObjectValue_(objc.ObjCObjectBase? obj) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_stringForObjectValue_, obj?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// attributedStringForObjectValue:withDefaultAttributes: - NSAttributedString? attributedStringForObjectValue_withDefaultAttributes_( - objc.ObjCObjectBase obj, objc.NSDictionary? attrs) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_attributedStringForObjectValue_withDefaultAttributes_, - obj.ref.pointer, - attrs?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, retain: true, release: true); - } - - /// editingStringForObjectValue: - objc.NSString? editingStringForObjectValue_(objc.ObjCObjectBase obj) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_editingStringForObjectValue_, obj.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// getObjectValue:forString:errorDescription: - bool getObjectValue_forString_errorDescription_( - ffi.Pointer> obj, - objc.NSString string, - ffi.Pointer> error) { - return _objc_msgSend_1tdtroe( - this.ref.pointer, - _sel_getObjectValue_forString_errorDescription_, - obj, - string.ref.pointer, - error); - } - - /// isPartialStringValid:newEditingString:errorDescription: - bool isPartialStringValid_newEditingString_errorDescription_( - objc.NSString partialString, - ffi.Pointer> newString, - ffi.Pointer> error) { - return _objc_msgSend_to8xlo( - this.ref.pointer, - _sel_isPartialStringValid_newEditingString_errorDescription_, - partialString.ref.pointer, - newString, - error); - } - - /// isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription: - bool - isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription_( - ffi.Pointer> partialStringPtr, - ffi.Pointer proposedSelRangePtr, - objc.NSString origString, - objc.NSRange origSelRange, - ffi.Pointer> error) { - return _objc_msgSend_1hu6x2w( - this.ref.pointer, - _sel_isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription_, - partialStringPtr, - proposedSelRangePtr, - origString.ref.pointer, - origSelRange, - error); - } - - /// init - NSFormatter init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFormatter new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFormatter, _sel_new); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFormatter allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFormatter, _sel_allocWithZone_, zone); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFormatter alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFormatter, _sel_alloc); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFormatter, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFormatter, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFormatter, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFormatter, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFormatter, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFormatter, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSFormatter, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSFormatter self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSFormatter retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSFormatter autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSFormatter? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSFormatter.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSDateFormatter = objc.getClass("NSDateFormatter"); - -enum NSFormattingContext { - NSFormattingContextUnknown(0), - NSFormattingContextDynamic(1), - NSFormattingContextStandalone(2), - NSFormattingContextListItem(3), - NSFormattingContextBeginningOfSentence(4), - NSFormattingContextMiddleOfSentence(5); - - final int value; - const NSFormattingContext(this.value); - - static NSFormattingContext fromValue(int value) => switch (value) { - 0 => NSFormattingContextUnknown, - 1 => NSFormattingContextDynamic, - 2 => NSFormattingContextStandalone, - 3 => NSFormattingContextListItem, - 4 => NSFormattingContextBeginningOfSentence, - 5 => NSFormattingContextMiddleOfSentence, - _ => - throw ArgumentError("Unknown value for NSFormattingContext: $value"), - }; -} - -late final _sel_formattingContext = objc.registerName("formattingContext"); -final _objc_msgSend_10wicfq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setFormattingContext_ = - objc.registerName("setFormattingContext:"); -final _objc_msgSend_1gtwv7x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_getObjectValue_forString_range_error_ = - objc.registerName("getObjectValue:forString:range:error:"); -final _objc_msgSend_bl9kx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_stringFromDate_ = objc.registerName("stringFromDate:"); -late final _sel_dateFromString_ = objc.registerName("dateFromString:"); - -enum NSDateFormatterStyle { - NSDateFormatterNoStyle(0), - NSDateFormatterShortStyle(1), - NSDateFormatterMediumStyle(2), - NSDateFormatterLongStyle(3), - NSDateFormatterFullStyle(4); - - final int value; - const NSDateFormatterStyle(this.value); - - static NSDateFormatterStyle fromValue(int value) => switch (value) { - 0 => NSDateFormatterNoStyle, - 1 => NSDateFormatterShortStyle, - 2 => NSDateFormatterMediumStyle, - 3 => NSDateFormatterLongStyle, - 4 => NSDateFormatterFullStyle, - _ => - throw ArgumentError("Unknown value for NSDateFormatterStyle: $value"), - }; -} - -late final _sel_localizedStringFromDate_dateStyle_timeStyle_ = - objc.registerName("localizedStringFromDate:dateStyle:timeStyle:"); -final _objc_msgSend_1sgexgh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int)>(); -late final _sel_dateFormatFromTemplate_options_locale_ = - objc.registerName("dateFormatFromTemplate:options:locale:"); -final _objc_msgSend_1czjmpk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - -enum NSDateFormatterBehavior { - NSDateFormatterBehaviorDefault(0), - NSDateFormatterBehavior10_0(1000), - NSDateFormatterBehavior10_4(1040); - - final int value; - const NSDateFormatterBehavior(this.value); - - static NSDateFormatterBehavior fromValue(int value) => switch (value) { - 0 => NSDateFormatterBehaviorDefault, - 1000 => NSDateFormatterBehavior10_0, - 1040 => NSDateFormatterBehavior10_4, - _ => throw ArgumentError( - "Unknown value for NSDateFormatterBehavior: $value"), - }; -} - -late final _sel_defaultFormatterBehavior = - objc.registerName("defaultFormatterBehavior"); -final _objc_msgSend_ti9wzk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDefaultFormatterBehavior_ = - objc.registerName("setDefaultFormatterBehavior:"); -final _objc_msgSend_ffb1q7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setLocalizedDateFormatFromTemplate_ = - objc.registerName("setLocalizedDateFormatFromTemplate:"); -late final _sel_dateFormat = objc.registerName("dateFormat"); -late final _sel_setDateFormat_ = objc.registerName("setDateFormat:"); -late final _sel_dateStyle = objc.registerName("dateStyle"); -final _objc_msgSend_r4ksf1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDateStyle_ = objc.registerName("setDateStyle:"); -final _objc_msgSend_7hnqfw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_timeStyle = objc.registerName("timeStyle"); -late final _sel_setTimeStyle_ = objc.registerName("setTimeStyle:"); -late final _sel_locale = objc.registerName("locale"); -late final _sel_setLocale_ = objc.registerName("setLocale:"); -late final _sel_generatesCalendarDates = - objc.registerName("generatesCalendarDates"); -late final _sel_setGeneratesCalendarDates_ = - objc.registerName("setGeneratesCalendarDates:"); -late final _sel_formatterBehavior = objc.registerName("formatterBehavior"); -late final _sel_setFormatterBehavior_ = - objc.registerName("setFormatterBehavior:"); -late final _class_NSTimeZone = objc.getClass("NSTimeZone"); -late final _sel_name = objc.registerName("name"); -late final _sel_data = objc.registerName("data"); -late final _sel_secondsFromGMTForDate_ = - objc.registerName("secondsFromGMTForDate:"); -final _objc_msgSend_hrsqsi = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_abbreviationForDate_ = - objc.registerName("abbreviationForDate:"); -late final _sel_isDaylightSavingTimeForDate_ = - objc.registerName("isDaylightSavingTimeForDate:"); -late final _sel_daylightSavingTimeOffsetForDate_ = - objc.registerName("daylightSavingTimeOffsetForDate:"); -late final _sel_nextDaylightSavingTimeTransitionAfterDate_ = - objc.registerName("nextDaylightSavingTimeTransitionAfterDate:"); -late final _sel_systemTimeZone = objc.registerName("systemTimeZone"); -late final _sel_resetSystemTimeZone = objc.registerName("resetSystemTimeZone"); -late final _sel_defaultTimeZone = objc.registerName("defaultTimeZone"); -late final _sel_setDefaultTimeZone_ = objc.registerName("setDefaultTimeZone:"); -late final _sel_localTimeZone = objc.registerName("localTimeZone"); -late final _sel_knownTimeZoneNames = objc.registerName("knownTimeZoneNames"); -late final _sel_abbreviationDictionary = - objc.registerName("abbreviationDictionary"); -late final _sel_setAbbreviationDictionary_ = - objc.registerName("setAbbreviationDictionary:"); -late final _sel_timeZoneDataVersion = objc.registerName("timeZoneDataVersion"); -late final _sel_secondsFromGMT = objc.registerName("secondsFromGMT"); -final _objc_msgSend_z1fx1b = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_abbreviation = objc.registerName("abbreviation"); -late final _sel_isDaylightSavingTime = - objc.registerName("isDaylightSavingTime"); -late final _sel_daylightSavingTimeOffset = - objc.registerName("daylightSavingTimeOffset"); -late final _sel_nextDaylightSavingTimeTransition = - objc.registerName("nextDaylightSavingTimeTransition"); -late final _sel_description = objc.registerName("description"); -late final _sel_isEqualToTimeZone_ = objc.registerName("isEqualToTimeZone:"); - -enum NSTimeZoneNameStyle { - NSTimeZoneNameStyleStandard(0), - NSTimeZoneNameStyleShortStandard(1), - NSTimeZoneNameStyleDaylightSaving(2), - NSTimeZoneNameStyleShortDaylightSaving(3), - NSTimeZoneNameStyleGeneric(4), - NSTimeZoneNameStyleShortGeneric(5); - - final int value; - const NSTimeZoneNameStyle(this.value); - - static NSTimeZoneNameStyle fromValue(int value) => switch (value) { - 0 => NSTimeZoneNameStyleStandard, - 1 => NSTimeZoneNameStyleShortStandard, - 2 => NSTimeZoneNameStyleDaylightSaving, - 3 => NSTimeZoneNameStyleShortDaylightSaving, - 4 => NSTimeZoneNameStyleGeneric, - 5 => NSTimeZoneNameStyleShortGeneric, - _ => - throw ArgumentError("Unknown value for NSTimeZoneNameStyle: $value"), - }; -} - -late final _sel_localizedName_locale_ = - objc.registerName("localizedName:locale:"); -final _objc_msgSend_1c91ngg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_timeZoneWithName_ = objc.registerName("timeZoneWithName:"); -late final _sel_timeZoneWithName_data_ = - objc.registerName("timeZoneWithName:data:"); -late final _sel_initWithName_ = objc.registerName("initWithName:"); -late final _sel_initWithName_data_ = objc.registerName("initWithName:data:"); -late final _sel_timeZoneForSecondsFromGMT_ = - objc.registerName("timeZoneForSecondsFromGMT:"); -final _objc_msgSend_crtxa9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_timeZoneWithAbbreviation_ = - objc.registerName("timeZoneWithAbbreviation:"); - -/// NSTimeZone -class NSTimeZone extends objc.NSObject { - NSTimeZone._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTimeZone] that points to the same underlying object as [other]. - NSTimeZone.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTimeZone] that wraps the given raw object pointer. - NSTimeZone.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTimeZone]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTimeZone); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// data - objc.NSData get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// secondsFromGMTForDate: - int secondsFromGMTForDate_(objc.NSDate aDate) { - return _objc_msgSend_hrsqsi( - this.ref.pointer, _sel_secondsFromGMTForDate_, aDate.ref.pointer); - } - - /// abbreviationForDate: - objc.NSString? abbreviationForDate_(objc.NSDate aDate) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_abbreviationForDate_, aDate.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isDaylightSavingTimeForDate: - bool isDaylightSavingTimeForDate_(objc.NSDate aDate) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDaylightSavingTimeForDate_, aDate.ref.pointer); - } - - /// daylightSavingTimeOffsetForDate: - double daylightSavingTimeOffsetForDate_(objc.NSDate aDate) { - return objc.useMsgSendVariants - ? _objc_msgSend_om71r5Fpret(this.ref.pointer, - _sel_daylightSavingTimeOffsetForDate_, aDate.ref.pointer) - : _objc_msgSend_om71r5(this.ref.pointer, - _sel_daylightSavingTimeOffsetForDate_, aDate.ref.pointer); - } - - /// nextDaylightSavingTimeTransitionAfterDate: - objc.NSDate? nextDaylightSavingTimeTransitionAfterDate_(objc.NSDate aDate) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_nextDaylightSavingTimeTransitionAfterDate_, aDate.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// systemTimeZone - static NSTimeZone getSystemTimeZone() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_systemTimeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// resetSystemTimeZone - static void resetSystemTimeZone() { - _objc_msgSend_ksby9f(_class_NSTimeZone, _sel_resetSystemTimeZone); - } - - /// defaultTimeZone - static NSTimeZone getDefaultTimeZone() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_defaultTimeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setDefaultTimeZone: - static void setDefaultTimeZone(NSTimeZone value) { - return _objc_msgSend_ukcdfq( - _class_NSTimeZone, _sel_setDefaultTimeZone_, value.ref.pointer); - } - - /// localTimeZone - static NSTimeZone getLocalTimeZone() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_localTimeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// knownTimeZoneNames - static objc.NSArray getKnownTimeZoneNames() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_knownTimeZoneNames); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// abbreviationDictionary - static objc.NSDictionary getAbbreviationDictionary() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_abbreviationDictionary); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setAbbreviationDictionary: - static void setAbbreviationDictionary(objc.NSDictionary value) { - return _objc_msgSend_ukcdfq( - _class_NSTimeZone, _sel_setAbbreviationDictionary_, value.ref.pointer); - } - - /// timeZoneDataVersion - static objc.NSString getTimeZoneDataVersion() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_timeZoneDataVersion); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// secondsFromGMT - int get secondsFromGMT { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_secondsFromGMT); - } - - /// abbreviation - objc.NSString? get abbreviation { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_abbreviation); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isDaylightSavingTime - bool get daylightSavingTime { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isDaylightSavingTime); - } - - /// daylightSavingTimeOffset - double get daylightSavingTimeOffset { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_daylightSavingTimeOffset) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_daylightSavingTimeOffset); - } - - /// nextDaylightSavingTimeTransition - objc.NSDate? get nextDaylightSavingTimeTransition { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_nextDaylightSavingTimeTransition); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// description - objc.NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isEqualToTimeZone: - bool isEqualToTimeZone_(NSTimeZone aTimeZone) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToTimeZone_, aTimeZone.ref.pointer); - } - - /// localizedName:locale: - objc.NSString? localizedName_locale_( - NSTimeZoneNameStyle style, objc.NSLocale? locale) { - final _ret = _objc_msgSend_1c91ngg( - this.ref.pointer, - _sel_localizedName_locale_, - style.value, - locale?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZoneWithName: - static NSTimeZone? timeZoneWithName_(objc.NSString tzName) { - final _ret = _objc_msgSend_juohf7( - _class_NSTimeZone, _sel_timeZoneWithName_, tzName.ref.pointer); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZoneWithName:data: - static NSTimeZone? timeZoneWithName_data_( - objc.NSString tzName, objc.NSData? aData) { - final _ret = _objc_msgSend_iq11qg( - _class_NSTimeZone, - _sel_timeZoneWithName_data_, - tzName.ref.pointer, - aData?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithName: - NSTimeZone? initWithName_(objc.NSString tzName) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithName_, tzName.ref.pointer); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithName:data: - NSTimeZone? initWithName_data_(objc.NSString tzName, objc.NSData? aData) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithName_data_, - tzName.ref.pointer, - aData?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// timeZoneForSecondsFromGMT: - static NSTimeZone timeZoneForSecondsFromGMT_(int seconds) { - final _ret = _objc_msgSend_crtxa9( - _class_NSTimeZone, _sel_timeZoneForSecondsFromGMT_, seconds); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZoneWithAbbreviation: - static NSTimeZone? timeZoneWithAbbreviation_(objc.NSString abbreviation) { - final _ret = _objc_msgSend_juohf7(_class_NSTimeZone, - _sel_timeZoneWithAbbreviation_, abbreviation.ref.pointer); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSTimeZone init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSTimeZone new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_new); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSTimeZone allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSTimeZone, _sel_allocWithZone_, zone); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSTimeZone alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_alloc); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTimeZone, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTimeZone, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTimeZone, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSTimeZone, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTimeZone, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTimeZone, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTimeZone, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTimeZone, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSTimeZone, _sel_supportsSecureCoding); - } -} - -late final _sel_timeZone = objc.registerName("timeZone"); -late final _sel_setTimeZone_ = objc.registerName("setTimeZone:"); -late final _class_NSCalendar = objc.getClass("NSCalendar"); -late final _sel_currentCalendar = objc.registerName("currentCalendar"); -late final _sel_autoupdatingCurrentCalendar = - objc.registerName("autoupdatingCurrentCalendar"); -late final _sel_calendarWithIdentifier_ = - objc.registerName("calendarWithIdentifier:"); -late final _sel_initWithCalendarIdentifier_ = - objc.registerName("initWithCalendarIdentifier:"); -late final _sel_calendarIdentifier = objc.registerName("calendarIdentifier"); -late final _sel_firstWeekday = objc.registerName("firstWeekday"); -late final _sel_setFirstWeekday_ = objc.registerName("setFirstWeekday:"); -final _objc_msgSend_1k4zaz5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_minimumDaysInFirstWeek = - objc.registerName("minimumDaysInFirstWeek"); -late final _sel_setMinimumDaysInFirstWeek_ = - objc.registerName("setMinimumDaysInFirstWeek:"); -late final _sel_eraSymbols = objc.registerName("eraSymbols"); -late final _sel_longEraSymbols = objc.registerName("longEraSymbols"); -late final _sel_monthSymbols = objc.registerName("monthSymbols"); -late final _sel_shortMonthSymbols = objc.registerName("shortMonthSymbols"); -late final _sel_veryShortMonthSymbols = - objc.registerName("veryShortMonthSymbols"); -late final _sel_standaloneMonthSymbols = - objc.registerName("standaloneMonthSymbols"); -late final _sel_shortStandaloneMonthSymbols = - objc.registerName("shortStandaloneMonthSymbols"); -late final _sel_veryShortStandaloneMonthSymbols = - objc.registerName("veryShortStandaloneMonthSymbols"); -late final _sel_weekdaySymbols = objc.registerName("weekdaySymbols"); -late final _sel_shortWeekdaySymbols = objc.registerName("shortWeekdaySymbols"); -late final _sel_veryShortWeekdaySymbols = - objc.registerName("veryShortWeekdaySymbols"); -late final _sel_standaloneWeekdaySymbols = - objc.registerName("standaloneWeekdaySymbols"); -late final _sel_shortStandaloneWeekdaySymbols = - objc.registerName("shortStandaloneWeekdaySymbols"); -late final _sel_veryShortStandaloneWeekdaySymbols = - objc.registerName("veryShortStandaloneWeekdaySymbols"); -late final _sel_quarterSymbols = objc.registerName("quarterSymbols"); -late final _sel_shortQuarterSymbols = objc.registerName("shortQuarterSymbols"); -late final _sel_standaloneQuarterSymbols = - objc.registerName("standaloneQuarterSymbols"); -late final _sel_shortStandaloneQuarterSymbols = - objc.registerName("shortStandaloneQuarterSymbols"); -late final _sel_AMSymbol = objc.registerName("AMSymbol"); -late final _sel_PMSymbol = objc.registerName("PMSymbol"); - -enum NSCalendarUnit { - NSCalendarUnitEra(2), - NSCalendarUnitYear(4), - NSCalendarUnitMonth(8), - NSCalendarUnitDay(16), - NSCalendarUnitHour(32), - NSCalendarUnitMinute(64), - NSCalendarUnitSecond(128), - NSCalendarUnitWeekday(512), - NSCalendarUnitWeekdayOrdinal(1024), - NSCalendarUnitQuarter(2048), - NSCalendarUnitWeekOfMonth(4096), - NSCalendarUnitWeekOfYear(8192), - NSCalendarUnitYearForWeekOfYear(16384), - NSCalendarUnitNanosecond(32768), - NSCalendarUnitCalendar(1048576), - NSCalendarUnitTimeZone(2097152), - NSWeekCalendarUnit(256); - - static const NSEraCalendarUnit = NSCalendarUnitEra; - static const NSYearCalendarUnit = NSCalendarUnitYear; - static const NSMonthCalendarUnit = NSCalendarUnitMonth; - static const NSDayCalendarUnit = NSCalendarUnitDay; - static const NSHourCalendarUnit = NSCalendarUnitHour; - static const NSMinuteCalendarUnit = NSCalendarUnitMinute; - static const NSSecondCalendarUnit = NSCalendarUnitSecond; - static const NSWeekdayCalendarUnit = NSCalendarUnitWeekday; - static const NSWeekdayOrdinalCalendarUnit = NSCalendarUnitWeekdayOrdinal; - static const NSQuarterCalendarUnit = NSCalendarUnitQuarter; - static const NSWeekOfMonthCalendarUnit = NSCalendarUnitWeekOfMonth; - static const NSWeekOfYearCalendarUnit = NSCalendarUnitWeekOfYear; - static const NSYearForWeekOfYearCalendarUnit = - NSCalendarUnitYearForWeekOfYear; - static const NSCalendarCalendarUnit = NSCalendarUnitCalendar; - static const NSTimeZoneCalendarUnit = NSCalendarUnitTimeZone; - - final int value; - const NSCalendarUnit(this.value); - - static NSCalendarUnit fromValue(int value) => switch (value) { - 2 => NSCalendarUnitEra, - 4 => NSCalendarUnitYear, - 8 => NSCalendarUnitMonth, - 16 => NSCalendarUnitDay, - 32 => NSCalendarUnitHour, - 64 => NSCalendarUnitMinute, - 128 => NSCalendarUnitSecond, - 512 => NSCalendarUnitWeekday, - 1024 => NSCalendarUnitWeekdayOrdinal, - 2048 => NSCalendarUnitQuarter, - 4096 => NSCalendarUnitWeekOfMonth, - 8192 => NSCalendarUnitWeekOfYear, - 16384 => NSCalendarUnitYearForWeekOfYear, - 32768 => NSCalendarUnitNanosecond, - 1048576 => NSCalendarUnitCalendar, - 2097152 => NSCalendarUnitTimeZone, - 256 => NSWeekCalendarUnit, - _ => throw ArgumentError("Unknown value for NSCalendarUnit: $value"), - }; - - @override - String toString() { - if (this == NSCalendarUnitEra) - return "NSCalendarUnit.NSCalendarUnitEra, NSCalendarUnit.NSEraCalendarUnit"; - if (this == NSCalendarUnitYear) - return "NSCalendarUnit.NSCalendarUnitYear, NSCalendarUnit.NSYearCalendarUnit"; - if (this == NSCalendarUnitMonth) - return "NSCalendarUnit.NSCalendarUnitMonth, NSCalendarUnit.NSMonthCalendarUnit"; - if (this == NSCalendarUnitDay) - return "NSCalendarUnit.NSCalendarUnitDay, NSCalendarUnit.NSDayCalendarUnit"; - if (this == NSCalendarUnitHour) - return "NSCalendarUnit.NSCalendarUnitHour, NSCalendarUnit.NSHourCalendarUnit"; - if (this == NSCalendarUnitMinute) - return "NSCalendarUnit.NSCalendarUnitMinute, NSCalendarUnit.NSMinuteCalendarUnit"; - if (this == NSCalendarUnitSecond) - return "NSCalendarUnit.NSCalendarUnitSecond, NSCalendarUnit.NSSecondCalendarUnit"; - if (this == NSCalendarUnitWeekday) - return "NSCalendarUnit.NSCalendarUnitWeekday, NSCalendarUnit.NSWeekdayCalendarUnit"; - if (this == NSCalendarUnitWeekdayOrdinal) - return "NSCalendarUnit.NSCalendarUnitWeekdayOrdinal, NSCalendarUnit.NSWeekdayOrdinalCalendarUnit"; - if (this == NSCalendarUnitQuarter) - return "NSCalendarUnit.NSCalendarUnitQuarter, NSCalendarUnit.NSQuarterCalendarUnit"; - if (this == NSCalendarUnitWeekOfMonth) - return "NSCalendarUnit.NSCalendarUnitWeekOfMonth, NSCalendarUnit.NSWeekOfMonthCalendarUnit"; - if (this == NSCalendarUnitWeekOfYear) - return "NSCalendarUnit.NSCalendarUnitWeekOfYear, NSCalendarUnit.NSWeekOfYearCalendarUnit"; - if (this == NSCalendarUnitYearForWeekOfYear) - return "NSCalendarUnit.NSCalendarUnitYearForWeekOfYear, NSCalendarUnit.NSYearForWeekOfYearCalendarUnit"; - if (this == NSCalendarUnitCalendar) - return "NSCalendarUnit.NSCalendarUnitCalendar, NSCalendarUnit.NSCalendarCalendarUnit"; - if (this == NSCalendarUnitTimeZone) - return "NSCalendarUnit.NSCalendarUnitTimeZone, NSCalendarUnit.NSTimeZoneCalendarUnit"; - return super.toString(); - } -} - -late final _sel_minimumRangeOfUnit_ = objc.registerName("minimumRangeOfUnit:"); -final _objc_msgSend_8biqtb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_8biqtbStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_maximumRangeOfUnit_ = objc.registerName("maximumRangeOfUnit:"); -late final _sel_rangeOfUnit_inUnit_forDate_ = - objc.registerName("rangeOfUnit:inUnit:forDate:"); -final _objc_msgSend_1lmqh7m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -final _objc_msgSend_1lmqh7mStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -late final _sel_ordinalityOfUnit_inUnit_forDate_ = - objc.registerName("ordinalityOfUnit:inUnit:forDate:"); -final _objc_msgSend_1bi4n7h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -late final _sel_rangeOfUnit_startDate_interval_forDate_ = - objc.registerName("rangeOfUnit:startDate:interval:forDate:"); -final _objc_msgSend_amvrpq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>(); -late final _class_NSDateComponents = objc.getClass("NSDateComponents"); -late final _sel_calendar = objc.registerName("calendar"); -late final _sel_setCalendar_ = objc.registerName("setCalendar:"); -late final _sel_era = objc.registerName("era"); -late final _sel_setEra_ = objc.registerName("setEra:"); -final _objc_msgSend_ke7qz2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_year = objc.registerName("year"); -late final _sel_setYear_ = objc.registerName("setYear:"); -late final _sel_month = objc.registerName("month"); -late final _sel_setMonth_ = objc.registerName("setMonth:"); -late final _sel_day = objc.registerName("day"); -late final _sel_setDay_ = objc.registerName("setDay:"); -late final _sel_hour = objc.registerName("hour"); -late final _sel_setHour_ = objc.registerName("setHour:"); -late final _sel_minute = objc.registerName("minute"); -late final _sel_setMinute_ = objc.registerName("setMinute:"); -late final _sel_second = objc.registerName("second"); -late final _sel_setSecond_ = objc.registerName("setSecond:"); -late final _sel_nanosecond = objc.registerName("nanosecond"); -late final _sel_setNanosecond_ = objc.registerName("setNanosecond:"); -late final _sel_weekday = objc.registerName("weekday"); -late final _sel_setWeekday_ = objc.registerName("setWeekday:"); -late final _sel_weekdayOrdinal = objc.registerName("weekdayOrdinal"); -late final _sel_setWeekdayOrdinal_ = objc.registerName("setWeekdayOrdinal:"); -late final _sel_quarter = objc.registerName("quarter"); -late final _sel_setQuarter_ = objc.registerName("setQuarter:"); -late final _sel_weekOfMonth = objc.registerName("weekOfMonth"); -late final _sel_setWeekOfMonth_ = objc.registerName("setWeekOfMonth:"); -late final _sel_weekOfYear = objc.registerName("weekOfYear"); -late final _sel_setWeekOfYear_ = objc.registerName("setWeekOfYear:"); -late final _sel_yearForWeekOfYear = objc.registerName("yearForWeekOfYear"); -late final _sel_setYearForWeekOfYear_ = - objc.registerName("setYearForWeekOfYear:"); -late final _sel_isLeapMonth = objc.registerName("isLeapMonth"); -late final _sel_setLeapMonth_ = objc.registerName("setLeapMonth:"); -late final _sel_date = objc.registerName("date"); -late final _sel_week = objc.registerName("week"); -late final _sel_setWeek_ = objc.registerName("setWeek:"); -late final _sel_setValue_forComponent_ = - objc.registerName("setValue:forComponent:"); -final _objc_msgSend_13g4496 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -late final _sel_valueForComponent_ = objc.registerName("valueForComponent:"); -final _objc_msgSend_1uobo2v = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_isValidDate = objc.registerName("isValidDate"); -late final _sel_isValidDateInCalendar_ = - objc.registerName("isValidDateInCalendar:"); - -/// NSDateComponents -class NSDateComponents extends objc.NSObject { - NSDateComponents._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDateComponents] that points to the same underlying object as [other]. - NSDateComponents.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDateComponents] that wraps the given raw object pointer. - NSDateComponents.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDateComponents]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDateComponents); - } - - /// calendar - NSCalendar? get calendar { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_calendar); - return _ret.address == 0 - ? null - : NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// setCalendar: - set calendar(NSCalendar? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCalendar_, value?.ref.pointer ?? ffi.nullptr); - } - - /// timeZone - NSTimeZone? get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setTimeZone: - set timeZone(NSTimeZone? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setTimeZone_, value?.ref.pointer ?? ffi.nullptr); - } - - /// era - int get era { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_era); - } - - /// setEra: - set era(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setEra_, value); - } - - /// year - int get year { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_year); - } - - /// setYear: - set year(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setYear_, value); - } - - /// month - int get month { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_month); - } - - /// setMonth: - set month(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setMonth_, value); - } - - /// day - int get day { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_day); - } - - /// setDay: - set day(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setDay_, value); - } - - /// hour - int get hour { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_hour); - } - - /// setHour: - set hour(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setHour_, value); - } - - /// minute - int get minute { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_minute); - } - - /// setMinute: - set minute(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setMinute_, value); - } - - /// second - int get second { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_second); - } - - /// setSecond: - set second(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setSecond_, value); - } - - /// nanosecond - int get nanosecond { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_nanosecond); - } - - /// setNanosecond: - set nanosecond(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setNanosecond_, value); - } - - /// weekday - int get weekday { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekday); - } - - /// setWeekday: - set weekday(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeekday_, value); - } - - /// weekdayOrdinal - int get weekdayOrdinal { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekdayOrdinal); - } - - /// setWeekdayOrdinal: - set weekdayOrdinal(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setWeekdayOrdinal_, value); - } - - /// quarter - int get quarter { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_quarter); - } - - /// setQuarter: - set quarter(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setQuarter_, value); - } - - /// weekOfMonth - int get weekOfMonth { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekOfMonth); - } - - /// setWeekOfMonth: - set weekOfMonth(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeekOfMonth_, value); - } - - /// weekOfYear - int get weekOfYear { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekOfYear); - } - - /// setWeekOfYear: - set weekOfYear(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeekOfYear_, value); - } - - /// yearForWeekOfYear - int get yearForWeekOfYear { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_yearForWeekOfYear); - } - - /// setYearForWeekOfYear: - set yearForWeekOfYear(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setYearForWeekOfYear_, value); - } - - /// isLeapMonth - bool get leapMonth { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLeapMonth); - } - - /// setLeapMonth: - set leapMonth(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setLeapMonth_, value); - } - - /// date - objc.NSDate? get date { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_date); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// week - int week() { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_week); - } - - /// setWeek: - void setWeek_(int v) { - _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeek_, v); - } - - /// setValue:forComponent: - void setValue_forComponent_(int value, NSCalendarUnit unit) { - _objc_msgSend_13g4496( - this.ref.pointer, _sel_setValue_forComponent_, value, unit.value); - } - - /// valueForComponent: - int valueForComponent_(NSCalendarUnit unit) { - return _objc_msgSend_1uobo2v( - this.ref.pointer, _sel_valueForComponent_, unit.value); - } - - /// isValidDate - bool get validDate { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValidDate); - } - - /// isValidDateInCalendar: - bool isValidDateInCalendar_(NSCalendar calendar) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isValidDateInCalendar_, calendar.ref.pointer); - } - - /// init - NSDateComponents init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSDateComponents new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateComponents, _sel_new); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSDateComponents allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDateComponents, _sel_allocWithZone_, zone); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSDateComponents alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateComponents, _sel_alloc); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDateComponents, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDateComponents, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDateComponents, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSDateComponents, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDateComponents, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDateComponents, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDateComponents, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateComponents, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateComponents, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSDateComponents self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSDateComponents retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSDateComponents autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSDateComponents, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSDateComponents? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_dateFromComponents_ = objc.registerName("dateFromComponents:"); -late final _sel_components_fromDate_ = - objc.registerName("components:fromDate:"); -final _objc_msgSend_t9w2ff = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - -enum NSCalendarOptions { - NSCalendarWrapComponents(1), - NSCalendarMatchStrictly(2), - NSCalendarSearchBackwards(4), - NSCalendarMatchPreviousTimePreservingSmallerUnits(256), - NSCalendarMatchNextTimePreservingSmallerUnits(512), - NSCalendarMatchNextTime(1024), - NSCalendarMatchFirst(4096), - NSCalendarMatchLast(8192); - - final int value; - const NSCalendarOptions(this.value); - - static NSCalendarOptions fromValue(int value) => switch (value) { - 1 => NSCalendarWrapComponents, - 2 => NSCalendarMatchStrictly, - 4 => NSCalendarSearchBackwards, - 256 => NSCalendarMatchPreviousTimePreservingSmallerUnits, - 512 => NSCalendarMatchNextTimePreservingSmallerUnits, - 1024 => NSCalendarMatchNextTime, - 4096 => NSCalendarMatchFirst, - 8192 => NSCalendarMatchLast, - _ => throw ArgumentError("Unknown value for NSCalendarOptions: $value"), - }; -} - -late final _sel_dateByAddingComponents_toDate_options_ = - objc.registerName("dateByAddingComponents:toDate:options:"); -final _objc_msgSend_2sm1zi = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_components_fromDate_toDate_options_ = - objc.registerName("components:fromDate:toDate:options:"); -final _objc_msgSend_1jc93x2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_getEra_year_month_day_fromDate_ = - objc.registerName("getEra:year:month:day:fromDate:"); -final _objc_msgSend_1ermmsa = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate_ = - objc.registerName("getEra:yearForWeekOfYear:weekOfYear:weekday:fromDate:"); -late final _sel_getHour_minute_second_nanosecond_fromDate_ = - objc.registerName("getHour:minute:second:nanosecond:fromDate:"); -late final _sel_component_fromDate_ = objc.registerName("component:fromDate:"); -final _objc_msgSend_tm9h70 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_dateWithEra_year_month_day_hour_minute_second_nanosecond_ = objc - .registerName("dateWithEra:year:month:day:hour:minute:second:nanosecond:"); -final _objc_msgSend_1747i7s = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - int, - int, - int, - int, - int, - int)>(); -late final _sel_dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond_ = - objc.registerName( - "dateWithEra:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:"); -late final _sel_startOfDayForDate_ = objc.registerName("startOfDayForDate:"); -late final _sel_componentsInTimeZone_fromDate_ = - objc.registerName("componentsInTimeZone:fromDate:"); -late final _sel_compareDate_toDate_toUnitGranularity_ = - objc.registerName("compareDate:toDate:toUnitGranularity:"); -final _objc_msgSend_jpc2bg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_isDate_equalToDate_toUnitGranularity_ = - objc.registerName("isDate:equalToDate:toUnitGranularity:"); -final _objc_msgSend_188aig1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_isDate_inSameDayAsDate_ = - objc.registerName("isDate:inSameDayAsDate:"); -final _objc_msgSend_1ywe6ev = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isDateInToday_ = objc.registerName("isDateInToday:"); -late final _sel_isDateInYesterday_ = objc.registerName("isDateInYesterday:"); -late final _sel_isDateInTomorrow_ = objc.registerName("isDateInTomorrow:"); -late final _sel_isDateInWeekend_ = objc.registerName("isDateInWeekend:"); -late final _sel_rangeOfWeekendStartDate_interval_containingDate_ = - objc.registerName("rangeOfWeekendStartDate:interval:containingDate:"); -final _objc_msgSend_seipso = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_nextWeekendStartDate_interval_options_afterDate_ = - objc.registerName("nextWeekendStartDate:interval:options:afterDate:"); -final _objc_msgSend_1brdgri = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_components_fromDateComponents_toDateComponents_options_ = objc - .registerName("components:fromDateComponents:toDateComponents:options:"); -late final _sel_dateByAddingUnit_value_toDate_options_ = - objc.registerName("dateByAddingUnit:value:toDate:options:"); -final _objc_msgSend_b1fge4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Long, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - int)>(); -void _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Bool arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, bool, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDate_bool_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSDate_bool_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDate_bool_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Bool, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerCallable = ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_NSDate_bool_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function( - objc.NSDate?, ffi.Bool, ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - fromFunctionPointer( - ffi.Pointer arg0, ffi.Bool arg1, ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - void Function(objc.NSDate?, bool, ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDate_bool_bool_closureCallable, - (ffi.Pointer arg0, bool arg1, ffi.Pointer arg2) => fn( - arg0.address == 0 - ? null - : objc.NSDate.castFromPointer(arg0, retain: true, release: true), - arg1, - arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - listener(void Function(objc.NSDate?, bool, ffi.Pointer) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, bool arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.NSDate.castFromPointer(arg0, - retain: false, release: true), - arg1, - arg2)); - final wrapper = _wrapListenerBlock_rvgf02(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_NSDate_bool_bool_CallExtension on objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> { - void call(objc.NSDate? arg0, bool arg1, ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Bool arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1, arg2); -} - -late final _sel_enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock_ = - objc.registerName( - "enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock:"); -final _objc_msgSend_z9v2cv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_nextDateAfterDate_matchingComponents_options_ = - objc.registerName("nextDateAfterDate:matchingComponents:options:"); -late final _sel_nextDateAfterDate_matchingUnit_value_options_ = - objc.registerName("nextDateAfterDate:matchingUnit:value:options:"); -final _objc_msgSend_1im3h6w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Long, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - int)>(); -late final _sel_nextDateAfterDate_matchingHour_minute_second_options_ = - objc.registerName("nextDateAfterDate:matchingHour:minute:second:options:"); -final _objc_msgSend_tio5o0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - int, - int)>(); -late final _sel_dateBySettingUnit_value_ofDate_options_ = - objc.registerName("dateBySettingUnit:value:ofDate:options:"); -late final _sel_dateBySettingHour_minute_second_ofDate_options_ = - objc.registerName("dateBySettingHour:minute:second:ofDate:options:"); -final _objc_msgSend_16h627a = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - int, - ffi.Pointer, - int)>(); -late final _sel_date_matchesComponents_ = - objc.registerName("date:matchesComponents:"); - -/// NSCalendar -class NSCalendar extends objc.NSObject { - NSCalendar._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSCalendar] that points to the same underlying object as [other]. - NSCalendar.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSCalendar] that wraps the given raw object pointer. - NSCalendar.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSCalendar]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSCalendar); - } - - /// currentCalendar - static NSCalendar getCurrentCalendar() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_currentCalendar); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// autoupdatingCurrentCalendar - static NSCalendar getAutoupdatingCurrentCalendar() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCalendar, _sel_autoupdatingCurrentCalendar); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// calendarWithIdentifier: - static NSCalendar? calendarWithIdentifier_( - objc.NSString calendarIdentifierConstant) { - final _ret = _objc_msgSend_juohf7(_class_NSCalendar, - _sel_calendarWithIdentifier_, calendarIdentifierConstant.ref.pointer); - return _ret.address == 0 - ? null - : NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSCalendar init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCalendarIdentifier: - objc.ObjCObjectBase? initWithCalendarIdentifier_(objc.NSString ident) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCalendarIdentifier_, ident.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// calendarIdentifier - objc.NSString get calendarIdentifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_calendarIdentifier); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// locale - objc.NSLocale? get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return _ret.address == 0 - ? null - : objc.NSLocale.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.NSLocale? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value?.ref.pointer ?? ffi.nullptr); - } - - /// timeZone - NSTimeZone get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setTimeZone: - set timeZone(NSTimeZone value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setTimeZone_, value.ref.pointer); - } - - /// firstWeekday - int get firstWeekday { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_firstWeekday); - } - - /// setFirstWeekday: - set firstWeekday(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setFirstWeekday_, value); - } - - /// minimumDaysInFirstWeek - int get minimumDaysInFirstWeek { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_minimumDaysInFirstWeek); - } - - /// setMinimumDaysInFirstWeek: - set minimumDaysInFirstWeek(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumDaysInFirstWeek_, value); - } - - /// eraSymbols - objc.NSArray get eraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_eraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// longEraSymbols - objc.NSArray get longEraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_longEraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// monthSymbols - objc.NSArray get monthSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_monthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortMonthSymbols - objc.NSArray get shortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortMonthSymbols - objc.NSArray get veryShortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// standaloneMonthSymbols - objc.NSArray get standaloneMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortStandaloneMonthSymbols - objc.NSArray get shortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortStandaloneMonthSymbols - objc.NSArray get veryShortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// weekdaySymbols - objc.NSArray get weekdaySymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_weekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortWeekdaySymbols - objc.NSArray get shortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortWeekdaySymbols - objc.NSArray get veryShortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// standaloneWeekdaySymbols - objc.NSArray get standaloneWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortStandaloneWeekdaySymbols - objc.NSArray get shortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortStandaloneWeekdaySymbols - objc.NSArray get veryShortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// quarterSymbols - objc.NSArray get quarterSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_quarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortQuarterSymbols - objc.NSArray get shortQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// standaloneQuarterSymbols - objc.NSArray get standaloneQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortStandaloneQuarterSymbols - objc.NSArray get shortStandaloneQuarterSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// AMSymbol - objc.NSString get AMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_AMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// PMSymbol - objc.NSString get PMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_PMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// minimumRangeOfUnit: - objc.NSRange minimumRangeOfUnit_(NSCalendarUnit unit) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_8biqtbStret( - _ptr, this.ref.pointer, _sel_minimumRangeOfUnit_, unit.value) - : _ptr.ref = _objc_msgSend_8biqtb( - this.ref.pointer, _sel_minimumRangeOfUnit_, unit.value); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// maximumRangeOfUnit: - objc.NSRange maximumRangeOfUnit_(NSCalendarUnit unit) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_8biqtbStret( - _ptr, this.ref.pointer, _sel_maximumRangeOfUnit_, unit.value) - : _ptr.ref = _objc_msgSend_8biqtb( - this.ref.pointer, _sel_maximumRangeOfUnit_, unit.value); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// rangeOfUnit:inUnit:forDate: - objc.NSRange rangeOfUnit_inUnit_forDate_( - NSCalendarUnit smaller, NSCalendarUnit larger, objc.NSDate date) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1lmqh7mStret( - _ptr, - this.ref.pointer, - _sel_rangeOfUnit_inUnit_forDate_, - smaller.value, - larger.value, - date.ref.pointer) - : _ptr.ref = _objc_msgSend_1lmqh7m( - this.ref.pointer, - _sel_rangeOfUnit_inUnit_forDate_, - smaller.value, - larger.value, - date.ref.pointer); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// ordinalityOfUnit:inUnit:forDate: - int ordinalityOfUnit_inUnit_forDate_( - NSCalendarUnit smaller, NSCalendarUnit larger, objc.NSDate date) { - return _objc_msgSend_1bi4n7h( - this.ref.pointer, - _sel_ordinalityOfUnit_inUnit_forDate_, - smaller.value, - larger.value, - date.ref.pointer); - } - - /// rangeOfUnit:startDate:interval:forDate: - bool rangeOfUnit_startDate_interval_forDate_( - NSCalendarUnit unit, - ffi.Pointer> datep, - ffi.Pointer tip, - objc.NSDate date) { - return _objc_msgSend_amvrpq( - this.ref.pointer, - _sel_rangeOfUnit_startDate_interval_forDate_, - unit.value, - datep, - tip, - date.ref.pointer); - } - - /// dateFromComponents: - objc.NSDate? dateFromComponents_(NSDateComponents comps) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dateFromComponents_, comps.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// components:fromDate: - NSDateComponents components_fromDate_( - NSCalendarUnit unitFlags, objc.NSDate date) { - final _ret = _objc_msgSend_t9w2ff(this.ref.pointer, - _sel_components_fromDate_, unitFlags.value, date.ref.pointer); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// dateByAddingComponents:toDate:options: - objc.NSDate? dateByAddingComponents_toDate_options_( - NSDateComponents comps, objc.NSDate date, NSCalendarOptions opts) { - final _ret = _objc_msgSend_2sm1zi( - this.ref.pointer, - _sel_dateByAddingComponents_toDate_options_, - comps.ref.pointer, - date.ref.pointer, - opts.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// components:fromDate:toDate:options: - NSDateComponents components_fromDate_toDate_options_( - NSCalendarUnit unitFlags, - objc.NSDate startingDate, - objc.NSDate resultDate, - NSCalendarOptions opts) { - final _ret = _objc_msgSend_1jc93x2( - this.ref.pointer, - _sel_components_fromDate_toDate_options_, - unitFlags.value, - startingDate.ref.pointer, - resultDate.ref.pointer, - opts.value); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// getEra:year:month:day:fromDate: - void getEra_year_month_day_fromDate_( - ffi.Pointer eraValuePointer, - ffi.Pointer yearValuePointer, - ffi.Pointer monthValuePointer, - ffi.Pointer dayValuePointer, - objc.NSDate date) { - _objc_msgSend_1ermmsa( - this.ref.pointer, - _sel_getEra_year_month_day_fromDate_, - eraValuePointer, - yearValuePointer, - monthValuePointer, - dayValuePointer, - date.ref.pointer); - } - - /// getEra:yearForWeekOfYear:weekOfYear:weekday:fromDate: - void getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate_( - ffi.Pointer eraValuePointer, - ffi.Pointer yearValuePointer, - ffi.Pointer weekValuePointer, - ffi.Pointer weekdayValuePointer, - objc.NSDate date) { - _objc_msgSend_1ermmsa( - this.ref.pointer, - _sel_getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate_, - eraValuePointer, - yearValuePointer, - weekValuePointer, - weekdayValuePointer, - date.ref.pointer); - } - - /// getHour:minute:second:nanosecond:fromDate: - void getHour_minute_second_nanosecond_fromDate_( - ffi.Pointer hourValuePointer, - ffi.Pointer minuteValuePointer, - ffi.Pointer secondValuePointer, - ffi.Pointer nanosecondValuePointer, - objc.NSDate date) { - _objc_msgSend_1ermmsa( - this.ref.pointer, - _sel_getHour_minute_second_nanosecond_fromDate_, - hourValuePointer, - minuteValuePointer, - secondValuePointer, - nanosecondValuePointer, - date.ref.pointer); - } - - /// component:fromDate: - int component_fromDate_(NSCalendarUnit unit, objc.NSDate date) { - return _objc_msgSend_tm9h70(this.ref.pointer, _sel_component_fromDate_, - unit.value, date.ref.pointer); - } - - /// dateWithEra:year:month:day:hour:minute:second:nanosecond: - objc.NSDate? dateWithEra_year_month_day_hour_minute_second_nanosecond_( - int eraValue, - int yearValue, - int monthValue, - int dayValue, - int hourValue, - int minuteValue, - int secondValue, - int nanosecondValue) { - final _ret = _objc_msgSend_1747i7s( - this.ref.pointer, - _sel_dateWithEra_year_month_day_hour_minute_second_nanosecond_, - eraValue, - yearValue, - monthValue, - dayValue, - hourValue, - minuteValue, - secondValue, - nanosecondValue); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateWithEra:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond: - objc.NSDate? - dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond_( - int eraValue, - int yearValue, - int weekValue, - int weekdayValue, - int hourValue, - int minuteValue, - int secondValue, - int nanosecondValue) { - final _ret = _objc_msgSend_1747i7s( - this.ref.pointer, - _sel_dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond_, - eraValue, - yearValue, - weekValue, - weekdayValue, - hourValue, - minuteValue, - secondValue, - nanosecondValue); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// startOfDayForDate: - objc.NSDate startOfDayForDate_(objc.NSDate date) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_startOfDayForDate_, date.ref.pointer); - return objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// componentsInTimeZone:fromDate: - NSDateComponents componentsInTimeZone_fromDate_( - NSTimeZone timezone, objc.NSDate date) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_componentsInTimeZone_fromDate_, - timezone.ref.pointer, - date.ref.pointer); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// compareDate:toDate:toUnitGranularity: - objc.NSComparisonResult compareDate_toDate_toUnitGranularity_( - objc.NSDate date1, objc.NSDate date2, NSCalendarUnit unit) { - final _ret = _objc_msgSend_jpc2bg( - this.ref.pointer, - _sel_compareDate_toDate_toUnitGranularity_, - date1.ref.pointer, - date2.ref.pointer, - unit.value); - return objc.NSComparisonResult.fromValue(_ret); - } - - /// isDate:equalToDate:toUnitGranularity: - bool isDate_equalToDate_toUnitGranularity_( - objc.NSDate date1, objc.NSDate date2, NSCalendarUnit unit) { - return _objc_msgSend_188aig1( - this.ref.pointer, - _sel_isDate_equalToDate_toUnitGranularity_, - date1.ref.pointer, - date2.ref.pointer, - unit.value); - } - - /// isDate:inSameDayAsDate: - bool isDate_inSameDayAsDate_(objc.NSDate date1, objc.NSDate date2) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_isDate_inSameDayAsDate_, - date1.ref.pointer, date2.ref.pointer); - } - - /// isDateInToday: - bool isDateInToday_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInToday_, date.ref.pointer); - } - - /// isDateInYesterday: - bool isDateInYesterday_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInYesterday_, date.ref.pointer); - } - - /// isDateInTomorrow: - bool isDateInTomorrow_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInTomorrow_, date.ref.pointer); - } - - /// isDateInWeekend: - bool isDateInWeekend_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInWeekend_, date.ref.pointer); - } - - /// rangeOfWeekendStartDate:interval:containingDate: - bool rangeOfWeekendStartDate_interval_containingDate_( - ffi.Pointer> datep, - ffi.Pointer tip, - objc.NSDate date) { - return _objc_msgSend_seipso( - this.ref.pointer, - _sel_rangeOfWeekendStartDate_interval_containingDate_, - datep, - tip, - date.ref.pointer); - } - - /// nextWeekendStartDate:interval:options:afterDate: - bool nextWeekendStartDate_interval_options_afterDate_( - ffi.Pointer> datep, - ffi.Pointer tip, - NSCalendarOptions options, - objc.NSDate date) { - return _objc_msgSend_1brdgri( - this.ref.pointer, - _sel_nextWeekendStartDate_interval_options_afterDate_, - datep, - tip, - options.value, - date.ref.pointer); - } - - /// components:fromDateComponents:toDateComponents:options: - NSDateComponents components_fromDateComponents_toDateComponents_options_( - NSCalendarUnit unitFlags, - NSDateComponents startingDateComp, - NSDateComponents resultDateComp, - NSCalendarOptions options) { - final _ret = _objc_msgSend_1jc93x2( - this.ref.pointer, - _sel_components_fromDateComponents_toDateComponents_options_, - unitFlags.value, - startingDateComp.ref.pointer, - resultDateComp.ref.pointer, - options.value); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// dateByAddingUnit:value:toDate:options: - objc.NSDate? dateByAddingUnit_value_toDate_options_(NSCalendarUnit unit, - int value, objc.NSDate date, NSCalendarOptions options) { - final _ret = _objc_msgSend_b1fge4( - this.ref.pointer, - _sel_dateByAddingUnit_value_toDate_options_, - unit.value, - value, - date.ref.pointer, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock: - void enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock_( - objc.NSDate start, - NSDateComponents comps, - NSCalendarOptions opts, - objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - block) { - _objc_msgSend_z9v2cv( - this.ref.pointer, - _sel_enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock_, - start.ref.pointer, - comps.ref.pointer, - opts.value, - block.ref.pointer); - } - - /// nextDateAfterDate:matchingComponents:options: - objc.NSDate? nextDateAfterDate_matchingComponents_options_( - objc.NSDate date, NSDateComponents comps, NSCalendarOptions options) { - final _ret = _objc_msgSend_2sm1zi( - this.ref.pointer, - _sel_nextDateAfterDate_matchingComponents_options_, - date.ref.pointer, - comps.ref.pointer, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// nextDateAfterDate:matchingUnit:value:options: - objc.NSDate? nextDateAfterDate_matchingUnit_value_options_(objc.NSDate date, - NSCalendarUnit unit, int value, NSCalendarOptions options) { - final _ret = _objc_msgSend_1im3h6w( - this.ref.pointer, - _sel_nextDateAfterDate_matchingUnit_value_options_, - date.ref.pointer, - unit.value, - value, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// nextDateAfterDate:matchingHour:minute:second:options: - objc.NSDate? nextDateAfterDate_matchingHour_minute_second_options_( - objc.NSDate date, - int hourValue, - int minuteValue, - int secondValue, - NSCalendarOptions options) { - final _ret = _objc_msgSend_tio5o0( - this.ref.pointer, - _sel_nextDateAfterDate_matchingHour_minute_second_options_, - date.ref.pointer, - hourValue, - minuteValue, - secondValue, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateBySettingUnit:value:ofDate:options: - objc.NSDate? dateBySettingUnit_value_ofDate_options_( - NSCalendarUnit unit, int v, objc.NSDate date, NSCalendarOptions opts) { - final _ret = _objc_msgSend_b1fge4( - this.ref.pointer, - _sel_dateBySettingUnit_value_ofDate_options_, - unit.value, - v, - date.ref.pointer, - opts.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateBySettingHour:minute:second:ofDate:options: - objc.NSDate? dateBySettingHour_minute_second_ofDate_options_( - int h, int m, int s, objc.NSDate date, NSCalendarOptions opts) { - final _ret = _objc_msgSend_16h627a( - this.ref.pointer, - _sel_dateBySettingHour_minute_second_ofDate_options_, - h, - m, - s, - date.ref.pointer, - opts.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// date:matchesComponents: - bool date_matchesComponents_(objc.NSDate date, NSDateComponents components) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_date_matchesComponents_, - date.ref.pointer, components.ref.pointer); - } - - /// new - static NSCalendar new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_new); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSCalendar allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSCalendar, _sel_allocWithZone_, zone); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSCalendar alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_alloc); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSCalendar, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSCalendar, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSCalendar, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSCalendar, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSCalendar, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSCalendar, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSCalendar, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCalendar, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSCalendar self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSCalendar retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSCalendar autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSCalendar, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSCalendar? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSCalendar.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_isLenient = objc.registerName("isLenient"); -late final _sel_setLenient_ = objc.registerName("setLenient:"); -late final _sel_twoDigitStartDate = objc.registerName("twoDigitStartDate"); -late final _sel_setTwoDigitStartDate_ = - objc.registerName("setTwoDigitStartDate:"); -late final _sel_defaultDate = objc.registerName("defaultDate"); -late final _sel_setDefaultDate_ = objc.registerName("setDefaultDate:"); -late final _sel_setEraSymbols_ = objc.registerName("setEraSymbols:"); -late final _sel_setMonthSymbols_ = objc.registerName("setMonthSymbols:"); -late final _sel_setShortMonthSymbols_ = - objc.registerName("setShortMonthSymbols:"); -late final _sel_setWeekdaySymbols_ = objc.registerName("setWeekdaySymbols:"); -late final _sel_setShortWeekdaySymbols_ = - objc.registerName("setShortWeekdaySymbols:"); -late final _sel_setAMSymbol_ = objc.registerName("setAMSymbol:"); -late final _sel_setPMSymbol_ = objc.registerName("setPMSymbol:"); -late final _sel_setLongEraSymbols_ = objc.registerName("setLongEraSymbols:"); -late final _sel_setVeryShortMonthSymbols_ = - objc.registerName("setVeryShortMonthSymbols:"); -late final _sel_setStandaloneMonthSymbols_ = - objc.registerName("setStandaloneMonthSymbols:"); -late final _sel_setShortStandaloneMonthSymbols_ = - objc.registerName("setShortStandaloneMonthSymbols:"); -late final _sel_setVeryShortStandaloneMonthSymbols_ = - objc.registerName("setVeryShortStandaloneMonthSymbols:"); -late final _sel_setVeryShortWeekdaySymbols_ = - objc.registerName("setVeryShortWeekdaySymbols:"); -late final _sel_setStandaloneWeekdaySymbols_ = - objc.registerName("setStandaloneWeekdaySymbols:"); -late final _sel_setShortStandaloneWeekdaySymbols_ = - objc.registerName("setShortStandaloneWeekdaySymbols:"); -late final _sel_setVeryShortStandaloneWeekdaySymbols_ = - objc.registerName("setVeryShortStandaloneWeekdaySymbols:"); -late final _sel_setQuarterSymbols_ = objc.registerName("setQuarterSymbols:"); -late final _sel_setShortQuarterSymbols_ = - objc.registerName("setShortQuarterSymbols:"); -late final _sel_setStandaloneQuarterSymbols_ = - objc.registerName("setStandaloneQuarterSymbols:"); -late final _sel_setShortStandaloneQuarterSymbols_ = - objc.registerName("setShortStandaloneQuarterSymbols:"); -late final _sel_gregorianStartDate = objc.registerName("gregorianStartDate"); -late final _sel_setGregorianStartDate_ = - objc.registerName("setGregorianStartDate:"); -late final _sel_doesRelativeDateFormatting = - objc.registerName("doesRelativeDateFormatting"); -late final _sel_setDoesRelativeDateFormatting_ = - objc.registerName("setDoesRelativeDateFormatting:"); -late final _sel_initWithDateFormat_allowNaturalLanguage_ = - objc.registerName("initWithDateFormat:allowNaturalLanguage:"); -final _objc_msgSend_qqbb5y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_allowsNaturalLanguage = - objc.registerName("allowsNaturalLanguage"); - -/// NSDateFormatter -class NSDateFormatter extends NSFormatter { - NSDateFormatter._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDateFormatter] that points to the same underlying object as [other]. - NSDateFormatter.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDateFormatter] that wraps the given raw object pointer. - NSDateFormatter.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDateFormatter]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDateFormatter); - } - - /// formattingContext - NSFormattingContext get formattingContext { - final _ret = - _objc_msgSend_10wicfq(this.ref.pointer, _sel_formattingContext); - return NSFormattingContext.fromValue(_ret); - } - - /// setFormattingContext: - set formattingContext(NSFormattingContext value) { - return _objc_msgSend_1gtwv7x( - this.ref.pointer, _sel_setFormattingContext_, value.value); - } - - /// getObjectValue:forString:range:error: - bool getObjectValue_forString_range_error_( - ffi.Pointer> obj, - objc.NSString string, - ffi.Pointer rangep, - ffi.Pointer> error) { - return _objc_msgSend_bl9kx( - this.ref.pointer, - _sel_getObjectValue_forString_range_error_, - obj, - string.ref.pointer, - rangep, - error); - } - - /// stringFromDate: - objc.NSString stringFromDate_(objc.NSDate date) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_stringFromDate_, date.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dateFromString: - objc.NSDate? dateFromString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dateFromString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedStringFromDate:dateStyle:timeStyle: - static objc.NSString localizedStringFromDate_dateStyle_timeStyle_( - objc.NSDate date, - NSDateFormatterStyle dstyle, - NSDateFormatterStyle tstyle) { - final _ret = _objc_msgSend_1sgexgh( - _class_NSDateFormatter, - _sel_localizedStringFromDate_dateStyle_timeStyle_, - date.ref.pointer, - dstyle.value, - tstyle.value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dateFormatFromTemplate:options:locale: - static objc.NSString? dateFormatFromTemplate_options_locale_( - objc.NSString tmplate, int opts, objc.NSLocale? locale) { - final _ret = _objc_msgSend_1czjmpk( - _class_NSDateFormatter, - _sel_dateFormatFromTemplate_options_locale_, - tmplate.ref.pointer, - opts, - locale?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultFormatterBehavior - static NSDateFormatterBehavior getDefaultFormatterBehavior() { - final _ret = _objc_msgSend_ti9wzk( - _class_NSDateFormatter, _sel_defaultFormatterBehavior); - return NSDateFormatterBehavior.fromValue(_ret); - } - - /// setDefaultFormatterBehavior: - static void setDefaultFormatterBehavior(NSDateFormatterBehavior value) { - return _objc_msgSend_ffb1q7( - _class_NSDateFormatter, _sel_setDefaultFormatterBehavior_, value.value); - } - - /// setLocalizedDateFormatFromTemplate: - void setLocalizedDateFormatFromTemplate_(objc.NSString dateFormatTemplate) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setLocalizedDateFormatFromTemplate_, - dateFormatTemplate.ref.pointer); - } - - /// dateFormat - objc.NSString get dateFormat { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dateFormat); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setDateFormat: - set dateFormat(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDateFormat_, value.ref.pointer); - } - - /// dateStyle - NSDateFormatterStyle get dateStyle { - final _ret = _objc_msgSend_r4ksf1(this.ref.pointer, _sel_dateStyle); - return NSDateFormatterStyle.fromValue(_ret); - } - - /// setDateStyle: - set dateStyle(NSDateFormatterStyle value) { - return _objc_msgSend_7hnqfw( - this.ref.pointer, _sel_setDateStyle_, value.value); - } - - /// timeStyle - NSDateFormatterStyle get timeStyle { - final _ret = _objc_msgSend_r4ksf1(this.ref.pointer, _sel_timeStyle); - return NSDateFormatterStyle.fromValue(_ret); - } - - /// setTimeStyle: - set timeStyle(NSDateFormatterStyle value) { - return _objc_msgSend_7hnqfw( - this.ref.pointer, _sel_setTimeStyle_, value.value); - } - - /// locale - objc.NSLocale get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return objc.NSLocale.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.NSLocale value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value.ref.pointer); - } - - /// generatesCalendarDates - bool get generatesCalendarDates { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_generatesCalendarDates); - } - - /// setGeneratesCalendarDates: - set generatesCalendarDates(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setGeneratesCalendarDates_, value); - } - - /// formatterBehavior - NSDateFormatterBehavior get formatterBehavior { - final _ret = _objc_msgSend_ti9wzk(this.ref.pointer, _sel_formatterBehavior); - return NSDateFormatterBehavior.fromValue(_ret); - } - - /// setFormatterBehavior: - set formatterBehavior(NSDateFormatterBehavior value) { - return _objc_msgSend_ffb1q7( - this.ref.pointer, _sel_setFormatterBehavior_, value.value); - } - - /// timeZone - NSTimeZone get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setTimeZone: - set timeZone(NSTimeZone value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setTimeZone_, value.ref.pointer); - } - - /// calendar - NSCalendar get calendar { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_calendar); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// setCalendar: - set calendar(NSCalendar value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCalendar_, value.ref.pointer); - } - - /// isLenient - bool get lenient { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLenient); - } - - /// setLenient: - set lenient(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setLenient_, value); - } - - /// twoDigitStartDate - objc.NSDate? get twoDigitStartDate { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_twoDigitStartDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setTwoDigitStartDate: - set twoDigitStartDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setTwoDigitStartDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// defaultDate - objc.NSDate? get defaultDate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_defaultDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setDefaultDate: - set defaultDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDefaultDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// eraSymbols - objc.NSArray get eraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_eraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setEraSymbols: - set eraSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setEraSymbols_, value.ref.pointer); - } - - /// monthSymbols - objc.NSArray get monthSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_monthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setMonthSymbols: - set monthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMonthSymbols_, value.ref.pointer); - } - - /// shortMonthSymbols - objc.NSArray get shortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortMonthSymbols: - set shortMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setShortMonthSymbols_, value.ref.pointer); - } - - /// weekdaySymbols - objc.NSArray get weekdaySymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_weekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setWeekdaySymbols: - set weekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setWeekdaySymbols_, value.ref.pointer); - } - - /// shortWeekdaySymbols - objc.NSArray get shortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortWeekdaySymbols: - set shortWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setShortWeekdaySymbols_, value.ref.pointer); - } - - /// AMSymbol - objc.NSString get AMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_AMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setAMSymbol: - set AMSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAMSymbol_, value.ref.pointer); - } - - /// PMSymbol - objc.NSString get PMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_PMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPMSymbol: - set PMSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPMSymbol_, value.ref.pointer); - } - - /// longEraSymbols - objc.NSArray get longEraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_longEraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setLongEraSymbols: - set longEraSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLongEraSymbols_, value.ref.pointer); - } - - /// veryShortMonthSymbols - objc.NSArray get veryShortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortMonthSymbols: - set veryShortMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setVeryShortMonthSymbols_, value.ref.pointer); - } - - /// standaloneMonthSymbols - objc.NSArray get standaloneMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setStandaloneMonthSymbols: - set standaloneMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setStandaloneMonthSymbols_, value.ref.pointer); - } - - /// shortStandaloneMonthSymbols - objc.NSArray get shortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortStandaloneMonthSymbols: - set shortStandaloneMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setShortStandaloneMonthSymbols_, value.ref.pointer); - } - - /// veryShortStandaloneMonthSymbols - objc.NSArray get veryShortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortStandaloneMonthSymbols: - set veryShortStandaloneMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setVeryShortStandaloneMonthSymbols_, value.ref.pointer); - } - - /// veryShortWeekdaySymbols - objc.NSArray get veryShortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortWeekdaySymbols: - set veryShortWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setVeryShortWeekdaySymbols_, value.ref.pointer); - } - - /// standaloneWeekdaySymbols - objc.NSArray get standaloneWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setStandaloneWeekdaySymbols: - set standaloneWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setStandaloneWeekdaySymbols_, value.ref.pointer); - } - - /// shortStandaloneWeekdaySymbols - objc.NSArray get shortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortStandaloneWeekdaySymbols: - set shortStandaloneWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setShortStandaloneWeekdaySymbols_, value.ref.pointer); - } - - /// veryShortStandaloneWeekdaySymbols - objc.NSArray get veryShortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortStandaloneWeekdaySymbols: - set veryShortStandaloneWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setVeryShortStandaloneWeekdaySymbols_, value.ref.pointer); - } - - /// quarterSymbols - objc.NSArray get quarterSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_quarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setQuarterSymbols: - set quarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setQuarterSymbols_, value.ref.pointer); - } - - /// shortQuarterSymbols - objc.NSArray get shortQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortQuarterSymbols: - set shortQuarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setShortQuarterSymbols_, value.ref.pointer); - } - - /// standaloneQuarterSymbols - objc.NSArray get standaloneQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setStandaloneQuarterSymbols: - set standaloneQuarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setStandaloneQuarterSymbols_, value.ref.pointer); - } - - /// shortStandaloneQuarterSymbols - objc.NSArray get shortStandaloneQuarterSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortStandaloneQuarterSymbols: - set shortStandaloneQuarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setShortStandaloneQuarterSymbols_, value.ref.pointer); - } - - /// gregorianStartDate - objc.NSDate? get gregorianStartDate { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_gregorianStartDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setGregorianStartDate: - set gregorianStartDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setGregorianStartDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// doesRelativeDateFormatting - bool get doesRelativeDateFormatting { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_doesRelativeDateFormatting); - } - - /// setDoesRelativeDateFormatting: - set doesRelativeDateFormatting(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setDoesRelativeDateFormatting_, value); - } - - /// initWithDateFormat:allowNaturalLanguage: - objc.ObjCObjectBase initWithDateFormat_allowNaturalLanguage_( - objc.NSString format, bool flag) { - final _ret = _objc_msgSend_qqbb5y( - this.ref.retainAndReturnPointer(), - _sel_initWithDateFormat_allowNaturalLanguage_, - format.ref.pointer, - flag); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// allowsNaturalLanguage - bool allowsNaturalLanguage() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsNaturalLanguage); - } - - /// init - NSDateFormatter init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSDateFormatter new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateFormatter, _sel_new); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSDateFormatter allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDateFormatter, _sel_allocWithZone_, zone); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSDateFormatter alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateFormatter, _sel_alloc); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDateFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDateFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDateFormatter, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSDateFormatter, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDateFormatter, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDateFormatter, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDateFormatter, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateFormatter, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateFormatter, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSDateFormatter self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDateFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSDateFormatter retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDateFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSDateFormatter autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDateFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithCoder: - NSDateFormatter? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSNumberFormatter = objc.getClass("NSNumberFormatter"); -late final _sel_stringFromNumber_ = objc.registerName("stringFromNumber:"); -late final _sel_numberFromString_ = objc.registerName("numberFromString:"); - -enum NSNumberFormatterStyle { - NSNumberFormatterNoStyle(0), - NSNumberFormatterDecimalStyle(1), - NSNumberFormatterCurrencyStyle(2), - NSNumberFormatterPercentStyle(3), - NSNumberFormatterScientificStyle(4), - NSNumberFormatterSpellOutStyle(5), - NSNumberFormatterOrdinalStyle(6), - NSNumberFormatterCurrencyISOCodeStyle(8), - NSNumberFormatterCurrencyPluralStyle(9), - NSNumberFormatterCurrencyAccountingStyle(10); - - final int value; - const NSNumberFormatterStyle(this.value); - - static NSNumberFormatterStyle fromValue(int value) => switch (value) { - 0 => NSNumberFormatterNoStyle, - 1 => NSNumberFormatterDecimalStyle, - 2 => NSNumberFormatterCurrencyStyle, - 3 => NSNumberFormatterPercentStyle, - 4 => NSNumberFormatterScientificStyle, - 5 => NSNumberFormatterSpellOutStyle, - 6 => NSNumberFormatterOrdinalStyle, - 8 => NSNumberFormatterCurrencyISOCodeStyle, - 9 => NSNumberFormatterCurrencyPluralStyle, - 10 => NSNumberFormatterCurrencyAccountingStyle, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterStyle: $value"), - }; -} - -late final _sel_localizedStringFromNumber_numberStyle_ = - objc.registerName("localizedStringFromNumber:numberStyle:"); -final _objc_msgSend_1dsaaq7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); - -enum NSNumberFormatterBehavior { - NSNumberFormatterBehaviorDefault(0), - NSNumberFormatterBehavior10_0(1000), - NSNumberFormatterBehavior10_4(1040); - - final int value; - const NSNumberFormatterBehavior(this.value); - - static NSNumberFormatterBehavior fromValue(int value) => switch (value) { - 0 => NSNumberFormatterBehaviorDefault, - 1000 => NSNumberFormatterBehavior10_0, - 1040 => NSNumberFormatterBehavior10_4, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterBehavior: $value"), - }; -} - -final _objc_msgSend_1nvfxwt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1p18hg0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberStyle = objc.registerName("numberStyle"); -final _objc_msgSend_1we0qxe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setNumberStyle_ = objc.registerName("setNumberStyle:"); -final _objc_msgSend_qp19lh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_generatesDecimalNumbers = - objc.registerName("generatesDecimalNumbers"); -late final _sel_setGeneratesDecimalNumbers_ = - objc.registerName("setGeneratesDecimalNumbers:"); -late final _sel_negativeFormat = objc.registerName("negativeFormat"); -late final _sel_setNegativeFormat_ = objc.registerName("setNegativeFormat:"); -late final _sel_textAttributesForNegativeValues = - objc.registerName("textAttributesForNegativeValues"); -late final _sel_setTextAttributesForNegativeValues_ = - objc.registerName("setTextAttributesForNegativeValues:"); -late final _sel_positiveFormat = objc.registerName("positiveFormat"); -late final _sel_setPositiveFormat_ = objc.registerName("setPositiveFormat:"); -late final _sel_textAttributesForPositiveValues = - objc.registerName("textAttributesForPositiveValues"); -late final _sel_setTextAttributesForPositiveValues_ = - objc.registerName("setTextAttributesForPositiveValues:"); -late final _sel_allowsFloats = objc.registerName("allowsFloats"); -late final _sel_setAllowsFloats_ = objc.registerName("setAllowsFloats:"); -late final _sel_decimalSeparator = objc.registerName("decimalSeparator"); -late final _sel_setDecimalSeparator_ = - objc.registerName("setDecimalSeparator:"); -late final _sel_alwaysShowsDecimalSeparator = - objc.registerName("alwaysShowsDecimalSeparator"); -late final _sel_setAlwaysShowsDecimalSeparator_ = - objc.registerName("setAlwaysShowsDecimalSeparator:"); -late final _sel_currencyDecimalSeparator = - objc.registerName("currencyDecimalSeparator"); -late final _sel_setCurrencyDecimalSeparator_ = - objc.registerName("setCurrencyDecimalSeparator:"); -late final _sel_usesGroupingSeparator = - objc.registerName("usesGroupingSeparator"); -late final _sel_setUsesGroupingSeparator_ = - objc.registerName("setUsesGroupingSeparator:"); -late final _sel_groupingSeparator = objc.registerName("groupingSeparator"); -late final _sel_setGroupingSeparator_ = - objc.registerName("setGroupingSeparator:"); -late final _sel_zeroSymbol = objc.registerName("zeroSymbol"); -late final _sel_setZeroSymbol_ = objc.registerName("setZeroSymbol:"); -late final _sel_textAttributesForZero = - objc.registerName("textAttributesForZero"); -late final _sel_setTextAttributesForZero_ = - objc.registerName("setTextAttributesForZero:"); -late final _sel_nilSymbol = objc.registerName("nilSymbol"); -late final _sel_setNilSymbol_ = objc.registerName("setNilSymbol:"); -late final _sel_textAttributesForNil = - objc.registerName("textAttributesForNil"); -late final _sel_setTextAttributesForNil_ = - objc.registerName("setTextAttributesForNil:"); -late final _sel_notANumberSymbol = objc.registerName("notANumberSymbol"); -late final _sel_setNotANumberSymbol_ = - objc.registerName("setNotANumberSymbol:"); -late final _sel_textAttributesForNotANumber = - objc.registerName("textAttributesForNotANumber"); -late final _sel_setTextAttributesForNotANumber_ = - objc.registerName("setTextAttributesForNotANumber:"); -late final _sel_positiveInfinitySymbol = - objc.registerName("positiveInfinitySymbol"); -late final _sel_setPositiveInfinitySymbol_ = - objc.registerName("setPositiveInfinitySymbol:"); -late final _sel_textAttributesForPositiveInfinity = - objc.registerName("textAttributesForPositiveInfinity"); -late final _sel_setTextAttributesForPositiveInfinity_ = - objc.registerName("setTextAttributesForPositiveInfinity:"); -late final _sel_negativeInfinitySymbol = - objc.registerName("negativeInfinitySymbol"); -late final _sel_setNegativeInfinitySymbol_ = - objc.registerName("setNegativeInfinitySymbol:"); -late final _sel_textAttributesForNegativeInfinity = - objc.registerName("textAttributesForNegativeInfinity"); -late final _sel_setTextAttributesForNegativeInfinity_ = - objc.registerName("setTextAttributesForNegativeInfinity:"); -late final _sel_positivePrefix = objc.registerName("positivePrefix"); -late final _sel_setPositivePrefix_ = objc.registerName("setPositivePrefix:"); -late final _sel_positiveSuffix = objc.registerName("positiveSuffix"); -late final _sel_setPositiveSuffix_ = objc.registerName("setPositiveSuffix:"); -late final _sel_negativePrefix = objc.registerName("negativePrefix"); -late final _sel_setNegativePrefix_ = objc.registerName("setNegativePrefix:"); -late final _sel_negativeSuffix = objc.registerName("negativeSuffix"); -late final _sel_setNegativeSuffix_ = objc.registerName("setNegativeSuffix:"); -late final _sel_currencyCode = objc.registerName("currencyCode"); -late final _sel_setCurrencyCode_ = objc.registerName("setCurrencyCode:"); -late final _sel_currencySymbol = objc.registerName("currencySymbol"); -late final _sel_setCurrencySymbol_ = objc.registerName("setCurrencySymbol:"); -late final _sel_internationalCurrencySymbol = - objc.registerName("internationalCurrencySymbol"); -late final _sel_setInternationalCurrencySymbol_ = - objc.registerName("setInternationalCurrencySymbol:"); -late final _sel_percentSymbol = objc.registerName("percentSymbol"); -late final _sel_setPercentSymbol_ = objc.registerName("setPercentSymbol:"); -late final _sel_perMillSymbol = objc.registerName("perMillSymbol"); -late final _sel_setPerMillSymbol_ = objc.registerName("setPerMillSymbol:"); -late final _sel_minusSign = objc.registerName("minusSign"); -late final _sel_setMinusSign_ = objc.registerName("setMinusSign:"); -late final _sel_plusSign = objc.registerName("plusSign"); -late final _sel_setPlusSign_ = objc.registerName("setPlusSign:"); -late final _sel_exponentSymbol = objc.registerName("exponentSymbol"); -late final _sel_setExponentSymbol_ = objc.registerName("setExponentSymbol:"); -late final _sel_groupingSize = objc.registerName("groupingSize"); -late final _sel_setGroupingSize_ = objc.registerName("setGroupingSize:"); -late final _sel_secondaryGroupingSize = - objc.registerName("secondaryGroupingSize"); -late final _sel_setSecondaryGroupingSize_ = - objc.registerName("setSecondaryGroupingSize:"); -late final _sel_multiplier = objc.registerName("multiplier"); -late final _sel_setMultiplier_ = objc.registerName("setMultiplier:"); -late final _sel_formatWidth = objc.registerName("formatWidth"); -late final _sel_setFormatWidth_ = objc.registerName("setFormatWidth:"); -late final _sel_paddingCharacter = objc.registerName("paddingCharacter"); -late final _sel_setPaddingCharacter_ = - objc.registerName("setPaddingCharacter:"); - -enum NSNumberFormatterPadPosition { - NSNumberFormatterPadBeforePrefix(0), - NSNumberFormatterPadAfterPrefix(1), - NSNumberFormatterPadBeforeSuffix(2), - NSNumberFormatterPadAfterSuffix(3); - - final int value; - const NSNumberFormatterPadPosition(this.value); - - static NSNumberFormatterPadPosition fromValue(int value) => switch (value) { - 0 => NSNumberFormatterPadBeforePrefix, - 1 => NSNumberFormatterPadAfterPrefix, - 2 => NSNumberFormatterPadBeforeSuffix, - 3 => NSNumberFormatterPadAfterSuffix, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterPadPosition: $value"), - }; -} - -late final _sel_paddingPosition = objc.registerName("paddingPosition"); -final _objc_msgSend_1s69i33 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPaddingPosition_ = objc.registerName("setPaddingPosition:"); -final _objc_msgSend_gz8txq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSNumberFormatterRoundingMode { - NSNumberFormatterRoundCeiling(0), - NSNumberFormatterRoundFloor(1), - NSNumberFormatterRoundDown(2), - NSNumberFormatterRoundUp(3), - NSNumberFormatterRoundHalfEven(4), - NSNumberFormatterRoundHalfDown(5), - NSNumberFormatterRoundHalfUp(6); - - final int value; - const NSNumberFormatterRoundingMode(this.value); - - static NSNumberFormatterRoundingMode fromValue(int value) => switch (value) { - 0 => NSNumberFormatterRoundCeiling, - 1 => NSNumberFormatterRoundFloor, - 2 => NSNumberFormatterRoundDown, - 3 => NSNumberFormatterRoundUp, - 4 => NSNumberFormatterRoundHalfEven, - 5 => NSNumberFormatterRoundHalfDown, - 6 => NSNumberFormatterRoundHalfUp, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterRoundingMode: $value"), - }; -} - -late final _sel_roundingMode = objc.registerName("roundingMode"); -final _objc_msgSend_38d07q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setRoundingMode_ = objc.registerName("setRoundingMode:"); -final _objc_msgSend_5krs29 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_roundingIncrement = objc.registerName("roundingIncrement"); -late final _sel_setRoundingIncrement_ = - objc.registerName("setRoundingIncrement:"); -late final _sel_minimumIntegerDigits = - objc.registerName("minimumIntegerDigits"); -late final _sel_setMinimumIntegerDigits_ = - objc.registerName("setMinimumIntegerDigits:"); -late final _sel_maximumIntegerDigits = - objc.registerName("maximumIntegerDigits"); -late final _sel_setMaximumIntegerDigits_ = - objc.registerName("setMaximumIntegerDigits:"); -late final _sel_minimumFractionDigits = - objc.registerName("minimumFractionDigits"); -late final _sel_setMinimumFractionDigits_ = - objc.registerName("setMinimumFractionDigits:"); -late final _sel_maximumFractionDigits = - objc.registerName("maximumFractionDigits"); -late final _sel_setMaximumFractionDigits_ = - objc.registerName("setMaximumFractionDigits:"); -late final _sel_minimum = objc.registerName("minimum"); -late final _sel_setMinimum_ = objc.registerName("setMinimum:"); -late final _sel_maximum = objc.registerName("maximum"); -late final _sel_setMaximum_ = objc.registerName("setMaximum:"); -late final _sel_currencyGroupingSeparator = - objc.registerName("currencyGroupingSeparator"); -late final _sel_setCurrencyGroupingSeparator_ = - objc.registerName("setCurrencyGroupingSeparator:"); -late final _sel_usesSignificantDigits = - objc.registerName("usesSignificantDigits"); -late final _sel_setUsesSignificantDigits_ = - objc.registerName("setUsesSignificantDigits:"); -late final _sel_minimumSignificantDigits = - objc.registerName("minimumSignificantDigits"); -late final _sel_setMinimumSignificantDigits_ = - objc.registerName("setMinimumSignificantDigits:"); -late final _sel_maximumSignificantDigits = - objc.registerName("maximumSignificantDigits"); -late final _sel_setMaximumSignificantDigits_ = - objc.registerName("setMaximumSignificantDigits:"); -late final _sel_isPartialStringValidationEnabled = - objc.registerName("isPartialStringValidationEnabled"); -late final _sel_setPartialStringValidationEnabled_ = - objc.registerName("setPartialStringValidationEnabled:"); -late final _sel_hasThousandSeparators = - objc.registerName("hasThousandSeparators"); -late final _sel_setHasThousandSeparators_ = - objc.registerName("setHasThousandSeparators:"); -late final _sel_thousandSeparator = objc.registerName("thousandSeparator"); -late final _sel_setThousandSeparator_ = - objc.registerName("setThousandSeparator:"); -late final _sel_localizesFormat = objc.registerName("localizesFormat"); -late final _sel_setLocalizesFormat_ = objc.registerName("setLocalizesFormat:"); -late final _sel_format = objc.registerName("format"); -late final _sel_setFormat_ = objc.registerName("setFormat:"); -late final _sel_attributedStringForZero = - objc.registerName("attributedStringForZero"); -late final _sel_setAttributedStringForZero_ = - objc.registerName("setAttributedStringForZero:"); -late final _sel_attributedStringForNil = - objc.registerName("attributedStringForNil"); -late final _sel_setAttributedStringForNil_ = - objc.registerName("setAttributedStringForNil:"); -late final _sel_attributedStringForNotANumber = - objc.registerName("attributedStringForNotANumber"); -late final _sel_setAttributedStringForNotANumber_ = - objc.registerName("setAttributedStringForNotANumber:"); -late final _class_NSDecimalNumberHandler = - objc.getClass("NSDecimalNumberHandler"); - -enum NSRoundingMode { - NSRoundPlain(0), - NSRoundDown(1), - NSRoundUp(2), - NSRoundBankers(3); - - final int value; - const NSRoundingMode(this.value); - - static NSRoundingMode fromValue(int value) => switch (value) { - 0 => NSRoundPlain, - 1 => NSRoundDown, - 2 => NSRoundUp, - 3 => NSRoundBankers, - _ => throw ArgumentError("Unknown value for NSRoundingMode: $value"), - }; -} - -final _objc_msgSend_1iugf7h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -int _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrTrampoline, 0) - .cast(); -int _ObjCBlock_NSRoundingMode_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSRoundingMode_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSRoundingMode_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSRoundingMode_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(NSRoundingMode Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSRoundingMode_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0).value), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSRoundingMode_ffiVoid_CallExtension - on objc.ObjCBlock)> { - NSRoundingMode call(ffi.Pointer arg0) => - NSRoundingMode.fromValue(ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0)); -} - -late final _sel_scale = objc.registerName("scale"); -final _objc_msgSend_157j54x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -int _ObjCBlock_ffiShort_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi - .NativeFunction arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiShort_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Short Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiShort_ffiVoid_fnPtrTrampoline, 0) - .cast(); -int _ObjCBlock_ffiShort_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiShort_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Short Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiShort_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiShort_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiShort_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - int Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock(_ObjCBlock_ffiShort_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiShort_ffiVoid_CallExtension - on objc.ObjCBlock)> { - int call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _class_NSDecimalNumber = objc.getClass("NSDecimalNumber"); -late final _sel_initWithMantissa_exponent_isNegative_ = - objc.registerName("initWithMantissa:exponent:isNegative:"); -final _objc_msgSend_1f2l7cc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLongLong, - ffi.Short, - ffi.Bool)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, int, bool)>(); -late final _sel_initWithString_locale_ = - objc.registerName("initWithString:locale:"); -late final _sel_descriptionWithLocale_ = - objc.registerName("descriptionWithLocale:"); -late final _sel_decimalNumberWithMantissa_exponent_isNegative_ = - objc.registerName("decimalNumberWithMantissa:exponent:isNegative:"); -late final _sel_decimalNumberWithString_ = - objc.registerName("decimalNumberWithString:"); -late final _sel_decimalNumberWithString_locale_ = - objc.registerName("decimalNumberWithString:locale:"); -late final _sel_zero = objc.registerName("zero"); -late final _sel_one = objc.registerName("one"); -late final _sel_minimumDecimalNumber = - objc.registerName("minimumDecimalNumber"); -late final _sel_maximumDecimalNumber = - objc.registerName("maximumDecimalNumber"); -late final _sel_notANumber = objc.registerName("notANumber"); -late final _sel_decimalNumberByAdding_ = - objc.registerName("decimalNumberByAdding:"); -late final _sel_decimalNumberByAdding_withBehavior_ = - objc.registerName("decimalNumberByAdding:withBehavior:"); -late final _sel_decimalNumberBySubtracting_ = - objc.registerName("decimalNumberBySubtracting:"); -late final _sel_decimalNumberBySubtracting_withBehavior_ = - objc.registerName("decimalNumberBySubtracting:withBehavior:"); -late final _sel_decimalNumberByMultiplyingBy_ = - objc.registerName("decimalNumberByMultiplyingBy:"); -late final _sel_decimalNumberByMultiplyingBy_withBehavior_ = - objc.registerName("decimalNumberByMultiplyingBy:withBehavior:"); -late final _sel_decimalNumberByDividingBy_ = - objc.registerName("decimalNumberByDividingBy:"); -late final _sel_decimalNumberByDividingBy_withBehavior_ = - objc.registerName("decimalNumberByDividingBy:withBehavior:"); -late final _sel_decimalNumberByRaisingToPower_ = - objc.registerName("decimalNumberByRaisingToPower:"); -final _objc_msgSend_ehxl2g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_decimalNumberByRaisingToPower_withBehavior_ = - objc.registerName("decimalNumberByRaisingToPower:withBehavior:"); -final _objc_msgSend_m23d4r = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_decimalNumberByMultiplyingByPowerOf10_ = - objc.registerName("decimalNumberByMultiplyingByPowerOf10:"); -final _objc_msgSend_15di41h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Short)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_decimalNumberByMultiplyingByPowerOf10_withBehavior_ = - objc.registerName("decimalNumberByMultiplyingByPowerOf10:withBehavior:"); -final _objc_msgSend_1y5v0cu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Short, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_decimalNumberByRoundingAccordingToBehavior_ = - objc.registerName("decimalNumberByRoundingAccordingToBehavior:"); -late final _sel_compare_ = objc.registerName("compare:"); -final _objc_msgSend_1ile2ev = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_defaultBehavior = objc.registerName("defaultBehavior"); -late final _sel_setDefaultBehavior_ = objc.registerName("setDefaultBehavior:"); -late final _sel_objCType = objc.registerName("objCType"); -final _objc_msgSend_1ypnhm3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_doubleValue = objc.registerName("doubleValue"); -late final _sel_numberWithChar_ = objc.registerName("numberWithChar:"); -final _objc_msgSend_1pfmxrb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Char)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithUnsignedChar_ = - objc.registerName("numberWithUnsignedChar:"); -final _objc_msgSend_1ar9f5m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedChar)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithShort_ = objc.registerName("numberWithShort:"); -late final _sel_numberWithUnsignedShort_ = - objc.registerName("numberWithUnsignedShort:"); -final _objc_msgSend_122gbai = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedShort)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithInt_ = objc.registerName("numberWithInt:"); -final _objc_msgSend_105o5we = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithUnsignedInt_ = - objc.registerName("numberWithUnsignedInt:"); -final _objc_msgSend_pxgym4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithLong_ = objc.registerName("numberWithLong:"); -late final _sel_numberWithUnsignedLong_ = - objc.registerName("numberWithUnsignedLong:"); -late final _sel_numberWithLongLong_ = objc.registerName("numberWithLongLong:"); -final _objc_msgSend_yjzv9z = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.LongLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithUnsignedLongLong_ = - objc.registerName("numberWithUnsignedLongLong:"); -final _objc_msgSend_ybbscc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLongLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithFloat_ = objc.registerName("numberWithFloat:"); -final _objc_msgSend_1pmj399 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Float)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_numberWithDouble_ = objc.registerName("numberWithDouble:"); -final _objc_msgSend_m7jc8y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Double)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_numberWithBool_ = objc.registerName("numberWithBool:"); -final _objc_msgSend_1upz917 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Bool)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, bool)>(); -late final _sel_numberWithInteger_ = objc.registerName("numberWithInteger:"); -late final _sel_numberWithUnsignedInteger_ = - objc.registerName("numberWithUnsignedInteger:"); -late final _sel_initWithBytes_objCType_ = - objc.registerName("initWithBytes:objCType:"); -final _objc_msgSend_1sdw29g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_valueWithBytes_objCType_ = - objc.registerName("valueWithBytes:objCType:"); -late final _sel_value_withObjCType_ = objc.registerName("value:withObjCType:"); -late final _sel_valueWithNonretainedObject_ = - objc.registerName("valueWithNonretainedObject:"); -late final _sel_valueWithPointer_ = objc.registerName("valueWithPointer:"); -final _objc_msgSend_1ph8ubj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_valueWithRange_ = objc.registerName("valueWithRange:"); - -final class CGPoint extends ffi.Struct { - @ffi.Double() - external double x; - - @ffi.Double() - external double y; -} - -late final _sel_valueWithPoint_ = objc.registerName("valueWithPoint:"); -final _objc_msgSend_1xj0srq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGPoint)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGPoint)>(); - -final class CGSize extends ffi.Struct { - @ffi.Double() - external double width; - - @ffi.Double() - external double height; -} - -late final _sel_valueWithSize_ = objc.registerName("valueWithSize:"); -final _objc_msgSend_fnn627 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGSize)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGSize)>(); - -final class CGRect extends ffi.Struct { - external CGPoint origin; - - external CGSize size; -} - -late final _sel_valueWithRect_ = objc.registerName("valueWithRect:"); -final _objc_msgSend_14yq09w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGRect)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGRect)>(); - -final class NSEdgeInsets extends ffi.Struct { - @ffi.Double() - external double top; - - @ffi.Double() - external double left; - - @ffi.Double() - external double bottom; - - @ffi.Double() - external double right; -} - -late final _sel_valueWithEdgeInsets_ = - objc.registerName("valueWithEdgeInsets:"); -final _objc_msgSend_12s6yn4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, NSEdgeInsets)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, NSEdgeInsets)>(); - -/// NSDecimalNumber -class NSDecimalNumber extends objc.NSNumber { - NSDecimalNumber._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDecimalNumber] that points to the same underlying object as [other]. - NSDecimalNumber.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDecimalNumber] that wraps the given raw object pointer. - NSDecimalNumber.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDecimalNumber]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDecimalNumber); - } - - /// initWithMantissa:exponent:isNegative: - NSDecimalNumber initWithMantissa_exponent_isNegative_( - int mantissa, int exponent, bool flag) { - final _ret = _objc_msgSend_1f2l7cc(this.ref.retainAndReturnPointer(), - _sel_initWithMantissa_exponent_isNegative_, mantissa, exponent, flag); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithString: - NSDecimalNumber initWithString_(objc.NSString? numberValue) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, numberValue?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithString:locale: - NSDecimalNumber initWithString_locale_( - objc.NSString? numberValue, objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithString_locale_, - numberValue?.ref.pointer ?? ffi.nullptr, - locale?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// descriptionWithLocale: - objc.NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberWithMantissa:exponent:isNegative: - static NSDecimalNumber decimalNumberWithMantissa_exponent_isNegative_( - int mantissa, int exponent, bool flag) { - final _ret = _objc_msgSend_1f2l7cc( - _class_NSDecimalNumber, - _sel_decimalNumberWithMantissa_exponent_isNegative_, - mantissa, - exponent, - flag); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberWithString: - static NSDecimalNumber decimalNumberWithString_(objc.NSString? numberValue) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumber, - _sel_decimalNumberWithString_, numberValue?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberWithString:locale: - static NSDecimalNumber decimalNumberWithString_locale_( - objc.NSString? numberValue, objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_iq11qg( - _class_NSDecimalNumber, - _sel_decimalNumberWithString_locale_, - numberValue?.ref.pointer ?? ffi.nullptr, - locale?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// zero - static NSDecimalNumber getZero() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_zero); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// one - static NSDecimalNumber getOne() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_one); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// minimumDecimalNumber - static NSDecimalNumber getMinimumDecimalNumber() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_minimumDecimalNumber); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// maximumDecimalNumber - static NSDecimalNumber getMaximumDecimalNumber() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_maximumDecimalNumber); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// notANumber - static NSDecimalNumber getNotANumber() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_notANumber); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByAdding: - NSDecimalNumber decimalNumberByAdding_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberByAdding_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByAdding:withBehavior: - NSDecimalNumber decimalNumberByAdding_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberByAdding_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberBySubtracting: - NSDecimalNumber decimalNumberBySubtracting_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberBySubtracting_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberBySubtracting:withBehavior: - NSDecimalNumber decimalNumberBySubtracting_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberBySubtracting_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingBy: - NSDecimalNumber decimalNumberByMultiplyingBy_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberByMultiplyingBy_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingBy:withBehavior: - NSDecimalNumber decimalNumberByMultiplyingBy_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberByMultiplyingBy_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByDividingBy: - NSDecimalNumber decimalNumberByDividingBy_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberByDividingBy_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByDividingBy:withBehavior: - NSDecimalNumber decimalNumberByDividingBy_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberByDividingBy_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByRaisingToPower: - NSDecimalNumber decimalNumberByRaisingToPower_(int power) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_decimalNumberByRaisingToPower_, power); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByRaisingToPower:withBehavior: - NSDecimalNumber decimalNumberByRaisingToPower_withBehavior_( - int power, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_m23d4r( - this.ref.pointer, - _sel_decimalNumberByRaisingToPower_withBehavior_, - power, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingByPowerOf10: - NSDecimalNumber decimalNumberByMultiplyingByPowerOf10_(int power) { - final _ret = _objc_msgSend_15di41h( - this.ref.pointer, _sel_decimalNumberByMultiplyingByPowerOf10_, power); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingByPowerOf10:withBehavior: - NSDecimalNumber decimalNumberByMultiplyingByPowerOf10_withBehavior_( - int power, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_1y5v0cu( - this.ref.pointer, - _sel_decimalNumberByMultiplyingByPowerOf10_withBehavior_, - power, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByRoundingAccordingToBehavior: - NSDecimalNumber decimalNumberByRoundingAccordingToBehavior_( - objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_decimalNumberByRoundingAccordingToBehavior_, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// compare: - objc.NSComparisonResult compare_(objc.NSNumber decimalNumber) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_compare_, decimalNumber.ref.pointer); - return objc.NSComparisonResult.fromValue(_ret); - } - - /// defaultBehavior - static objc.ObjCObjectBase getDefaultBehavior() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_defaultBehavior); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDefaultBehavior: - static void setDefaultBehavior(objc.ObjCObjectBase value) { - return _objc_msgSend_ukcdfq( - _class_NSDecimalNumber, _sel_setDefaultBehavior_, value.ref.pointer); - } - - /// objCType - ffi.Pointer get objCType { - return _objc_msgSend_1ypnhm3(this.ref.pointer, _sel_objCType); - } - - /// doubleValue - double get doubleValue { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_doubleValue) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_doubleValue); - } - - /// initWithCoder: - NSDecimalNumber? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// numberWithChar: - static objc.NSNumber numberWithChar_(int value) { - final _ret = _objc_msgSend_1pfmxrb( - _class_NSDecimalNumber, _sel_numberWithChar_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedChar: - static objc.NSNumber numberWithUnsignedChar_(int value) { - final _ret = _objc_msgSend_1ar9f5m( - _class_NSDecimalNumber, _sel_numberWithUnsignedChar_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithShort: - static objc.NSNumber numberWithShort_(int value) { - final _ret = _objc_msgSend_15di41h( - _class_NSDecimalNumber, _sel_numberWithShort_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedShort: - static objc.NSNumber numberWithUnsignedShort_(int value) { - final _ret = _objc_msgSend_122gbai( - _class_NSDecimalNumber, _sel_numberWithUnsignedShort_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithInt: - static objc.NSNumber numberWithInt_(int value) { - final _ret = _objc_msgSend_105o5we( - _class_NSDecimalNumber, _sel_numberWithInt_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedInt: - static objc.NSNumber numberWithUnsignedInt_(int value) { - final _ret = _objc_msgSend_pxgym4( - _class_NSDecimalNumber, _sel_numberWithUnsignedInt_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithLong: - static objc.NSNumber numberWithLong_(int value) { - final _ret = _objc_msgSend_crtxa9( - _class_NSDecimalNumber, _sel_numberWithLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedLong: - static objc.NSNumber numberWithUnsignedLong_(int value) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSDecimalNumber, _sel_numberWithUnsignedLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithLongLong: - static objc.NSNumber numberWithLongLong_(int value) { - final _ret = _objc_msgSend_yjzv9z( - _class_NSDecimalNumber, _sel_numberWithLongLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedLongLong: - static objc.NSNumber numberWithUnsignedLongLong_(int value) { - final _ret = _objc_msgSend_ybbscc( - _class_NSDecimalNumber, _sel_numberWithUnsignedLongLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithFloat: - static objc.NSNumber numberWithFloat_(double value) { - final _ret = _objc_msgSend_1pmj399( - _class_NSDecimalNumber, _sel_numberWithFloat_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithDouble: - static objc.NSNumber numberWithDouble_(double value) { - final _ret = _objc_msgSend_m7jc8y( - _class_NSDecimalNumber, _sel_numberWithDouble_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithBool: - static objc.NSNumber numberWithBool_(bool value) { - final _ret = _objc_msgSend_1upz917( - _class_NSDecimalNumber, _sel_numberWithBool_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithInteger: - static objc.NSNumber numberWithInteger_(int value) { - final _ret = _objc_msgSend_crtxa9( - _class_NSDecimalNumber, _sel_numberWithInteger_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedInteger: - static objc.NSNumber numberWithUnsignedInteger_(int value) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSDecimalNumber, _sel_numberWithUnsignedInteger_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithBytes:objCType: - NSDecimalNumber initWithBytes_objCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g(this.ref.retainAndReturnPointer(), - _sel_initWithBytes_objCType_, value, type); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// valueWithBytes:objCType: - static objc.NSValue valueWithBytes_objCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSDecimalNumber, _sel_valueWithBytes_objCType_, value, type); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// value:withObjCType: - static objc.NSValue value_withObjCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSDecimalNumber, _sel_value_withObjCType_, value, type); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithNonretainedObject: - static objc.NSValue valueWithNonretainedObject_( - objc.ObjCObjectBase? anObject) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumber, - _sel_valueWithNonretainedObject_, anObject?.ref.pointer ?? ffi.nullptr); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithPointer: - static objc.NSValue valueWithPointer_(ffi.Pointer pointer) { - final _ret = _objc_msgSend_1ph8ubj( - _class_NSDecimalNumber, _sel_valueWithPointer_, pointer); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithRange: - static objc.NSValue valueWithRange_(objc.NSRange range) { - final _ret = _objc_msgSend_176f8tz( - _class_NSDecimalNumber, _sel_valueWithRange_, range); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithPoint: - static objc.NSValue valueWithPoint_(CGPoint point) { - final _ret = _objc_msgSend_1xj0srq( - _class_NSDecimalNumber, _sel_valueWithPoint_, point); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithSize: - static objc.NSValue valueWithSize_(CGSize size) { - final _ret = - _objc_msgSend_fnn627(_class_NSDecimalNumber, _sel_valueWithSize_, size); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithRect: - static objc.NSValue valueWithRect_(CGRect rect) { - final _ret = _objc_msgSend_14yq09w( - _class_NSDecimalNumber, _sel_valueWithRect_, rect); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithEdgeInsets: - static objc.NSValue valueWithEdgeInsets_(NSEdgeInsets insets) { - final _ret = _objc_msgSend_12s6yn4( - _class_NSDecimalNumber, _sel_valueWithEdgeInsets_, insets); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSDecimalNumber init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSDecimalNumber new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_new); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSDecimalNumber allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDecimalNumber, _sel_allocWithZone_, zone); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSDecimalNumber alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_alloc); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDecimalNumber, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDecimalNumber, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumber, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSDecimalNumber, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumber, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDecimalNumber, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDecimalNumber, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumber, _sel_supportsSecureCoding); - } -} - -enum NSCalculationError { - NSCalculationNoError(0), - NSCalculationLossOfPrecision(1), - NSCalculationUnderflow(2), - NSCalculationOverflow(3), - NSCalculationDivideByZero(4); - - final int value; - const NSCalculationError(this.value); - - static NSCalculationError fromValue(int value) => switch (value) { - 0 => NSCalculationNoError, - 1 => NSCalculationLossOfPrecision, - 2 => NSCalculationUnderflow, - 3 => NSCalculationOverflow, - 4 => NSCalculationDivideByZero, - _ => - throw ArgumentError("Unknown value for NSCalculationError: $value"), - }; -} - -late final _sel_exceptionDuringOperation_error_leftOperand_rightOperand_ = objc - .registerName("exceptionDuringOperation:error:leftOperand:rightOperand:"); -final _objc_msgSend_bx1eho = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); -ffi.Pointer _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - int arg2, - ffi.Pointer arg3, - ffi.Pointer arg4) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.UnsignedLong arg2, - ffi.Pointer arg3, - ffi.Pointer arg4)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2, arg3, arg4); -ffi.Pointer - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - int arg2, - ffi.Pointer arg3, - ffi.Pointer arg4) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); -ffi.Pointer - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>`. -abstract final class ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - NSDecimalNumber? Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSDecimalNumber, - NSDecimalNumber?)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - NSDecimalNumber? Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSDecimalNumber, - NSDecimalNumber?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.UnsignedLong arg2, - ffi.Pointer arg3, - ffi.Pointer arg4)>> - ptr) => - objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>( - objc.newPointerBlock(_ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)> - fromFunction(NSDecimalNumber? Function(ffi.Pointer, ffi.Pointer, NSCalculationError, NSDecimalNumber, NSDecimalNumber?) fn) => - objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>( - objc.newClosureBlock( - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - int arg2, - ffi.Pointer arg3, - ffi.Pointer arg4) => - fn(arg0, arg1, NSCalculationError.fromValue(arg2), NSDecimalNumber.castFromPointer(arg3, retain: true, release: true), arg4.address == 0 ? null : NSDecimalNumber.castFromPointer(arg4, retain: true, release: true)) - ?.ref - .retainAndAutorelease() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>`. -extension ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_CallExtension - on objc.ObjCBlock< - NSDecimalNumber? Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSDecimalNumber, - NSDecimalNumber?)> { - NSDecimalNumber? call( - ffi.Pointer arg0, - ffi.Pointer arg1, - NSCalculationError arg2, - NSDecimalNumber arg3, - NSDecimalNumber? arg4) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.UnsignedLong arg2, - ffi.Pointer arg3, - ffi.Pointer arg4)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>() - (ref.pointer, arg0, arg1, arg2.value, arg3.ref.pointer, arg4?.ref.pointer ?? ffi.nullptr) - .address == - 0 - ? null - : NSDecimalNumber.castFromPointer(ref.pointer.ref.invoke.cast Function(ffi.Pointer block, ffi.Pointer arg0, ffi.Pointer arg1, ffi.UnsignedLong arg2, ffi.Pointer arg3, ffi.Pointer arg4)>>().asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, int, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0, arg1, arg2.value, arg3.ref.pointer, arg4?.ref.pointer ?? ffi.nullptr), retain: true, release: true); -} - -late final _sel_defaultDecimalNumberHandler = - objc.registerName("defaultDecimalNumberHandler"); -late final _sel_initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_ = - objc.registerName( - "initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:"); -final _objc_msgSend_1efxg5u = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Short, - ffi.Bool, - ffi.Bool, - ffi.Bool, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - bool, - bool, - bool, - bool)>(); -late final _sel_decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_ = - objc.registerName( - "decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:"); - -/// NSDecimalNumberHandler -class NSDecimalNumberHandler extends objc.NSObject { - NSDecimalNumberHandler._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDecimalNumberHandler] that points to the same underlying object as [other]. - NSDecimalNumberHandler.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDecimalNumberHandler] that wraps the given raw object pointer. - NSDecimalNumberHandler.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDecimalNumberHandler]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDecimalNumberHandler); - } - - /// defaultDecimalNumberHandler - static NSDecimalNumberHandler getDefaultDecimalNumberHandler() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumberHandler, _sel_defaultDecimalNumberHandler); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero: - NSDecimalNumberHandler - initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_( - NSRoundingMode roundingMode, - int scale, - bool exact, - bool overflow, - bool underflow, - bool divideByZero) { - final _ret = _objc_msgSend_1efxg5u( - this.ref.retainAndReturnPointer(), - _sel_initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_, - roundingMode.value, - scale, - exact, - overflow, - underflow, - divideByZero); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero: - static NSDecimalNumberHandler - decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_( - NSRoundingMode roundingMode, - int scale, - bool exact, - bool overflow, - bool underflow, - bool divideByZero) { - final _ret = _objc_msgSend_1efxg5u( - _class_NSDecimalNumberHandler, - _sel_decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_, - roundingMode.value, - scale, - exact, - overflow, - underflow, - divideByZero); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSDecimalNumberHandler init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSDecimalNumberHandler new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumberHandler, _sel_new); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSDecimalNumberHandler allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDecimalNumberHandler, _sel_allocWithZone_, zone); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSDecimalNumberHandler alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSDecimalNumberHandler, _sel_alloc); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDecimalNumberHandler, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDecimalNumberHandler, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumberHandler, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumberHandler, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumberHandler, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDecimalNumberHandler, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDecimalNumberHandler, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumberHandler, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumberHandler, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSDecimalNumberHandler self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSDecimalNumberHandler retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSDecimalNumberHandler autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// roundingMode - NSRoundingMode roundingMode() { - final _ret = _objc_msgSend_1iugf7h(this.ref.pointer, _sel_roundingMode); - return NSRoundingMode.fromValue(_ret); - } - - /// scale - int scale() { - return _objc_msgSend_157j54x(this.ref.pointer, _sel_scale); - } - - /// exceptionDuringOperation:error:leftOperand:rightOperand: - NSDecimalNumber? exceptionDuringOperation_error_leftOperand_rightOperand_( - ffi.Pointer operation, - NSCalculationError error, - NSDecimalNumber leftOperand, - NSDecimalNumber? rightOperand) { - final _ret = _objc_msgSend_bx1eho( - this.ref.pointer, - _sel_exceptionDuringOperation_error_leftOperand_rightOperand_, - operation, - error.value, - leftOperand.ref.pointer, - rightOperand?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSDecimalNumberHandler? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_roundingBehavior = objc.registerName("roundingBehavior"); -late final _sel_setRoundingBehavior_ = - objc.registerName("setRoundingBehavior:"); - -/// NSNumberFormatter -class NSNumberFormatter extends NSFormatter { - NSNumberFormatter._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSNumberFormatter] that points to the same underlying object as [other]. - NSNumberFormatter.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSNumberFormatter] that wraps the given raw object pointer. - NSNumberFormatter.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSNumberFormatter]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSNumberFormatter); - } - - /// formattingContext - NSFormattingContext get formattingContext { - final _ret = - _objc_msgSend_10wicfq(this.ref.pointer, _sel_formattingContext); - return NSFormattingContext.fromValue(_ret); - } - - /// setFormattingContext: - set formattingContext(NSFormattingContext value) { - return _objc_msgSend_1gtwv7x( - this.ref.pointer, _sel_setFormattingContext_, value.value); - } - - /// getObjectValue:forString:range:error: - bool getObjectValue_forString_range_error_( - ffi.Pointer> obj, - objc.NSString string, - ffi.Pointer rangep, - ffi.Pointer> error) { - return _objc_msgSend_bl9kx( - this.ref.pointer, - _sel_getObjectValue_forString_range_error_, - obj, - string.ref.pointer, - rangep, - error); - } - - /// stringFromNumber: - objc.NSString? stringFromNumber_(objc.NSNumber number) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_stringFromNumber_, number.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// numberFromString: - objc.NSNumber? numberFromString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_numberFromString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedStringFromNumber:numberStyle: - static objc.NSString localizedStringFromNumber_numberStyle_( - objc.NSNumber num, NSNumberFormatterStyle nstyle) { - final _ret = _objc_msgSend_1dsaaq7( - _class_NSNumberFormatter, - _sel_localizedStringFromNumber_numberStyle_, - num.ref.pointer, - nstyle.value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultFormatterBehavior - static NSNumberFormatterBehavior defaultFormatterBehavior() { - final _ret = _objc_msgSend_1nvfxwt( - _class_NSNumberFormatter, _sel_defaultFormatterBehavior); - return NSNumberFormatterBehavior.fromValue(_ret); - } - - /// setDefaultFormatterBehavior: - static void setDefaultFormatterBehavior_(NSNumberFormatterBehavior behavior) { - _objc_msgSend_1p18hg0(_class_NSNumberFormatter, - _sel_setDefaultFormatterBehavior_, behavior.value); - } - - /// numberStyle - NSNumberFormatterStyle get numberStyle { - final _ret = _objc_msgSend_1we0qxe(this.ref.pointer, _sel_numberStyle); - return NSNumberFormatterStyle.fromValue(_ret); - } - - /// setNumberStyle: - set numberStyle(NSNumberFormatterStyle value) { - return _objc_msgSend_qp19lh( - this.ref.pointer, _sel_setNumberStyle_, value.value); - } - - /// locale - objc.NSLocale get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return objc.NSLocale.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.NSLocale value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value.ref.pointer); - } - - /// generatesDecimalNumbers - bool get generatesDecimalNumbers { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_generatesDecimalNumbers); - } - - /// setGeneratesDecimalNumbers: - set generatesDecimalNumbers(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setGeneratesDecimalNumbers_, value); - } - - /// formatterBehavior - NSNumberFormatterBehavior get formatterBehavior { - final _ret = - _objc_msgSend_1nvfxwt(this.ref.pointer, _sel_formatterBehavior); - return NSNumberFormatterBehavior.fromValue(_ret); - } - - /// setFormatterBehavior: - set formatterBehavior(NSNumberFormatterBehavior value) { - return _objc_msgSend_1p18hg0( - this.ref.pointer, _sel_setFormatterBehavior_, value.value); - } - - /// negativeFormat - objc.NSString get negativeFormat { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativeFormat); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativeFormat: - set negativeFormat(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativeFormat_, value.ref.pointer); - } - - /// textAttributesForNegativeValues - objc.NSDictionary? get textAttributesForNegativeValues { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForNegativeValues); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNegativeValues: - set textAttributesForNegativeValues(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForNegativeValues_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// positiveFormat - objc.NSString get positiveFormat { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positiveFormat); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositiveFormat: - set positiveFormat(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositiveFormat_, value.ref.pointer); - } - - /// textAttributesForPositiveValues - objc.NSDictionary? get textAttributesForPositiveValues { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForPositiveValues); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForPositiveValues: - set textAttributesForPositiveValues(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForPositiveValues_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// allowsFloats - bool get allowsFloats { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsFloats); - } - - /// setAllowsFloats: - set allowsFloats(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsFloats_, value); - } - - /// decimalSeparator - objc.NSString get decimalSeparator { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_decimalSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setDecimalSeparator: - set decimalSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDecimalSeparator_, value.ref.pointer); - } - - /// alwaysShowsDecimalSeparator - bool get alwaysShowsDecimalSeparator { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_alwaysShowsDecimalSeparator); - } - - /// setAlwaysShowsDecimalSeparator: - set alwaysShowsDecimalSeparator(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAlwaysShowsDecimalSeparator_, value); - } - - /// currencyDecimalSeparator - objc.NSString get currencyDecimalSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencyDecimalSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencyDecimalSeparator: - set currencyDecimalSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrencyDecimalSeparator_, value.ref.pointer); - } - - /// usesGroupingSeparator - bool get usesGroupingSeparator { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_usesGroupingSeparator); - } - - /// setUsesGroupingSeparator: - set usesGroupingSeparator(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesGroupingSeparator_, value); - } - - /// groupingSeparator - objc.NSString get groupingSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_groupingSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setGroupingSeparator: - set groupingSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setGroupingSeparator_, value.ref.pointer); - } - - /// zeroSymbol - objc.NSString? get zeroSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_zeroSymbol); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setZeroSymbol: - set zeroSymbol(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setZeroSymbol_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// textAttributesForZero - objc.NSDictionary? get textAttributesForZero { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_textAttributesForZero); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForZero: - set textAttributesForZero(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setTextAttributesForZero_, value?.ref.pointer ?? ffi.nullptr); - } - - /// nilSymbol - objc.NSString get nilSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nilSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNilSymbol: - set nilSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNilSymbol_, value.ref.pointer); - } - - /// textAttributesForNil - objc.NSDictionary? get textAttributesForNil { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_textAttributesForNil); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNil: - set textAttributesForNil(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setTextAttributesForNil_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// notANumberSymbol - objc.NSString get notANumberSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_notANumberSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNotANumberSymbol: - set notANumberSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNotANumberSymbol_, value.ref.pointer); - } - - /// textAttributesForNotANumber - objc.NSDictionary? get textAttributesForNotANumber { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForNotANumber); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNotANumber: - set textAttributesForNotANumber(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForNotANumber_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// positiveInfinitySymbol - objc.NSString get positiveInfinitySymbol { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positiveInfinitySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositiveInfinitySymbol: - set positiveInfinitySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositiveInfinitySymbol_, value.ref.pointer); - } - - /// textAttributesForPositiveInfinity - objc.NSDictionary? get textAttributesForPositiveInfinity { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForPositiveInfinity); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForPositiveInfinity: - set textAttributesForPositiveInfinity(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForPositiveInfinity_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// negativeInfinitySymbol - objc.NSString get negativeInfinitySymbol { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativeInfinitySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativeInfinitySymbol: - set negativeInfinitySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativeInfinitySymbol_, value.ref.pointer); - } - - /// textAttributesForNegativeInfinity - objc.NSDictionary? get textAttributesForNegativeInfinity { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForNegativeInfinity); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNegativeInfinity: - set textAttributesForNegativeInfinity(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForNegativeInfinity_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// positivePrefix - objc.NSString get positivePrefix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positivePrefix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositivePrefix: - set positivePrefix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositivePrefix_, value.ref.pointer); - } - - /// positiveSuffix - objc.NSString get positiveSuffix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positiveSuffix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositiveSuffix: - set positiveSuffix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositiveSuffix_, value.ref.pointer); - } - - /// negativePrefix - objc.NSString get negativePrefix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativePrefix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativePrefix: - set negativePrefix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativePrefix_, value.ref.pointer); - } - - /// negativeSuffix - objc.NSString get negativeSuffix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativeSuffix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativeSuffix: - set negativeSuffix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativeSuffix_, value.ref.pointer); - } - - /// currencyCode - objc.NSString get currencyCode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencyCode); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencyCode: - set currencyCode(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrencyCode_, value.ref.pointer); - } - - /// currencySymbol - objc.NSString get currencySymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencySymbol: - set currencySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrencySymbol_, value.ref.pointer); - } - - /// internationalCurrencySymbol - objc.NSString get internationalCurrencySymbol { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_internationalCurrencySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setInternationalCurrencySymbol: - set internationalCurrencySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setInternationalCurrencySymbol_, value.ref.pointer); - } - - /// percentSymbol - objc.NSString get percentSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_percentSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPercentSymbol: - set percentSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPercentSymbol_, value.ref.pointer); - } - - /// perMillSymbol - objc.NSString get perMillSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_perMillSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPerMillSymbol: - set perMillSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPerMillSymbol_, value.ref.pointer); - } - - /// minusSign - objc.NSString get minusSign { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_minusSign); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setMinusSign: - set minusSign(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMinusSign_, value.ref.pointer); - } - - /// plusSign - objc.NSString get plusSign { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_plusSign); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPlusSign: - set plusSign(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPlusSign_, value.ref.pointer); - } - - /// exponentSymbol - objc.NSString get exponentSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_exponentSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setExponentSymbol: - set exponentSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setExponentSymbol_, value.ref.pointer); - } - - /// groupingSize - int get groupingSize { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_groupingSize); - } - - /// setGroupingSize: - set groupingSize(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setGroupingSize_, value); - } - - /// secondaryGroupingSize - int get secondaryGroupingSize { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_secondaryGroupingSize); - } - - /// setSecondaryGroupingSize: - set secondaryGroupingSize(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setSecondaryGroupingSize_, value); - } - - /// multiplier - objc.NSNumber? get multiplier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_multiplier); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setMultiplier: - set multiplier(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setMultiplier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// formatWidth - int get formatWidth { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_formatWidth); - } - - /// setFormatWidth: - set formatWidth(int value) { - return _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_setFormatWidth_, value); - } - - /// paddingCharacter - objc.NSString get paddingCharacter { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_paddingCharacter); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPaddingCharacter: - set paddingCharacter(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPaddingCharacter_, value.ref.pointer); - } - - /// paddingPosition - NSNumberFormatterPadPosition get paddingPosition { - final _ret = _objc_msgSend_1s69i33(this.ref.pointer, _sel_paddingPosition); - return NSNumberFormatterPadPosition.fromValue(_ret); - } - - /// setPaddingPosition: - set paddingPosition(NSNumberFormatterPadPosition value) { - return _objc_msgSend_gz8txq( - this.ref.pointer, _sel_setPaddingPosition_, value.value); - } - - /// roundingMode - NSNumberFormatterRoundingMode get roundingMode { - final _ret = _objc_msgSend_38d07q(this.ref.pointer, _sel_roundingMode); - return NSNumberFormatterRoundingMode.fromValue(_ret); - } - - /// setRoundingMode: - set roundingMode(NSNumberFormatterRoundingMode value) { - return _objc_msgSend_5krs29( - this.ref.pointer, _sel_setRoundingMode_, value.value); - } - - /// roundingIncrement - objc.NSNumber get roundingIncrement { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_roundingIncrement); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setRoundingIncrement: - set roundingIncrement(objc.NSNumber value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setRoundingIncrement_, value.ref.pointer); - } - - /// minimumIntegerDigits - int get minimumIntegerDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_minimumIntegerDigits); - } - - /// setMinimumIntegerDigits: - set minimumIntegerDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumIntegerDigits_, value); - } - - /// maximumIntegerDigits - int get maximumIntegerDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_maximumIntegerDigits); - } - - /// setMaximumIntegerDigits: - set maximumIntegerDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMaximumIntegerDigits_, value); - } - - /// minimumFractionDigits - int get minimumFractionDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_minimumFractionDigits); - } - - /// setMinimumFractionDigits: - set minimumFractionDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumFractionDigits_, value); - } - - /// maximumFractionDigits - int get maximumFractionDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_maximumFractionDigits); - } - - /// setMaximumFractionDigits: - set maximumFractionDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMaximumFractionDigits_, value); - } - - /// minimum - objc.NSNumber? get minimum { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_minimum); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setMinimum: - set minimum(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMinimum_, value?.ref.pointer ?? ffi.nullptr); - } - - /// maximum - objc.NSNumber? get maximum { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_maximum); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setMaximum: - set maximum(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMaximum_, value?.ref.pointer ?? ffi.nullptr); - } - - /// currencyGroupingSeparator - objc.NSString get currencyGroupingSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencyGroupingSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencyGroupingSeparator: - set currencyGroupingSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setCurrencyGroupingSeparator_, value.ref.pointer); - } - - /// isLenient - bool get lenient { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLenient); - } - - /// setLenient: - set lenient(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setLenient_, value); - } - - /// usesSignificantDigits - bool get usesSignificantDigits { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_usesSignificantDigits); - } - - /// setUsesSignificantDigits: - set usesSignificantDigits(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesSignificantDigits_, value); - } - - /// minimumSignificantDigits - int get minimumSignificantDigits { - return _objc_msgSend_eldhrq( - this.ref.pointer, _sel_minimumSignificantDigits); - } - - /// setMinimumSignificantDigits: - set minimumSignificantDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumSignificantDigits_, value); - } - - /// maximumSignificantDigits - int get maximumSignificantDigits { - return _objc_msgSend_eldhrq( - this.ref.pointer, _sel_maximumSignificantDigits); - } - - /// setMaximumSignificantDigits: - set maximumSignificantDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMaximumSignificantDigits_, value); - } - - /// isPartialStringValidationEnabled - bool get partialStringValidationEnabled { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_isPartialStringValidationEnabled); - } - - /// setPartialStringValidationEnabled: - set partialStringValidationEnabled(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setPartialStringValidationEnabled_, value); - } - - /// hasThousandSeparators - bool get hasThousandSeparators { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasThousandSeparators); - } - - /// setHasThousandSeparators: - set hasThousandSeparators(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHasThousandSeparators_, value); - } - - /// thousandSeparator - objc.NSString get thousandSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_thousandSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setThousandSeparator: - set thousandSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setThousandSeparator_, value.ref.pointer); - } - - /// localizesFormat - bool get localizesFormat { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_localizesFormat); - } - - /// setLocalizesFormat: - set localizesFormat(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setLocalizesFormat_, value); - } - - /// format - objc.NSString get format { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_format); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setFormat: - set format(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFormat_, value.ref.pointer); - } - - /// attributedStringForZero - NSAttributedString get attributedStringForZero { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributedStringForZero); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAttributedStringForZero: - set attributedStringForZero(NSAttributedString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAttributedStringForZero_, value.ref.pointer); - } - - /// attributedStringForNil - NSAttributedString get attributedStringForNil { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributedStringForNil); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAttributedStringForNil: - set attributedStringForNil(NSAttributedString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAttributedStringForNil_, value.ref.pointer); - } - - /// attributedStringForNotANumber - NSAttributedString get attributedStringForNotANumber { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_attributedStringForNotANumber); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAttributedStringForNotANumber: - set attributedStringForNotANumber(NSAttributedString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setAttributedStringForNotANumber_, value.ref.pointer); - } - - /// roundingBehavior - NSDecimalNumberHandler get roundingBehavior { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_roundingBehavior); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// setRoundingBehavior: - set roundingBehavior(NSDecimalNumberHandler value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setRoundingBehavior_, value.ref.pointer); - } - - /// init - NSNumberFormatter init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSNumberFormatter new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNumberFormatter, _sel_new); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSNumberFormatter allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSNumberFormatter, _sel_allocWithZone_, zone); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSNumberFormatter alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNumberFormatter, _sel_alloc); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSNumberFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSNumberFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSNumberFormatter, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSNumberFormatter, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSNumberFormatter, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSNumberFormatter, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSNumberFormatter, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNumberFormatter, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNumberFormatter, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSNumberFormatter self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSNumberFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSNumberFormatter retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSNumberFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSNumberFormatter autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSNumberFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithCoder: - NSNumberFormatter? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSNumberFormatter.castFromPointer(_ret, retain: false, release: true); - } -} - -enum NSLocaleLanguageDirection { - NSLocaleLanguageDirectionUnknown(0), - NSLocaleLanguageDirectionLeftToRight(1), - NSLocaleLanguageDirectionRightToLeft(2), - NSLocaleLanguageDirectionTopToBottom(3), - NSLocaleLanguageDirectionBottomToTop(4); - - final int value; - const NSLocaleLanguageDirection(this.value); - - static NSLocaleLanguageDirection fromValue(int value) => switch (value) { - 0 => NSLocaleLanguageDirectionUnknown, - 1 => NSLocaleLanguageDirectionLeftToRight, - 2 => NSLocaleLanguageDirectionRightToLeft, - 3 => NSLocaleLanguageDirectionTopToBottom, - 4 => NSLocaleLanguageDirectionBottomToTop, - _ => throw ArgumentError( - "Unknown value for NSLocaleLanguageDirection: $value"), - }; -} - -final class NSDecimal extends ffi.Opaque {} - -late final _class_NSScanner = objc.getClass("NSScanner"); -late final _sel_scanLocation = objc.registerName("scanLocation"); -late final _sel_setScanLocation_ = objc.registerName("setScanLocation:"); -late final _sel_charactersToBeSkipped = - objc.registerName("charactersToBeSkipped"); -late final _sel_setCharactersToBeSkipped_ = - objc.registerName("setCharactersToBeSkipped:"); -late final _sel_caseSensitive = objc.registerName("caseSensitive"); -late final _sel_setCaseSensitive_ = objc.registerName("setCaseSensitive:"); -late final _sel_scanInt_ = objc.registerName("scanInt:"); -final _objc_msgSend_tke0i3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanInteger_ = objc.registerName("scanInteger:"); -final _objc_msgSend_1m3j5r2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanLongLong_ = objc.registerName("scanLongLong:"); -final _objc_msgSend_litvm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanUnsignedLongLong_ = - objc.registerName("scanUnsignedLongLong:"); -final _objc_msgSend_1uz3cj3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_scanFloat_ = objc.registerName("scanFloat:"); -final _objc_msgSend_1qkfxp0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanDouble_ = objc.registerName("scanDouble:"); -final _objc_msgSend_2un1vl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanHexInt_ = objc.registerName("scanHexInt:"); -final _objc_msgSend_5fep2j = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanHexLongLong_ = objc.registerName("scanHexLongLong:"); -late final _sel_scanHexFloat_ = objc.registerName("scanHexFloat:"); -late final _sel_scanHexDouble_ = objc.registerName("scanHexDouble:"); -late final _sel_scanString_intoString_ = - objc.registerName("scanString:intoString:"); -final _objc_msgSend_p02k6o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_scanCharactersFromSet_intoString_ = - objc.registerName("scanCharactersFromSet:intoString:"); -late final _sel_scanUpToString_intoString_ = - objc.registerName("scanUpToString:intoString:"); -late final _sel_scanUpToCharactersFromSet_intoString_ = - objc.registerName("scanUpToCharactersFromSet:intoString:"); -late final _sel_isAtEnd = objc.registerName("isAtEnd"); -late final _sel_scannerWithString_ = objc.registerName("scannerWithString:"); -late final _sel_localizedScannerWithString_ = - objc.registerName("localizedScannerWithString:"); -late final _sel_scanDecimal_ = objc.registerName("scanDecimal:"); -final _objc_msgSend_wap63g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - -/// NSScanner -class NSScanner extends objc.NSObject { - NSScanner._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScanner] that points to the same underlying object as [other]. - NSScanner.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScanner] that wraps the given raw object pointer. - NSScanner.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScanner]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScanner); - } - - /// string - objc.NSString get string { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_string); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// scanLocation - int get scanLocation { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_scanLocation); - } - - /// setScanLocation: - set scanLocation(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setScanLocation_, value); - } - - /// charactersToBeSkipped - objc.NSCharacterSet? get charactersToBeSkipped { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_charactersToBeSkipped); - return _ret.address == 0 - ? null - : objc.NSCharacterSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// setCharactersToBeSkipped: - set charactersToBeSkipped(objc.NSCharacterSet? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setCharactersToBeSkipped_, value?.ref.pointer ?? ffi.nullptr); - } - - /// caseSensitive - bool get caseSensitive { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_caseSensitive); - } - - /// setCaseSensitive: - set caseSensitive(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setCaseSensitive_, value); - } - - /// locale - objc.ObjCObjectBase? get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value?.ref.pointer ?? ffi.nullptr); - } - - /// initWithString: - NSScanner initWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, string.ref.pointer); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// scanInt: - bool scanInt_(ffi.Pointer result) { - return _objc_msgSend_tke0i3(this.ref.pointer, _sel_scanInt_, result); - } - - /// scanInteger: - bool scanInteger_(ffi.Pointer result) { - return _objc_msgSend_1m3j5r2(this.ref.pointer, _sel_scanInteger_, result); - } - - /// scanLongLong: - bool scanLongLong_(ffi.Pointer result) { - return _objc_msgSend_litvm(this.ref.pointer, _sel_scanLongLong_, result); - } - - /// scanUnsignedLongLong: - bool scanUnsignedLongLong_(ffi.Pointer result) { - return _objc_msgSend_1uz3cj3( - this.ref.pointer, _sel_scanUnsignedLongLong_, result); - } - - /// scanFloat: - bool scanFloat_(ffi.Pointer result) { - return _objc_msgSend_1qkfxp0(this.ref.pointer, _sel_scanFloat_, result); - } - - /// scanDouble: - bool scanDouble_(ffi.Pointer result) { - return _objc_msgSend_2un1vl(this.ref.pointer, _sel_scanDouble_, result); - } - - /// scanHexInt: - bool scanHexInt_(ffi.Pointer result) { - return _objc_msgSend_5fep2j(this.ref.pointer, _sel_scanHexInt_, result); - } - - /// scanHexLongLong: - bool scanHexLongLong_(ffi.Pointer result) { - return _objc_msgSend_1uz3cj3( - this.ref.pointer, _sel_scanHexLongLong_, result); - } - - /// scanHexFloat: - bool scanHexFloat_(ffi.Pointer result) { - return _objc_msgSend_1qkfxp0(this.ref.pointer, _sel_scanHexFloat_, result); - } - - /// scanHexDouble: - bool scanHexDouble_(ffi.Pointer result) { - return _objc_msgSend_2un1vl(this.ref.pointer, _sel_scanHexDouble_, result); - } - - /// scanString:intoString: - bool scanString_intoString_( - objc.NSString string, ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_scanString_intoString_, - string.ref.pointer, result); - } - - /// scanCharactersFromSet:intoString: - bool scanCharactersFromSet_intoString_(objc.NSCharacterSet set, - ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_scanCharactersFromSet_intoString_, set.ref.pointer, result); - } - - /// scanUpToString:intoString: - bool scanUpToString_intoString_( - objc.NSString string, ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_scanUpToString_intoString_, string.ref.pointer, result); - } - - /// scanUpToCharactersFromSet:intoString: - bool scanUpToCharactersFromSet_intoString_(objc.NSCharacterSet set, - ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_scanUpToCharactersFromSet_intoString_, set.ref.pointer, result); - } - - /// isAtEnd - bool get atEnd { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isAtEnd); - } - - /// scannerWithString: - static NSScanner scannerWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSScanner, _sel_scannerWithString_, string.ref.pointer); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedScannerWithString: - static objc.ObjCObjectBase localizedScannerWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSScanner, _sel_localizedScannerWithString_, string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// scanDecimal: - bool scanDecimal_(ffi.Pointer dcm) { - return _objc_msgSend_wap63g(this.ref.pointer, _sel_scanDecimal_, dcm); - } - - /// init - NSScanner init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSScanner new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScanner, _sel_new); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSScanner allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSScanner, _sel_allocWithZone_, zone); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSScanner alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScanner, _sel_alloc); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScanner, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScanner, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScanner, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSScanner, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScanner, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScanner, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScanner, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScanner, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScanner, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSScanner self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSScanner retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSScanner autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSException = objc.getClass("NSException"); -late final _sel_exceptionWithName_reason_userInfo_ = - objc.registerName("exceptionWithName:reason:userInfo:"); -late final _sel_initWithName_reason_userInfo_ = - objc.registerName("initWithName:reason:userInfo:"); -late final _sel_reason = objc.registerName("reason"); -late final _sel_callStackReturnAddresses = - objc.registerName("callStackReturnAddresses"); -late final _sel_callStackSymbols = objc.registerName("callStackSymbols"); -late final _sel_raise = objc.registerName("raise"); -late final _sel_raise_format_ = objc.registerName("raise:format:"); - -/// NSException -class NSException extends objc.NSObject { - NSException._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSException] that points to the same underlying object as [other]. - NSException.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSException] that wraps the given raw object pointer. - NSException.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSException]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSException); - } - - /// exceptionWithName:reason:userInfo: - static NSException exceptionWithName_reason_userInfo_( - objc.NSString name, objc.NSString? reason, objc.NSDictionary? userInfo) { - final _ret = _objc_msgSend_aud7dn( - _class_NSException, - _sel_exceptionWithName_reason_userInfo_, - name.ref.pointer, - reason?.ref.pointer ?? ffi.nullptr, - userInfo?.ref.pointer ?? ffi.nullptr); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithName:reason:userInfo: - NSException initWithName_reason_userInfo_(objc.NSString aName, - objc.NSString? aReason, objc.NSDictionary? aUserInfo) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithName_reason_userInfo_, - aName.ref.pointer, - aReason?.ref.pointer ?? ffi.nullptr, - aUserInfo?.ref.pointer ?? ffi.nullptr); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// reason - objc.NSString? get reason { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reason); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// userInfo - objc.NSDictionary? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// callStackReturnAddresses - objc.NSArray get callStackReturnAddresses { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_callStackReturnAddresses); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// callStackSymbols - objc.NSArray get callStackSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_callStackSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// raise - void raise() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_raise); - } - - /// raise:format: - static void raise_format_(objc.NSString name, objc.NSString format) { - _objc_msgSend_1tjlcwl(_class_NSException, _sel_raise_format_, - name.ref.pointer, format.ref.pointer); - } - - /// init - NSException init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSException new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSException, _sel_new); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSException allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSException, _sel_allocWithZone_, zone); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSException alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSException, _sel_alloc); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSException, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSException, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSException, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSException, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSException, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSException, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSException, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSException, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSException, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSException self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSException retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSException autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSException, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSException? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSException.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSFileHandle = objc.getClass("NSFileHandle"); -late final _sel_availableData = objc.registerName("availableData"); -late final _sel_initWithFileDescriptor_closeOnDealloc_ = - objc.registerName("initWithFileDescriptor:closeOnDealloc:"); -final _objc_msgSend_1jumayh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Int, ffi.Bool)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, bool)>(); -late final _sel_readDataToEndOfFileAndReturnError_ = - objc.registerName("readDataToEndOfFileAndReturnError:"); -final _objc_msgSend_13z4cgc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_readDataUpToLength_error_ = - objc.registerName("readDataUpToLength:error:"); -final _objc_msgSend_5h0ois = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_writeData_error_ = objc.registerName("writeData:error:"); -late final _sel_getOffset_error_ = objc.registerName("getOffset:error:"); -final _objc_msgSend_gp32qh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_seekToEndReturningOffset_error_ = - objc.registerName("seekToEndReturningOffset:error:"); -late final _sel_seekToOffset_error_ = objc.registerName("seekToOffset:error:"); -final _objc_msgSend_57fjbb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLongLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_truncateAtOffset_error_ = - objc.registerName("truncateAtOffset:error:"); -late final _sel_synchronizeAndReturnError_ = - objc.registerName("synchronizeAndReturnError:"); -late final _sel_closeAndReturnError_ = - objc.registerName("closeAndReturnError:"); -late final _sel_fileHandleWithStandardInput = - objc.registerName("fileHandleWithStandardInput"); -late final _sel_fileHandleWithStandardOutput = - objc.registerName("fileHandleWithStandardOutput"); -late final _sel_fileHandleWithStandardError = - objc.registerName("fileHandleWithStandardError"); -late final _sel_fileHandleWithNullDevice = - objc.registerName("fileHandleWithNullDevice"); -late final _sel_fileHandleForReadingAtPath_ = - objc.registerName("fileHandleForReadingAtPath:"); -late final _sel_fileHandleForWritingAtPath_ = - objc.registerName("fileHandleForWritingAtPath:"); -late final _sel_fileHandleForUpdatingAtPath_ = - objc.registerName("fileHandleForUpdatingAtPath:"); -late final _sel_fileHandleForReadingFromURL_error_ = - objc.registerName("fileHandleForReadingFromURL:error:"); -final _objc_msgSend_1y425zh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_fileHandleForWritingToURL_error_ = - objc.registerName("fileHandleForWritingToURL:error:"); -late final _sel_fileHandleForUpdatingURL_error_ = - objc.registerName("fileHandleForUpdatingURL:error:"); -late final _sel_readInBackgroundAndNotifyForModes_ = - objc.registerName("readInBackgroundAndNotifyForModes:"); -late final _sel_readInBackgroundAndNotify = - objc.registerName("readInBackgroundAndNotify"); -late final _sel_readToEndOfFileInBackgroundAndNotifyForModes_ = - objc.registerName("readToEndOfFileInBackgroundAndNotifyForModes:"); -late final _sel_readToEndOfFileInBackgroundAndNotify = - objc.registerName("readToEndOfFileInBackgroundAndNotify"); -late final _sel_acceptConnectionInBackgroundAndNotifyForModes_ = - objc.registerName("acceptConnectionInBackgroundAndNotifyForModes:"); -late final _sel_acceptConnectionInBackgroundAndNotify = - objc.registerName("acceptConnectionInBackgroundAndNotify"); -late final _sel_waitForDataInBackgroundAndNotifyForModes_ = - objc.registerName("waitForDataInBackgroundAndNotifyForModes:"); -late final _sel_waitForDataInBackgroundAndNotify = - objc.registerName("waitForDataInBackgroundAndNotify"); -void _ObjCBlock_ffiVoid_NSFileHandle_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSFileHandle_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSFileHandle_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSFileHandle_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSFileHandle_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSFileHandle_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSFileHandle_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSFileHandle_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSFileHandle_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSFileHandle { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSFileHandle_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSFileHandle) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSFileHandle_closureCallable, - (ffi.Pointer arg0) => fn( - NSFileHandle.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSFileHandle) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSFileHandle_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn( - NSFileHandle.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSFileHandle_CallExtension - on objc.ObjCBlock { - void call(NSFileHandle arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_readabilityHandler = objc.registerName("readabilityHandler"); -late final _sel_setReadabilityHandler_ = - objc.registerName("setReadabilityHandler:"); -late final _sel_writeabilityHandler = objc.registerName("writeabilityHandler"); -late final _sel_setWriteabilityHandler_ = - objc.registerName("setWriteabilityHandler:"); -late final _sel_initWithFileDescriptor_ = - objc.registerName("initWithFileDescriptor:"); -late final _sel_fileDescriptor = objc.registerName("fileDescriptor"); -final _objc_msgSend_1tf0yjs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_readDataToEndOfFile = objc.registerName("readDataToEndOfFile"); -late final _sel_readDataOfLength_ = objc.registerName("readDataOfLength:"); -late final _sel_writeData_ = objc.registerName("writeData:"); -late final _sel_offsetInFile = objc.registerName("offsetInFile"); -final _objc_msgSend_1cirwn8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLongLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_seekToEndOfFile = objc.registerName("seekToEndOfFile"); -late final _sel_seekToFileOffset_ = objc.registerName("seekToFileOffset:"); -final _objc_msgSend_10wkxl3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLongLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_truncateFileAtOffset_ = - objc.registerName("truncateFileAtOffset:"); -late final _sel_synchronizeFile = objc.registerName("synchronizeFile"); -late final _sel_closeFile = objc.registerName("closeFile"); - -/// NSFileHandle -class NSFileHandle extends objc.NSObject { - NSFileHandle._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFileHandle] that points to the same underlying object as [other]. - NSFileHandle.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFileHandle] that wraps the given raw object pointer. - NSFileHandle.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFileHandle]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFileHandle); - } - - /// availableData - objc.NSData get availableData { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_availableData); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithFileDescriptor:closeOnDealloc: - NSFileHandle initWithFileDescriptor_closeOnDealloc_(int fd, bool closeopt) { - final _ret = _objc_msgSend_1jumayh(this.ref.retainAndReturnPointer(), - _sel_initWithFileDescriptor_closeOnDealloc_, fd, closeopt); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSFileHandle? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// readDataToEndOfFileAndReturnError: - objc.NSData? readDataToEndOfFileAndReturnError_( - ffi.Pointer> error) { - final _ret = _objc_msgSend_13z4cgc( - this.ref.pointer, _sel_readDataToEndOfFileAndReturnError_, error); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// readDataUpToLength:error: - objc.NSData? readDataUpToLength_error_( - int length, ffi.Pointer> error) { - final _ret = _objc_msgSend_5h0ois( - this.ref.pointer, _sel_readDataUpToLength_error_, length, error); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// writeData:error: - bool writeData_error_( - objc.NSData data, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_writeData_error_, data.ref.pointer, error); - } - - /// getOffset:error: - bool getOffset_error_(ffi.Pointer offsetInFile, - ffi.Pointer> error) { - return _objc_msgSend_gp32qh( - this.ref.pointer, _sel_getOffset_error_, offsetInFile, error); - } - - /// seekToEndReturningOffset:error: - bool seekToEndReturningOffset_error_( - ffi.Pointer offsetInFile, - ffi.Pointer> error) { - return _objc_msgSend_gp32qh(this.ref.pointer, - _sel_seekToEndReturningOffset_error_, offsetInFile, error); - } - - /// seekToOffset:error: - bool seekToOffset_error_( - int offset, ffi.Pointer> error) { - return _objc_msgSend_57fjbb( - this.ref.pointer, _sel_seekToOffset_error_, offset, error); - } - - /// truncateAtOffset:error: - bool truncateAtOffset_error_( - int offset, ffi.Pointer> error) { - return _objc_msgSend_57fjbb( - this.ref.pointer, _sel_truncateAtOffset_error_, offset, error); - } - - /// synchronizeAndReturnError: - bool synchronizeAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_synchronizeAndReturnError_, error); - } - - /// closeAndReturnError: - bool closeAndReturnError_(ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_closeAndReturnError_, error); - } - - /// fileHandleWithStandardInput - static NSFileHandle getFileHandleWithStandardInput() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithStandardInput); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleWithStandardOutput - static NSFileHandle getFileHandleWithStandardOutput() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithStandardOutput); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleWithStandardError - static NSFileHandle getFileHandleWithStandardError() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithStandardError); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleWithNullDevice - static NSFileHandle getFileHandleWithNullDevice() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithNullDevice); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForReadingAtPath: - static NSFileHandle? fileHandleForReadingAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_fileHandleForReadingAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForWritingAtPath: - static NSFileHandle? fileHandleForWritingAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_fileHandleForWritingAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForUpdatingAtPath: - static NSFileHandle? fileHandleForUpdatingAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_fileHandleForUpdatingAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForReadingFromURL:error: - static NSFileHandle? fileHandleForReadingFromURL_error_( - objc.NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSFileHandle, - _sel_fileHandleForReadingFromURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForWritingToURL:error: - static NSFileHandle? fileHandleForWritingToURL_error_( - objc.NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSFileHandle, - _sel_fileHandleForWritingToURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForUpdatingURL:error: - static NSFileHandle? fileHandleForUpdatingURL_error_( - objc.NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSFileHandle, - _sel_fileHandleForUpdatingURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// readInBackgroundAndNotifyForModes: - void readInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_readInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// readInBackgroundAndNotify - void readInBackgroundAndNotify() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_readInBackgroundAndNotify); - } - - /// readToEndOfFileInBackgroundAndNotifyForModes: - void readToEndOfFileInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_readToEndOfFileInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// readToEndOfFileInBackgroundAndNotify - void readToEndOfFileInBackgroundAndNotify() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_readToEndOfFileInBackgroundAndNotify); - } - - /// acceptConnectionInBackgroundAndNotifyForModes: - void acceptConnectionInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_acceptConnectionInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// acceptConnectionInBackgroundAndNotify - void acceptConnectionInBackgroundAndNotify() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_acceptConnectionInBackgroundAndNotify); - } - - /// waitForDataInBackgroundAndNotifyForModes: - void waitForDataInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_waitForDataInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// waitForDataInBackgroundAndNotify - void waitForDataInBackgroundAndNotify() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_waitForDataInBackgroundAndNotify); - } - - /// readabilityHandler - objc.ObjCBlock? get readabilityHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_readabilityHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid_NSFileHandle.castFromPointer(_ret, - retain: true, release: true); - } - - /// setReadabilityHandler: - set readabilityHandler( - objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setReadabilityHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// writeabilityHandler - objc.ObjCBlock? get writeabilityHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_writeabilityHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid_NSFileHandle.castFromPointer(_ret, - retain: true, release: true); - } - - /// setWriteabilityHandler: - set writeabilityHandler( - objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setWriteabilityHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// initWithFileDescriptor: - NSFileHandle initWithFileDescriptor_(int fd) { - final _ret = _objc_msgSend_105o5we( - this.ref.retainAndReturnPointer(), _sel_initWithFileDescriptor_, fd); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// fileDescriptor - int get fileDescriptor { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_fileDescriptor); - } - - /// readDataToEndOfFile - objc.NSData readDataToEndOfFile() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_readDataToEndOfFile); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// readDataOfLength: - objc.NSData readDataOfLength_(int length) { - final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_readDataOfLength_, length); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// writeData: - void writeData_(objc.NSData data) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_writeData_, data.ref.pointer); - } - - /// offsetInFile - int get offsetInFile { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_offsetInFile); - } - - /// seekToEndOfFile - int seekToEndOfFile() { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_seekToEndOfFile); - } - - /// seekToFileOffset: - void seekToFileOffset_(int offset) { - _objc_msgSend_10wkxl3(this.ref.pointer, _sel_seekToFileOffset_, offset); - } - - /// truncateFileAtOffset: - void truncateFileAtOffset_(int offset) { - _objc_msgSend_10wkxl3(this.ref.pointer, _sel_truncateFileAtOffset_, offset); - } - - /// synchronizeFile - void synchronizeFile() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_synchronizeFile); - } - - /// closeFile - void closeFile() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_closeFile); - } - - /// init - NSFileHandle init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFileHandle new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileHandle, _sel_new); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFileHandle allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFileHandle, _sel_allocWithZone_, zone); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFileHandle alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileHandle, _sel_alloc); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFileHandle, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFileHandle, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFileHandle, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFileHandle, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFileHandle, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFileHandle, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSFileHandle self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSFileHandle retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSFileHandle autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSFileHandle, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _class_NSFileManager = objc.getClass("NSFileManager"); -late final _sel_defaultManager = objc.registerName("defaultManager"); - -enum NSVolumeEnumerationOptions { - NSVolumeEnumerationSkipHiddenVolumes(2), - NSVolumeEnumerationProduceFileReferenceURLs(4); - - final int value; - const NSVolumeEnumerationOptions(this.value); - - static NSVolumeEnumerationOptions fromValue(int value) => switch (value) { - 2 => NSVolumeEnumerationSkipHiddenVolumes, - 4 => NSVolumeEnumerationProduceFileReferenceURLs, - _ => throw ArgumentError( - "Unknown value for NSVolumeEnumerationOptions: $value"), - }; -} - -late final _sel_mountedVolumeURLsIncludingResourceValuesForKeys_options_ = objc - .registerName("mountedVolumeURLsIncludingResourceValuesForKeys:options:"); -final _objc_msgSend_gyiq9w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); - -enum NSFileManagerUnmountOptions { - NSFileManagerUnmountAllPartitionsAndEjectDisk(1), - NSFileManagerUnmountWithoutUI(2); - - final int value; - const NSFileManagerUnmountOptions(this.value); - - static NSFileManagerUnmountOptions fromValue(int value) => switch (value) { - 1 => NSFileManagerUnmountAllPartitionsAndEjectDisk, - 2 => NSFileManagerUnmountWithoutUI, - _ => throw ArgumentError( - "Unknown value for NSFileManagerUnmountOptions: $value"), - }; -} - -void _ObjCBlock_ffiVoid_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSError_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSError_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSError_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSError.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSError_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSError.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSError_CallExtension - on objc.ObjCBlock { - void call(objc.NSError? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_unmountVolumeAtURL_options_completionHandler_ = - objc.registerName("unmountVolumeAtURL:options:completionHandler:"); -final _objc_msgSend_yuugcv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - -enum NSDirectoryEnumerationOptions { - NSDirectoryEnumerationSkipsSubdirectoryDescendants(1), - NSDirectoryEnumerationSkipsPackageDescendants(2), - NSDirectoryEnumerationSkipsHiddenFiles(4), - NSDirectoryEnumerationIncludesDirectoriesPostOrder(8), - NSDirectoryEnumerationProducesRelativePathURLs(16); - - final int value; - const NSDirectoryEnumerationOptions(this.value); - - static NSDirectoryEnumerationOptions fromValue(int value) => switch (value) { - 1 => NSDirectoryEnumerationSkipsSubdirectoryDescendants, - 2 => NSDirectoryEnumerationSkipsPackageDescendants, - 4 => NSDirectoryEnumerationSkipsHiddenFiles, - 8 => NSDirectoryEnumerationIncludesDirectoriesPostOrder, - 16 => NSDirectoryEnumerationProducesRelativePathURLs, - _ => throw ArgumentError( - "Unknown value for NSDirectoryEnumerationOptions: $value"), - }; -} - -late final _sel_contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error_ = - objc.registerName( - "contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:"); -final _objc_msgSend_1rn5oli = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); - -enum NSSearchPathDirectory { - NSApplicationDirectory(1), - NSDemoApplicationDirectory(2), - NSDeveloperApplicationDirectory(3), - NSAdminApplicationDirectory(4), - NSLibraryDirectory(5), - NSDeveloperDirectory(6), - NSUserDirectory(7), - NSDocumentationDirectory(8), - NSDocumentDirectory(9), - NSCoreServiceDirectory(10), - NSAutosavedInformationDirectory(11), - NSDesktopDirectory(12), - NSCachesDirectory(13), - NSApplicationSupportDirectory(14), - NSDownloadsDirectory(15), - NSInputMethodsDirectory(16), - NSMoviesDirectory(17), - NSMusicDirectory(18), - NSPicturesDirectory(19), - NSPrinterDescriptionDirectory(20), - NSSharedPublicDirectory(21), - NSPreferencePanesDirectory(22), - NSApplicationScriptsDirectory(23), - NSItemReplacementDirectory(99), - NSAllApplicationsDirectory(100), - NSAllLibrariesDirectory(101), - NSTrashDirectory(102); - - final int value; - const NSSearchPathDirectory(this.value); - - static NSSearchPathDirectory fromValue(int value) => switch (value) { - 1 => NSApplicationDirectory, - 2 => NSDemoApplicationDirectory, - 3 => NSDeveloperApplicationDirectory, - 4 => NSAdminApplicationDirectory, - 5 => NSLibraryDirectory, - 6 => NSDeveloperDirectory, - 7 => NSUserDirectory, - 8 => NSDocumentationDirectory, - 9 => NSDocumentDirectory, - 10 => NSCoreServiceDirectory, - 11 => NSAutosavedInformationDirectory, - 12 => NSDesktopDirectory, - 13 => NSCachesDirectory, - 14 => NSApplicationSupportDirectory, - 15 => NSDownloadsDirectory, - 16 => NSInputMethodsDirectory, - 17 => NSMoviesDirectory, - 18 => NSMusicDirectory, - 19 => NSPicturesDirectory, - 20 => NSPrinterDescriptionDirectory, - 21 => NSSharedPublicDirectory, - 22 => NSPreferencePanesDirectory, - 23 => NSApplicationScriptsDirectory, - 99 => NSItemReplacementDirectory, - 100 => NSAllApplicationsDirectory, - 101 => NSAllLibrariesDirectory, - 102 => NSTrashDirectory, - _ => throw ArgumentError( - "Unknown value for NSSearchPathDirectory: $value"), - }; -} - -enum NSSearchPathDomainMask { - NSUserDomainMask(1), - NSLocalDomainMask(2), - NSNetworkDomainMask(4), - NSSystemDomainMask(8), - NSAllDomainsMask(65535); - - final int value; - const NSSearchPathDomainMask(this.value); - - static NSSearchPathDomainMask fromValue(int value) => switch (value) { - 1 => NSUserDomainMask, - 2 => NSLocalDomainMask, - 4 => NSNetworkDomainMask, - 8 => NSSystemDomainMask, - 65535 => NSAllDomainsMask, - _ => throw ArgumentError( - "Unknown value for NSSearchPathDomainMask: $value"), - }; -} - -late final _sel_URLsForDirectory_inDomains_ = - objc.registerName("URLsForDirectory:inDomains:"); -final _objc_msgSend_1llbjq7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -late final _sel_URLForDirectory_inDomain_appropriateForURL_create_error_ = objc - .registerName("URLForDirectory:inDomain:appropriateForURL:create:error:"); -final _objc_msgSend_46p27t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Bool, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - bool, - ffi.Pointer>)>(); - -enum NSURLRelationship { - NSURLRelationshipContains(0), - NSURLRelationshipSame(1), - NSURLRelationshipOther(2); - - final int value; - const NSURLRelationship(this.value); - - static NSURLRelationship fromValue(int value) => switch (value) { - 0 => NSURLRelationshipContains, - 1 => NSURLRelationshipSame, - 2 => NSURLRelationshipOther, - _ => throw ArgumentError("Unknown value for NSURLRelationship: $value"), - }; -} - -late final _sel_getRelationship_ofDirectoryAtURL_toItemAtURL_error_ = - objc.registerName("getRelationship:ofDirectoryAtURL:toItemAtURL:error:"); -final _objc_msgSend_17s8ocw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_getRelationship_ofDirectory_inDomain_toItemAtURL_error_ = objc - .registerName("getRelationship:ofDirectory:inDomain:toItemAtURL:error:"); -final _objc_msgSend_9p3pl8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_createDirectoryAtURL_withIntermediateDirectories_attributes_error_ = - objc.registerName( - "createDirectoryAtURL:withIntermediateDirectories:attributes:error:"); -final _objc_msgSend_16o5u5c = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_createSymbolicLinkAtURL_withDestinationURL_error_ = - objc.registerName("createSymbolicLinkAtURL:withDestinationURL:error:"); -final _objc_msgSend_6toz8x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_delegate = objc.registerName("delegate"); -late final _sel_setDelegate_ = objc.registerName("setDelegate:"); -late final _sel_setAttributes_ofItemAtPath_error_ = - objc.registerName("setAttributes:ofItemAtPath:error:"); -late final _sel_createDirectoryAtPath_withIntermediateDirectories_attributes_error_ = - objc.registerName( - "createDirectoryAtPath:withIntermediateDirectories:attributes:error:"); -late final _sel_contentsOfDirectoryAtPath_error_ = - objc.registerName("contentsOfDirectoryAtPath:error:"); -late final _sel_subpathsOfDirectoryAtPath_error_ = - objc.registerName("subpathsOfDirectoryAtPath:error:"); -late final _sel_attributesOfItemAtPath_error_ = - objc.registerName("attributesOfItemAtPath:error:"); -late final _sel_attributesOfFileSystemForPath_error_ = - objc.registerName("attributesOfFileSystemForPath:error:"); -late final _sel_createSymbolicLinkAtPath_withDestinationPath_error_ = - objc.registerName("createSymbolicLinkAtPath:withDestinationPath:error:"); -late final _sel_destinationOfSymbolicLinkAtPath_error_ = - objc.registerName("destinationOfSymbolicLinkAtPath:error:"); -late final _sel_copyItemAtPath_toPath_error_ = - objc.registerName("copyItemAtPath:toPath:error:"); -late final _sel_moveItemAtPath_toPath_error_ = - objc.registerName("moveItemAtPath:toPath:error:"); -late final _sel_linkItemAtPath_toPath_error_ = - objc.registerName("linkItemAtPath:toPath:error:"); -late final _sel_removeItemAtPath_error_ = - objc.registerName("removeItemAtPath:error:"); -late final _sel_copyItemAtURL_toURL_error_ = - objc.registerName("copyItemAtURL:toURL:error:"); -late final _sel_moveItemAtURL_toURL_error_ = - objc.registerName("moveItemAtURL:toURL:error:"); -late final _sel_linkItemAtURL_toURL_error_ = - objc.registerName("linkItemAtURL:toURL:error:"); -late final _sel_removeItemAtURL_error_ = - objc.registerName("removeItemAtURL:error:"); -late final _sel_trashItemAtURL_resultingItemURL_error_ = - objc.registerName("trashItemAtURL:resultingItemURL:error:"); -late final _sel_fileAttributesAtPath_traverseLink_ = - objc.registerName("fileAttributesAtPath:traverseLink:"); -late final _sel_changeFileAttributes_atPath_ = - objc.registerName("changeFileAttributes:atPath:"); -late final _sel_directoryContentsAtPath_ = - objc.registerName("directoryContentsAtPath:"); -late final _sel_fileSystemAttributesAtPath_ = - objc.registerName("fileSystemAttributesAtPath:"); -late final _sel_pathContentOfSymbolicLinkAtPath_ = - objc.registerName("pathContentOfSymbolicLinkAtPath:"); -late final _sel_createSymbolicLinkAtPath_pathContent_ = - objc.registerName("createSymbolicLinkAtPath:pathContent:"); -late final _sel_createDirectoryAtPath_attributes_ = - objc.registerName("createDirectoryAtPath:attributes:"); -late final _sel_linkPath_toPath_handler_ = - objc.registerName("linkPath:toPath:handler:"); -final _objc_msgSend_hukaf0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_copyPath_toPath_handler_ = - objc.registerName("copyPath:toPath:handler:"); -late final _sel_movePath_toPath_handler_ = - objc.registerName("movePath:toPath:handler:"); -late final _sel_removeFileAtPath_handler_ = - objc.registerName("removeFileAtPath:handler:"); -late final _sel_currentDirectoryPath = - objc.registerName("currentDirectoryPath"); -late final _sel_changeCurrentDirectoryPath_ = - objc.registerName("changeCurrentDirectoryPath:"); -late final _sel_fileExistsAtPath_ = objc.registerName("fileExistsAtPath:"); -late final _sel_fileExistsAtPath_isDirectory_ = - objc.registerName("fileExistsAtPath:isDirectory:"); -final _objc_msgSend_rtz5p9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isReadableFileAtPath_ = - objc.registerName("isReadableFileAtPath:"); -late final _sel_isWritableFileAtPath_ = - objc.registerName("isWritableFileAtPath:"); -late final _sel_isExecutableFileAtPath_ = - objc.registerName("isExecutableFileAtPath:"); -late final _sel_isDeletableFileAtPath_ = - objc.registerName("isDeletableFileAtPath:"); -late final _sel_contentsEqualAtPath_andPath_ = - objc.registerName("contentsEqualAtPath:andPath:"); -late final _sel_displayNameAtPath_ = objc.registerName("displayNameAtPath:"); -late final _sel_componentsToDisplayForPath_ = - objc.registerName("componentsToDisplayForPath:"); -late final _sel_enumeratorAtPath_ = objc.registerName("enumeratorAtPath:"); -bool _ObjCBlock_bool_NSURL_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_NSURL_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_bool_NSURL_NSError_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_NSURL_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_NSURL_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_bool_NSURL_NSError_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_bool_NSURL_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_bool_NSURL_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - bool Function(objc.NSURL, objc.NSError) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_bool_NSURL_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - objc.NSURL - .castFromPointer(arg0, retain: true, release: true), - objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_bool_NSURL_NSError_CallExtension - on objc.ObjCBlock { - bool call(objc.NSURL arg0, objc.NSError arg1) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1.ref.pointer); -} - -late final _sel_enumeratorAtURL_includingPropertiesForKeys_options_errorHandler_ = - objc.registerName( - "enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:"); -final _objc_msgSend_40k0lk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_subpathsAtPath_ = objc.registerName("subpathsAtPath:"); -late final _sel_contentsAtPath_ = objc.registerName("contentsAtPath:"); -late final _sel_createFileAtPath_contents_attributes_ = - objc.registerName("createFileAtPath:contents:attributes:"); -late final _sel_fileSystemRepresentationWithPath_ = - objc.registerName("fileSystemRepresentationWithPath:"); -final _objc_msgSend_t1v5su = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_stringWithFileSystemRepresentation_length_ = - objc.registerName("stringWithFileSystemRepresentation:length:"); -final _objc_msgSend_1t5rcq1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); - -enum NSFileManagerItemReplacementOptions { - NSFileManagerItemReplacementUsingNewMetadataOnly(1), - NSFileManagerItemReplacementWithoutDeletingBackupItem(2); - - final int value; - const NSFileManagerItemReplacementOptions(this.value); - - static NSFileManagerItemReplacementOptions fromValue(int value) => - switch (value) { - 1 => NSFileManagerItemReplacementUsingNewMetadataOnly, - 2 => NSFileManagerItemReplacementWithoutDeletingBackupItem, - _ => throw ArgumentError( - "Unknown value for NSFileManagerItemReplacementOptions: $value"), - }; -} - -late final _sel_replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error_ = - objc.registerName( - "replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:"); -final _objc_msgSend_1cu34v2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_setUbiquitous_itemAtURL_destinationURL_error_ = - objc.registerName("setUbiquitous:itemAtURL:destinationURL:error:"); -final _objc_msgSend_191cxmu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_isUbiquitousItemAtURL_ = - objc.registerName("isUbiquitousItemAtURL:"); -late final _sel_startDownloadingUbiquitousItemAtURL_error_ = - objc.registerName("startDownloadingUbiquitousItemAtURL:error:"); -late final _sel_evictUbiquitousItemAtURL_error_ = - objc.registerName("evictUbiquitousItemAtURL:error:"); -late final _sel_URLForUbiquityContainerIdentifier_ = - objc.registerName("URLForUbiquityContainerIdentifier:"); -late final _sel_URLForPublishingUbiquitousItemAtURL_expirationDate_error_ = objc - .registerName("URLForPublishingUbiquitousItemAtURL:expirationDate:error:"); -final _objc_msgSend_1dca44n = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_ubiquityIdentityToken = - objc.registerName("ubiquityIdentityToken"); -void _ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSDictionary_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSDictionary?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSError_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: true, release: true), - arg1.address == 0 ? null : objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock - listener(void Function(objc.NSDictionary?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock( - wrapper, - retain: false, - release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSDictionary_NSError_CallExtension - on objc.ObjCBlock { - void call(objc.NSDictionary? arg0, objc.NSError? arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, arg1?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getFileProviderServicesForItemAtURL_completionHandler_ = - objc.registerName("getFileProviderServicesForItemAtURL:completionHandler:"); -ffi.Pointer - _ObjCBlock_objcObjCObject_NSError_NSString_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi - .NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_NSError_NSString_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_NSError_NSString_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_NSError_NSString_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_objcObjCObject_NSError_NSString_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_NSError_NSString_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock? Function(objc.NSError, objc.NSString)>`. -abstract final class ObjCBlock_objcObjCObject_NSError_NSString { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer? Function(objc.NSError, objc.NSString)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer? Function(objc.NSError, - objc.NSString)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock? Function(objc.NSError, objc.NSString)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock? Function(objc.NSError, objc.NSString)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_NSError_NSString_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock? Function(objc.NSError, objc.NSString)> - fromFunction( - objc.ObjCObjectBase? Function(objc.NSError, objc.NSString) fn) => - objc.ObjCBlock? Function(objc.NSError, objc.NSString)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_NSError_NSString_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn(objc.NSError.castFromPointer(arg0, retain: true, release: true), objc.NSString.castFromPointer(arg1, retain: true, release: true)) - ?.ref - .retainAndAutorelease() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock? Function(objc.NSError, objc.NSString)>`. -extension ObjCBlock_objcObjCObject_NSError_NSString_CallExtension - on objc.ObjCBlock< - ffi.Pointer? Function(objc.NSError, objc.NSString)> { - objc.ObjCObjectBase? call(objc.NSError arg0, objc.NSString arg1) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>() - (ref.pointer, arg0.ref.pointer, arg1.ref.pointer) - .address == - 0 - ? null - : objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast Function(ffi.Pointer block, ffi.Pointer arg0, ffi.Pointer arg1)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0.ref.pointer, arg1.ref.pointer), - retain: true, - release: true); -} - -final _objc_msgSend_cmbt6k = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_containerURLForSecurityApplicationGroupIdentifier_ = - objc.registerName("containerURLForSecurityApplicationGroupIdentifier:"); -late final _sel_homeDirectoryForCurrentUser = - objc.registerName("homeDirectoryForCurrentUser"); -late final _sel_temporaryDirectory = objc.registerName("temporaryDirectory"); -late final _sel_homeDirectoryForUser_ = - objc.registerName("homeDirectoryForUser:"); - -/// NSFileManager -class NSFileManager extends objc.NSObject { - NSFileManager._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFileManager] that points to the same underlying object as [other]. - NSFileManager.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFileManager] that wraps the given raw object pointer. - NSFileManager.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFileManager]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFileManager); - } - - /// defaultManager - static NSFileManager getDefaultManager() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSFileManager, _sel_defaultManager); - return NSFileManager.castFromPointer(_ret, retain: true, release: true); - } - - /// mountedVolumeURLsIncludingResourceValuesForKeys:options: - objc.NSArray? mountedVolumeURLsIncludingResourceValuesForKeys_options_( - objc.NSArray? propertyKeys, NSVolumeEnumerationOptions options) { - final _ret = _objc_msgSend_gyiq9w( - this.ref.pointer, - _sel_mountedVolumeURLsIncludingResourceValuesForKeys_options_, - propertyKeys?.ref.pointer ?? ffi.nullptr, - options.value); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// unmountVolumeAtURL:options:completionHandler: - void unmountVolumeAtURL_options_completionHandler_( - objc.NSURL url, - NSFileManagerUnmountOptions mask, - objc.ObjCBlock completionHandler) { - _objc_msgSend_yuugcv( - this.ref.pointer, - _sel_unmountVolumeAtURL_options_completionHandler_, - url.ref.pointer, - mask.value, - completionHandler.ref.pointer); - } - - /// contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: - objc.NSArray? - contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error_( - objc.NSURL url, - objc.NSArray? keys, - NSDirectoryEnumerationOptions mask, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1rn5oli( - this.ref.pointer, - _sel_contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error_, - url.ref.pointer, - keys?.ref.pointer ?? ffi.nullptr, - mask.value, - error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForDirectory:inDomains: - objc.NSArray URLsForDirectory_inDomains_( - NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask) { - final _ret = _objc_msgSend_1llbjq7(this.ref.pointer, - _sel_URLsForDirectory_inDomains_, directory.value, domainMask.value); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForDirectory:inDomain:appropriateForURL:create:error: - objc.NSURL? URLForDirectory_inDomain_appropriateForURL_create_error_( - NSSearchPathDirectory directory, - NSSearchPathDomainMask domain, - objc.NSURL? url, - bool shouldCreate, - ffi.Pointer> error) { - final _ret = _objc_msgSend_46p27t( - this.ref.pointer, - _sel_URLForDirectory_inDomain_appropriateForURL_create_error_, - directory.value, - domain.value, - url?.ref.pointer ?? ffi.nullptr, - shouldCreate, - error); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// getRelationship:ofDirectoryAtURL:toItemAtURL:error: - bool getRelationship_ofDirectoryAtURL_toItemAtURL_error_( - ffi.Pointer outRelationship, - objc.NSURL directoryURL, - objc.NSURL otherURL, - ffi.Pointer> error) { - return _objc_msgSend_17s8ocw( - this.ref.pointer, - _sel_getRelationship_ofDirectoryAtURL_toItemAtURL_error_, - outRelationship, - directoryURL.ref.pointer, - otherURL.ref.pointer, - error); - } - - /// getRelationship:ofDirectory:inDomain:toItemAtURL:error: - bool getRelationship_ofDirectory_inDomain_toItemAtURL_error_( - ffi.Pointer outRelationship, - NSSearchPathDirectory directory, - NSSearchPathDomainMask domainMask, - objc.NSURL url, - ffi.Pointer> error) { - return _objc_msgSend_9p3pl8( - this.ref.pointer, - _sel_getRelationship_ofDirectory_inDomain_toItemAtURL_error_, - outRelationship, - directory.value, - domainMask.value, - url.ref.pointer, - error); - } - - /// createDirectoryAtURL:withIntermediateDirectories:attributes:error: - bool createDirectoryAtURL_withIntermediateDirectories_attributes_error_( - objc.NSURL url, - bool createIntermediates, - objc.NSDictionary? attributes, - ffi.Pointer> error) { - return _objc_msgSend_16o5u5c( - this.ref.pointer, - _sel_createDirectoryAtURL_withIntermediateDirectories_attributes_error_, - url.ref.pointer, - createIntermediates, - attributes?.ref.pointer ?? ffi.nullptr, - error); - } - - /// createSymbolicLinkAtURL:withDestinationURL:error: - bool createSymbolicLinkAtURL_withDestinationURL_error_(objc.NSURL url, - objc.NSURL destURL, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_createSymbolicLinkAtURL_withDestinationURL_error_, - url.ref.pointer, - destURL.ref.pointer, - error); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// setAttributes:ofItemAtPath:error: - bool setAttributes_ofItemAtPath_error_(objc.NSDictionary attributes, - objc.NSString path, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_setAttributes_ofItemAtPath_error_, - attributes.ref.pointer, - path.ref.pointer, - error); - } - - /// createDirectoryAtPath:withIntermediateDirectories:attributes:error: - bool createDirectoryAtPath_withIntermediateDirectories_attributes_error_( - objc.NSString path, - bool createIntermediates, - objc.NSDictionary? attributes, - ffi.Pointer> error) { - return _objc_msgSend_16o5u5c( - this.ref.pointer, - _sel_createDirectoryAtPath_withIntermediateDirectories_attributes_error_, - path.ref.pointer, - createIntermediates, - attributes?.ref.pointer ?? ffi.nullptr, - error); - } - - /// contentsOfDirectoryAtPath:error: - objc.NSArray? contentsOfDirectoryAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_contentsOfDirectoryAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// subpathsOfDirectoryAtPath:error: - objc.NSArray? subpathsOfDirectoryAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_subpathsOfDirectoryAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// attributesOfItemAtPath:error: - objc.NSDictionary? attributesOfItemAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_attributesOfItemAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// attributesOfFileSystemForPath:error: - objc.NSDictionary? attributesOfFileSystemForPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_attributesOfFileSystemForPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// createSymbolicLinkAtPath:withDestinationPath:error: - bool createSymbolicLinkAtPath_withDestinationPath_error_(objc.NSString path, - objc.NSString destPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_createSymbolicLinkAtPath_withDestinationPath_error_, - path.ref.pointer, - destPath.ref.pointer, - error); - } - - /// destinationOfSymbolicLinkAtPath:error: - objc.NSString? destinationOfSymbolicLinkAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_destinationOfSymbolicLinkAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// copyItemAtPath:toPath:error: - bool copyItemAtPath_toPath_error_(objc.NSString srcPath, - objc.NSString dstPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_copyItemAtPath_toPath_error_, - srcPath.ref.pointer, - dstPath.ref.pointer, - error); - } - - /// moveItemAtPath:toPath:error: - bool moveItemAtPath_toPath_error_(objc.NSString srcPath, - objc.NSString dstPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_moveItemAtPath_toPath_error_, - srcPath.ref.pointer, - dstPath.ref.pointer, - error); - } - - /// linkItemAtPath:toPath:error: - bool linkItemAtPath_toPath_error_(objc.NSString srcPath, - objc.NSString dstPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_linkItemAtPath_toPath_error_, - srcPath.ref.pointer, - dstPath.ref.pointer, - error); - } - - /// removeItemAtPath:error: - bool removeItemAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_removeItemAtPath_error_, - path.ref.pointer, error); - } - - /// copyItemAtURL:toURL:error: - bool copyItemAtURL_toURL_error_(objc.NSURL srcURL, objc.NSURL dstURL, - ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_copyItemAtURL_toURL_error_, - srcURL.ref.pointer, - dstURL.ref.pointer, - error); - } - - /// moveItemAtURL:toURL:error: - bool moveItemAtURL_toURL_error_(objc.NSURL srcURL, objc.NSURL dstURL, - ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_moveItemAtURL_toURL_error_, - srcURL.ref.pointer, - dstURL.ref.pointer, - error); - } - - /// linkItemAtURL:toURL:error: - bool linkItemAtURL_toURL_error_(objc.NSURL srcURL, objc.NSURL dstURL, - ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_linkItemAtURL_toURL_error_, - srcURL.ref.pointer, - dstURL.ref.pointer, - error); - } - - /// removeItemAtURL:error: - bool removeItemAtURL_error_( - objc.NSURL URL, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_removeItemAtURL_error_, URL.ref.pointer, error); - } - - /// trashItemAtURL:resultingItemURL:error: - bool trashItemAtURL_resultingItemURL_error_( - objc.NSURL url, - ffi.Pointer> outResultingURL, - ffi.Pointer> error) { - return _objc_msgSend_to8xlo( - this.ref.pointer, - _sel_trashItemAtURL_resultingItemURL_error_, - url.ref.pointer, - outResultingURL, - error); - } - - /// fileAttributesAtPath:traverseLink: - objc.NSDictionary? fileAttributesAtPath_traverseLink_( - objc.NSString path, bool yorn) { - final _ret = _objc_msgSend_qqbb5y(this.ref.pointer, - _sel_fileAttributesAtPath_traverseLink_, path.ref.pointer, yorn); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// changeFileAttributes:atPath: - bool changeFileAttributes_atPath_( - objc.NSDictionary attributes, objc.NSString path) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_changeFileAttributes_atPath_, - attributes.ref.pointer, - path.ref.pointer); - } - - /// directoryContentsAtPath: - objc.NSArray? directoryContentsAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_directoryContentsAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// fileSystemAttributesAtPath: - objc.NSDictionary? fileSystemAttributesAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_fileSystemAttributesAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// pathContentOfSymbolicLinkAtPath: - objc.NSString? pathContentOfSymbolicLinkAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_pathContentOfSymbolicLinkAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// createSymbolicLinkAtPath:pathContent: - bool createSymbolicLinkAtPath_pathContent_( - objc.NSString path, objc.NSString otherpath) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_createSymbolicLinkAtPath_pathContent_, - path.ref.pointer, - otherpath.ref.pointer); - } - - /// createDirectoryAtPath:attributes: - bool createDirectoryAtPath_attributes_( - objc.NSString path, objc.NSDictionary attributes) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_createDirectoryAtPath_attributes_, - path.ref.pointer, - attributes.ref.pointer); - } - - /// linkPath:toPath:handler: - bool linkPath_toPath_handler_( - objc.NSString src, objc.NSString dest, objc.ObjCObjectBase? handler) { - return _objc_msgSend_hukaf0(this.ref.pointer, _sel_linkPath_toPath_handler_, - src.ref.pointer, dest.ref.pointer, handler?.ref.pointer ?? ffi.nullptr); - } - - /// copyPath:toPath:handler: - bool copyPath_toPath_handler_( - objc.NSString src, objc.NSString dest, objc.ObjCObjectBase? handler) { - return _objc_msgSend_hukaf0(this.ref.pointer, _sel_copyPath_toPath_handler_, - src.ref.pointer, dest.ref.pointer, handler?.ref.pointer ?? ffi.nullptr); - } - - /// movePath:toPath:handler: - bool movePath_toPath_handler_( - objc.NSString src, objc.NSString dest, objc.ObjCObjectBase? handler) { - return _objc_msgSend_hukaf0(this.ref.pointer, _sel_movePath_toPath_handler_, - src.ref.pointer, dest.ref.pointer, handler?.ref.pointer ?? ffi.nullptr); - } - - /// removeFileAtPath:handler: - bool removeFileAtPath_handler_( - objc.NSString path, objc.ObjCObjectBase? handler) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_removeFileAtPath_handler_, - path.ref.pointer, - handler?.ref.pointer ?? ffi.nullptr); - } - - /// currentDirectoryPath - objc.NSString get currentDirectoryPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDirectoryPath); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// changeCurrentDirectoryPath: - bool changeCurrentDirectoryPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_changeCurrentDirectoryPath_, path.ref.pointer); - } - - /// fileExistsAtPath: - bool fileExistsAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_fileExistsAtPath_, path.ref.pointer); - } - - /// fileExistsAtPath:isDirectory: - bool fileExistsAtPath_isDirectory_( - objc.NSString path, ffi.Pointer isDirectory) { - return _objc_msgSend_rtz5p9(this.ref.pointer, - _sel_fileExistsAtPath_isDirectory_, path.ref.pointer, isDirectory); - } - - /// isReadableFileAtPath: - bool isReadableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isReadableFileAtPath_, path.ref.pointer); - } - - /// isWritableFileAtPath: - bool isWritableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isWritableFileAtPath_, path.ref.pointer); - } - - /// isExecutableFileAtPath: - bool isExecutableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isExecutableFileAtPath_, path.ref.pointer); - } - - /// isDeletableFileAtPath: - bool isDeletableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDeletableFileAtPath_, path.ref.pointer); - } - - /// contentsEqualAtPath:andPath: - bool contentsEqualAtPath_andPath_(objc.NSString path1, objc.NSString path2) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_contentsEqualAtPath_andPath_, - path1.ref.pointer, - path2.ref.pointer); - } - - /// displayNameAtPath: - objc.NSString displayNameAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_displayNameAtPath_, path.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// componentsToDisplayForPath: - objc.NSArray? componentsToDisplayForPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_componentsToDisplayForPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// enumeratorAtPath: - objc.ObjCObjectBase? enumeratorAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_enumeratorAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: - objc.ObjCObjectBase? - enumeratorAtURL_includingPropertiesForKeys_options_errorHandler_( - objc.NSURL url, - objc.NSArray? keys, - NSDirectoryEnumerationOptions mask, - objc.ObjCBlock? - handler) { - final _ret = _objc_msgSend_40k0lk( - this.ref.pointer, - _sel_enumeratorAtURL_includingPropertiesForKeys_options_errorHandler_, - url.ref.pointer, - keys?.ref.pointer ?? ffi.nullptr, - mask.value, - handler?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// subpathsAtPath: - objc.NSArray? subpathsAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_subpathsAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// contentsAtPath: - objc.NSData? contentsAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_contentsAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// createFileAtPath:contents:attributes: - bool createFileAtPath_contents_attributes_( - objc.NSString path, objc.NSData? data, objc.NSDictionary? attr) { - return _objc_msgSend_hukaf0( - this.ref.pointer, - _sel_createFileAtPath_contents_attributes_, - path.ref.pointer, - data?.ref.pointer ?? ffi.nullptr, - attr?.ref.pointer ?? ffi.nullptr); - } - - /// fileSystemRepresentationWithPath: - ffi.Pointer fileSystemRepresentationWithPath_(objc.NSString path) { - return _objc_msgSend_t1v5su(this.ref.pointer, - _sel_fileSystemRepresentationWithPath_, path.ref.pointer); - } - - /// stringWithFileSystemRepresentation:length: - objc.NSString stringWithFileSystemRepresentation_length_( - ffi.Pointer str, int len) { - final _ret = _objc_msgSend_1t5rcq1(this.ref.pointer, - _sel_stringWithFileSystemRepresentation_length_, str, len); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error: - bool - replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error_( - objc.NSURL originalItemURL, - objc.NSURL newItemURL, - objc.NSString? backupItemName, - NSFileManagerItemReplacementOptions options, - ffi.Pointer> resultingURL, - ffi.Pointer> error) { - return _objc_msgSend_1cu34v2( - this.ref.pointer, - _sel_replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error_, - originalItemURL.ref.pointer, - newItemURL.ref.pointer, - backupItemName?.ref.pointer ?? ffi.nullptr, - options.value, - resultingURL, - error); - } - - /// setUbiquitous:itemAtURL:destinationURL:error: - bool setUbiquitous_itemAtURL_destinationURL_error_( - bool flag, - objc.NSURL url, - objc.NSURL destinationURL, - ffi.Pointer> error) { - return _objc_msgSend_191cxmu( - this.ref.pointer, - _sel_setUbiquitous_itemAtURL_destinationURL_error_, - flag, - url.ref.pointer, - destinationURL.ref.pointer, - error); - } - - /// isUbiquitousItemAtURL: - bool isUbiquitousItemAtURL_(objc.NSURL url) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isUbiquitousItemAtURL_, url.ref.pointer); - } - - /// startDownloadingUbiquitousItemAtURL:error: - bool startDownloadingUbiquitousItemAtURL_error_( - objc.NSURL url, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, - _sel_startDownloadingUbiquitousItemAtURL_error_, - url.ref.pointer, - error); - } - - /// evictUbiquitousItemAtURL:error: - bool evictUbiquitousItemAtURL_error_( - objc.NSURL url, ffi.Pointer> error) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_evictUbiquitousItemAtURL_error_, url.ref.pointer, error); - } - - /// URLForUbiquityContainerIdentifier: - objc.NSURL? URLForUbiquityContainerIdentifier_( - objc.NSString? containerIdentifier) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_URLForUbiquityContainerIdentifier_, - containerIdentifier?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForPublishingUbiquitousItemAtURL:expirationDate:error: - objc.NSURL? URLForPublishingUbiquitousItemAtURL_expirationDate_error_( - objc.NSURL url, - ffi.Pointer> outDate, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1dca44n( - this.ref.pointer, - _sel_URLForPublishingUbiquitousItemAtURL_expirationDate_error_, - url.ref.pointer, - outDate, - error); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// ubiquityIdentityToken - objc.ObjCObjectBase? get ubiquityIdentityToken { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_ubiquityIdentityToken); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// getFileProviderServicesForItemAtURL:completionHandler: - void getFileProviderServicesForItemAtURL_completionHandler_( - objc.NSURL url, - objc.ObjCBlock - completionHandler) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_getFileProviderServicesForItemAtURL_completionHandler_, - url.ref.pointer, - completionHandler.ref.pointer); - } - - /// containerURLForSecurityApplicationGroupIdentifier: - objc.NSURL? containerURLForSecurityApplicationGroupIdentifier_( - objc.NSString groupIdentifier) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_containerURLForSecurityApplicationGroupIdentifier_, - groupIdentifier.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// homeDirectoryForCurrentUser - objc.NSURL get homeDirectoryForCurrentUser { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_homeDirectoryForCurrentUser); - return objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// temporaryDirectory - objc.NSURL get temporaryDirectory { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_temporaryDirectory); - return objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// homeDirectoryForUser: - objc.NSURL? homeDirectoryForUser_(objc.NSString userName) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_homeDirectoryForUser_, userName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSFileManager init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFileManager new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileManager, _sel_new); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFileManager allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFileManager, _sel_allocWithZone_, zone); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFileManager alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileManager, _sel_alloc); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFileManager, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFileManager, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFileManager, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFileManager, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFileManager, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFileManager, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFileManager, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileManager, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileManager, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSHTTPCookieStorage = objc.getClass("NSHTTPCookieStorage"); -late final _sel_sharedHTTPCookieStorage = - objc.registerName("sharedHTTPCookieStorage"); -late final _sel_sharedCookieStorageForGroupContainerIdentifier_ = - objc.registerName("sharedCookieStorageForGroupContainerIdentifier:"); -late final _sel_cookies = objc.registerName("cookies"); -late final _class_NSHTTPCookie = objc.getClass("NSHTTPCookie"); -late final _sel_initWithProperties_ = objc.registerName("initWithProperties:"); -late final _sel_cookieWithProperties_ = - objc.registerName("cookieWithProperties:"); -late final _sel_requestHeaderFieldsWithCookies_ = - objc.registerName("requestHeaderFieldsWithCookies:"); -late final _sel_cookiesWithResponseHeaderFields_forURL_ = - objc.registerName("cookiesWithResponseHeaderFields:forURL:"); -late final _sel_properties = objc.registerName("properties"); -late final _sel_version = objc.registerName("version"); -late final _sel_value = objc.registerName("value"); -late final _sel_expiresDate = objc.registerName("expiresDate"); -late final _sel_isSessionOnly = objc.registerName("isSessionOnly"); -late final _sel_domain = objc.registerName("domain"); -late final _sel_path = objc.registerName("path"); -late final _sel_isSecure = objc.registerName("isSecure"); -late final _sel_isHTTPOnly = objc.registerName("isHTTPOnly"); -late final _sel_comment = objc.registerName("comment"); -late final _sel_commentURL = objc.registerName("commentURL"); -late final _sel_portList = objc.registerName("portList"); -late final _sel_sameSitePolicy = objc.registerName("sameSitePolicy"); - -/// NSHTTPCookie -class NSHTTPCookie extends objc.NSObject { - NSHTTPCookie._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSHTTPCookie] that points to the same underlying object as [other]. - NSHTTPCookie.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSHTTPCookie] that wraps the given raw object pointer. - NSHTTPCookie.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSHTTPCookie]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSHTTPCookie); - } - - /// initWithProperties: - NSHTTPCookie? initWithProperties_(objc.NSDictionary properties) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithProperties_, properties.ref.pointer); - return _ret.address == 0 - ? null - : NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// cookieWithProperties: - static NSHTTPCookie? cookieWithProperties_(objc.NSDictionary properties) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookie, - _sel_cookieWithProperties_, properties.ref.pointer); - return _ret.address == 0 - ? null - : NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } - - /// requestHeaderFieldsWithCookies: - static objc.NSDictionary requestHeaderFieldsWithCookies_( - objc.NSArray cookies) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookie, - _sel_requestHeaderFieldsWithCookies_, cookies.ref.pointer); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// cookiesWithResponseHeaderFields:forURL: - static objc.NSArray cookiesWithResponseHeaderFields_forURL_( - objc.NSDictionary headerFields, objc.NSURL URL) { - final _ret = _objc_msgSend_iq11qg( - _class_NSHTTPCookie, - _sel_cookiesWithResponseHeaderFields_forURL_, - headerFields.ref.pointer, - URL.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// properties - objc.NSDictionary? get properties { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_properties); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// version - int get version { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_version); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// value - objc.NSString get value { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// expiresDate - objc.NSDate? get expiresDate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_expiresDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// isSessionOnly - bool get sessionOnly { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSessionOnly); - } - - /// domain - objc.NSString get domain { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_domain); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// path - objc.NSString get path { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_path); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isSecure - bool get secure { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSecure); - } - - /// isHTTPOnly - bool get HTTPOnly { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isHTTPOnly); - } - - /// comment - objc.NSString? get comment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_comment); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// commentURL - objc.NSURL? get commentURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commentURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// portList - objc.NSArray? get portList { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_portList); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// sameSitePolicy - objc.NSString? get sameSitePolicy { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sameSitePolicy); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSHTTPCookie init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSHTTPCookie new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookie, _sel_new); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSHTTPCookie allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSHTTPCookie, _sel_allocWithZone_, zone); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSHTTPCookie alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookie, _sel_alloc); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSHTTPCookie, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSHTTPCookie, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSHTTPCookie, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSHTTPCookie, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookie, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSHTTPCookie, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSHTTPCookie, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookie, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookie, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSHTTPCookie self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSHTTPCookie retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSHTTPCookie autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_setCookie_ = objc.registerName("setCookie:"); -late final _sel_deleteCookie_ = objc.registerName("deleteCookie:"); -late final _sel_removeCookiesSinceDate_ = - objc.registerName("removeCookiesSinceDate:"); -late final _sel_cookiesForURL_ = objc.registerName("cookiesForURL:"); -late final _sel_setCookies_forURL_mainDocumentURL_ = - objc.registerName("setCookies:forURL:mainDocumentURL:"); -final _objc_msgSend_tenbla = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); - -enum NSHTTPCookieAcceptPolicy { - NSHTTPCookieAcceptPolicyAlways(0), - NSHTTPCookieAcceptPolicyNever(1), - NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain(2); - - final int value; - const NSHTTPCookieAcceptPolicy(this.value); - - static NSHTTPCookieAcceptPolicy fromValue(int value) => switch (value) { - 0 => NSHTTPCookieAcceptPolicyAlways, - 1 => NSHTTPCookieAcceptPolicyNever, - 2 => NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain, - _ => throw ArgumentError( - "Unknown value for NSHTTPCookieAcceptPolicy: $value"), - }; -} - -late final _sel_cookieAcceptPolicy = objc.registerName("cookieAcceptPolicy"); -final _objc_msgSend_1jpuqgg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setCookieAcceptPolicy_ = - objc.registerName("setCookieAcceptPolicy:"); -final _objc_msgSend_199e8fv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_sortedCookiesUsingDescriptors_ = - objc.registerName("sortedCookiesUsingDescriptors:"); -late final _class_NSURLSessionTask = objc.getClass("NSURLSessionTask"); -late final _sel_isEqual_ = objc.registerName("isEqual:"); -bool _ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_objcObjCObject_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCObject_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCObject_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. -abstract final class ObjCBlock_bool_ffiVoid_objcObjCObject { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer)> - fromFunction( - bool Function(ffi.Pointer, objc.ObjCObjectBase) fn) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_bool_ffiVoid_objcObjCObject_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, objc.ObjCObjectBase(arg1, retain: true, release: true))), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. -extension ObjCBlock_bool_ffiVoid_objcObjCObject_CallExtension on objc.ObjCBlock< - ffi.Bool Function(ffi.Pointer, ffi.Pointer)> { - bool call(ffi.Pointer arg0, objc.ObjCObjectBase arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer); -} - -late final _sel_class = objc.registerName("class"); -late final _sel_performSelector_ = objc.registerName("performSelector:"); -final _objc_msgSend_12790oz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer) fn) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, arg1).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_CallExtension - on objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, ffi.Pointer arg1) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0, arg1), - retain: true, - release: true); -} - -late final _sel_performSelector_withObject_ = - objc.registerName("performSelector:withObject:"); -final _objc_msgSend_1g3ang8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer, objc.ObjCObjectBase) fn) => - objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn(arg0, arg1, objc.ObjCObjectBase(arg2, retain: true, release: true)) - .ref - .retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_CallExtension - on objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> { - objc.ObjCObjectBase call(ffi.Pointer arg0, - ffi.Pointer arg1, objc.ObjCObjectBase arg2) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0, arg1, arg2.ref.pointer), - retain: true, - release: true); -} - -late final _sel_performSelector_withObject_withObject_ = - objc.registerName("performSelector:withObject:withObject:"); -final _objc_msgSend_1f2tuqz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer, objc.ObjCObjectBase, objc.ObjCObjectBase) fn) => - objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3) => - fn(arg0, arg1, objc.ObjCObjectBase(arg2, retain: true, release: true), objc.ObjCObjectBase(arg3, retain: true, release: true)) - .ref - .retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_CallExtension - on objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, - ffi.Pointer arg1, - objc.ObjCObjectBase arg2, - objc.ObjCObjectBase arg3) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0, arg1, arg2.ref.pointer, arg3.ref.pointer), - retain: true, - release: true); -} - -late final _sel_isProxy = objc.registerName("isProxy"); -late final _sel_isMemberOfClass_ = objc.registerName("isMemberOfClass:"); -late final _sel_conformsToProtocol_ = objc.registerName("conformsToProtocol:"); -bool _ObjCBlock_bool_ffiVoid_Protocol_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_Protocol_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_Protocol_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_Protocol_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_Protocol_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_Protocol_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock, objc.Protocol)>`. -abstract final class ObjCBlock_bool_ffiVoid_Protocol { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock, objc.Protocol)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Bool Function(ffi.Pointer, - objc.Protocol)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.Protocol)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, objc.Protocol)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_Protocol_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.Protocol)> - fromFunction(bool Function(ffi.Pointer, objc.Protocol) fn) => - objc.ObjCBlock, objc.Protocol)>( - objc.newClosureBlock( - _ObjCBlock_bool_ffiVoid_Protocol_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn( - arg0, - objc.Protocol.castFromPointer(arg1, - retain: true, release: true))), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, objc.Protocol)>`. -extension ObjCBlock_bool_ffiVoid_Protocol_CallExtension - on objc.ObjCBlock, objc.Protocol)> { - bool call(ffi.Pointer arg0, objc.Protocol arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer); -} - -late final _sel_respondsToSelector_ = objc.registerName("respondsToSelector:"); -final _objc_msgSend_8d7dvc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -bool _ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. -abstract final class ObjCBlock_bool_ffiVoid_objcObjCSelector { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock, ffi.Pointer)> - fromFunction(bool Function(ffi.Pointer, ffi.Pointer) fn) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, arg1)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. -extension ObjCBlock_bool_ffiVoid_objcObjCSelector_CallExtension - on objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)> { - bool call(ffi.Pointer arg0, ffi.Pointer arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0, arg1); -} - -late final _sel_release = objc.registerName("release"); -void _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_ffiVoid_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_ffiVoid_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - void Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock(_ObjCBlock_ffiVoid_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock)> listener( - void Function(ffi.Pointer) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_ffiVoid_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_hepzs(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock)>(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_ffiVoid_CallExtension - on objc.ObjCBlock)> { - void call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_retainCount = objc.registerName("retainCount"); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrTrampoline, 0) - .cast(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiUnsignedLong_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(int Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiUnsignedLong_ffiVoid_CallExtension - on objc.ObjCBlock)> { - int call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_zone = objc.registerName("zone"); -final _objc_msgSend_j04r6g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>(); -ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSZone_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer<_NSZone> Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSZone_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSZone_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. -abstract final class ObjCBlock_NSZone_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock Function(ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock Function(ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_NSZone_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunction(ffi.Pointer<_NSZone> Function(ffi.Pointer) fn) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newClosureBlock(_ObjCBlock_NSZone_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. -extension ObjCBlock_NSZone_ffiVoid_CallExtension - on objc.ObjCBlock Function(ffi.Pointer)> { - ffi.Pointer<_NSZone> call(ffi.Pointer arg0) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_hash = objc.registerName("hash"); -late final _sel_superclass = objc.registerName("superclass"); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSString_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSString_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSString_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock(_ObjCBlock_NSString_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(objc.NSString Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSString_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSString_ffiVoid_CallExtension - on objc.ObjCBlock)> { - objc.NSString call(ffi.Pointer arg0) => - objc.NSString.castFromPointer( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -late final _sel_debugDescription = objc.registerName("debugDescription"); -late final _sel_progress = objc.registerName("progress"); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSProgress_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSProgress_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSProgress_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_NSProgress_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(NSProgress Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSProgress_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSProgress_ffiVoid_CallExtension - on objc.ObjCBlock)> { - NSProgress call(ffi.Pointer arg0) => NSProgress.castFromPointer( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -late final _sel_taskIdentifier = objc.registerName("taskIdentifier"); -late final _class_NSURLRequest = objc.getClass("NSURLRequest"); -late final _sel_requestWithURL_ = objc.registerName("requestWithURL:"); - -enum NSURLRequestCachePolicy { - NSURLRequestUseProtocolCachePolicy(0), - NSURLRequestReloadIgnoringLocalCacheData(1), - NSURLRequestReloadIgnoringLocalAndRemoteCacheData(4), - NSURLRequestReturnCacheDataElseLoad(2), - NSURLRequestReturnCacheDataDontLoad(3), - NSURLRequestReloadRevalidatingCacheData(5); - - static const NSURLRequestReloadIgnoringCacheData = - NSURLRequestReloadIgnoringLocalCacheData; - - final int value; - const NSURLRequestCachePolicy(this.value); - - static NSURLRequestCachePolicy fromValue(int value) => switch (value) { - 0 => NSURLRequestUseProtocolCachePolicy, - 1 => NSURLRequestReloadIgnoringLocalCacheData, - 4 => NSURLRequestReloadIgnoringLocalAndRemoteCacheData, - 2 => NSURLRequestReturnCacheDataElseLoad, - 3 => NSURLRequestReturnCacheDataDontLoad, - 5 => NSURLRequestReloadRevalidatingCacheData, - _ => throw ArgumentError( - "Unknown value for NSURLRequestCachePolicy: $value"), - }; - - @override - String toString() { - if (this == NSURLRequestReloadIgnoringLocalCacheData) - return "NSURLRequestCachePolicy.NSURLRequestReloadIgnoringLocalCacheData, NSURLRequestCachePolicy.NSURLRequestReloadIgnoringCacheData"; - return super.toString(); - } -} - -late final _sel_requestWithURL_cachePolicy_timeoutInterval_ = - objc.registerName("requestWithURL:cachePolicy:timeoutInterval:"); -final _objc_msgSend_191svj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Double)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - double)>(); -late final _sel_initWithURL_cachePolicy_timeoutInterval_ = - objc.registerName("initWithURL:cachePolicy:timeoutInterval:"); -late final _sel_URL = objc.registerName("URL"); -late final _sel_cachePolicy = objc.registerName("cachePolicy"); -final _objc_msgSend_2xak1q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_timeoutInterval = objc.registerName("timeoutInterval"); -late final _sel_mainDocumentURL = objc.registerName("mainDocumentURL"); - -enum NSURLRequestNetworkServiceType { - NSURLNetworkServiceTypeDefault(0), - NSURLNetworkServiceTypeVoIP(1), - NSURLNetworkServiceTypeVideo(2), - NSURLNetworkServiceTypeBackground(3), - NSURLNetworkServiceTypeVoice(4), - NSURLNetworkServiceTypeResponsiveData(6), - NSURLNetworkServiceTypeAVStreaming(8), - NSURLNetworkServiceTypeResponsiveAV(9), - NSURLNetworkServiceTypeCallSignaling(11); - - final int value; - const NSURLRequestNetworkServiceType(this.value); - - static NSURLRequestNetworkServiceType fromValue(int value) => switch (value) { - 0 => NSURLNetworkServiceTypeDefault, - 1 => NSURLNetworkServiceTypeVoIP, - 2 => NSURLNetworkServiceTypeVideo, - 3 => NSURLNetworkServiceTypeBackground, - 4 => NSURLNetworkServiceTypeVoice, - 6 => NSURLNetworkServiceTypeResponsiveData, - 8 => NSURLNetworkServiceTypeAVStreaming, - 9 => NSURLNetworkServiceTypeResponsiveAV, - 11 => NSURLNetworkServiceTypeCallSignaling, - _ => throw ArgumentError( - "Unknown value for NSURLRequestNetworkServiceType: $value"), - }; -} - -late final _sel_networkServiceType = objc.registerName("networkServiceType"); -final _objc_msgSend_ttt73t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_allowsCellularAccess = - objc.registerName("allowsCellularAccess"); -late final _sel_allowsExpensiveNetworkAccess = - objc.registerName("allowsExpensiveNetworkAccess"); -late final _sel_allowsConstrainedNetworkAccess = - objc.registerName("allowsConstrainedNetworkAccess"); -late final _sel_assumesHTTP3Capable = objc.registerName("assumesHTTP3Capable"); - -enum NSURLRequestAttribution { - NSURLRequestAttributionDeveloper(0), - NSURLRequestAttributionUser(1); - - final int value; - const NSURLRequestAttribution(this.value); - - static NSURLRequestAttribution fromValue(int value) => switch (value) { - 0 => NSURLRequestAttributionDeveloper, - 1 => NSURLRequestAttributionUser, - _ => throw ArgumentError( - "Unknown value for NSURLRequestAttribution: $value"), - }; -} - -late final _sel_attribution = objc.registerName("attribution"); -final _objc_msgSend_t5yka9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_requiresDNSSECValidation = - objc.registerName("requiresDNSSECValidation"); -late final _sel_HTTPMethod = objc.registerName("HTTPMethod"); -late final _sel_allHTTPHeaderFields = objc.registerName("allHTTPHeaderFields"); -late final _sel_valueForHTTPHeaderField_ = - objc.registerName("valueForHTTPHeaderField:"); -late final _sel_HTTPBody = objc.registerName("HTTPBody"); -late final _sel_HTTPBodyStream = objc.registerName("HTTPBodyStream"); -late final _sel_HTTPShouldHandleCookies = - objc.registerName("HTTPShouldHandleCookies"); -late final _sel_HTTPShouldUsePipelining = - objc.registerName("HTTPShouldUsePipelining"); - -/// NSURLRequest -class NSURLRequest extends objc.NSObject { - NSURLRequest._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLRequest] that points to the same underlying object as [other]. - NSURLRequest.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLRequest] that wraps the given raw object pointer. - NSURLRequest.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLRequest]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLRequest); - } - - /// requestWithURL: - static NSURLRequest requestWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - _class_NSURLRequest, _sel_requestWithURL_, URL.ref.pointer); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool getSupportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSURLRequest, _sel_supportsSecureCoding); - } - - /// requestWithURL:cachePolicy:timeoutInterval: - static NSURLRequest requestWithURL_cachePolicy_timeoutInterval_( - objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, - double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - _class_NSURLRequest, - _sel_requestWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithURL: - NSURLRequest initWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, URL.ref.pointer); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithURL:cachePolicy:timeoutInterval: - NSURLRequest initWithURL_cachePolicy_timeoutInterval_(objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// cachePolicy - NSURLRequestCachePolicy get cachePolicy { - final _ret = _objc_msgSend_2xak1q(this.ref.pointer, _sel_cachePolicy); - return NSURLRequestCachePolicy.fromValue(_ret); - } - - /// timeoutInterval - double get timeoutInterval { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_timeoutInterval) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeoutInterval); - } - - /// mainDocumentURL - objc.NSURL? get mainDocumentURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mainDocumentURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// networkServiceType - NSURLRequestNetworkServiceType get networkServiceType { - final _ret = - _objc_msgSend_ttt73t(this.ref.pointer, _sel_networkServiceType); - return NSURLRequestNetworkServiceType.fromValue(_ret); - } - - /// allowsCellularAccess - bool get allowsCellularAccess { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsCellularAccess); - } - - /// allowsExpensiveNetworkAccess - bool get allowsExpensiveNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExpensiveNetworkAccess); - } - - /// allowsConstrainedNetworkAccess - bool get allowsConstrainedNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsConstrainedNetworkAccess); - } - - /// assumesHTTP3Capable - bool get assumesHTTP3Capable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_assumesHTTP3Capable); - } - - /// attribution - NSURLRequestAttribution get attribution { - final _ret = _objc_msgSend_t5yka9(this.ref.pointer, _sel_attribution); - return NSURLRequestAttribution.fromValue(_ret); - } - - /// requiresDNSSECValidation - bool get requiresDNSSECValidation { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_requiresDNSSECValidation); - } - - /// HTTPMethod - objc.NSString? get HTTPMethod { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPMethod); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// allHTTPHeaderFields - objc.NSDictionary? get allHTTPHeaderFields { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allHTTPHeaderFields); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// valueForHTTPHeaderField: - objc.NSString? valueForHTTPHeaderField_(objc.NSString field) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_valueForHTTPHeaderField_, field.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// HTTPBody - objc.NSData? get HTTPBody { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBody); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// HTTPBodyStream - objc.NSInputStream? get HTTPBodyStream { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBodyStream); - return _ret.address == 0 - ? null - : objc.NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// HTTPShouldHandleCookies - bool get HTTPShouldHandleCookies { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldHandleCookies); - } - - /// HTTPShouldUsePipelining - bool get HTTPShouldUsePipelining { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldUsePipelining); - } - - /// init - NSURLRequest init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLRequest new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLRequest, _sel_new); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLRequest allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLRequest, _sel_allocWithZone_, zone); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLRequest alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLRequest, _sel_alloc); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLRequest, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLRequest, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLRequest, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLRequest, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLRequest, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLRequest, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLRequest, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLRequest self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLRequest retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLRequest autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLRequest? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_originalRequest = objc.registerName("originalRequest"); -late final _sel_currentRequest = objc.registerName("currentRequest"); -late final _class_NSURLResponse = objc.getClass("NSURLResponse"); -late final _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_ = - objc.registerName( - "initWithURL:MIMEType:expectedContentLength:textEncodingName:"); -final _objc_msgSend_eyseqq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_MIMEType = objc.registerName("MIMEType"); -late final _sel_expectedContentLength = - objc.registerName("expectedContentLength"); -final _objc_msgSend_e94jsr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.LongLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_textEncodingName = objc.registerName("textEncodingName"); -late final _sel_suggestedFilename = objc.registerName("suggestedFilename"); - -/// NSURLResponse -class NSURLResponse extends objc.NSObject { - NSURLResponse._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLResponse] that points to the same underlying object as [other]. - NSURLResponse.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLResponse] that wraps the given raw object pointer. - NSURLResponse.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLResponse]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLResponse); - } - - /// initWithURL:MIMEType:expectedContentLength:textEncodingName: - NSURLResponse initWithURL_MIMEType_expectedContentLength_textEncodingName_( - objc.NSURL URL, - objc.NSString? MIMEType, - int length, - objc.NSString? name) { - final _ret = _objc_msgSend_eyseqq( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_, - URL.ref.pointer, - MIMEType?.ref.pointer ?? ffi.nullptr, - length, - name?.ref.pointer ?? ffi.nullptr); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// MIMEType - objc.NSString? get MIMEType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_MIMEType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// expectedContentLength - int get expectedContentLength { - return _objc_msgSend_e94jsr(this.ref.pointer, _sel_expectedContentLength); - } - - /// textEncodingName - objc.NSString? get textEncodingName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_textEncodingName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// suggestedFilename - objc.NSString? get suggestedFilename { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suggestedFilename); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLResponse init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLResponse new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLResponse, _sel_new); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLResponse allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLResponse, _sel_allocWithZone_, zone); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLResponse alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLResponse, _sel_alloc); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLResponse, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLResponse, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLResponse, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLResponse, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLResponse, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLResponse, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLResponse, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLResponse self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLResponse retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLResponse autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSURLResponse, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLResponse? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_response = objc.registerName("response"); -late final _sel_earliestBeginDate = objc.registerName("earliestBeginDate"); -late final _sel_setEarliestBeginDate_ = - objc.registerName("setEarliestBeginDate:"); -late final _sel_countOfBytesClientExpectsToSend = - objc.registerName("countOfBytesClientExpectsToSend"); -late final _sel_setCountOfBytesClientExpectsToSend_ = - objc.registerName("setCountOfBytesClientExpectsToSend:"); -late final _sel_countOfBytesClientExpectsToReceive = - objc.registerName("countOfBytesClientExpectsToReceive"); -late final _sel_setCountOfBytesClientExpectsToReceive_ = - objc.registerName("setCountOfBytesClientExpectsToReceive:"); -late final _sel_countOfBytesSent = objc.registerName("countOfBytesSent"); -late final _sel_countOfBytesReceived = - objc.registerName("countOfBytesReceived"); -late final _sel_countOfBytesExpectedToSend = - objc.registerName("countOfBytesExpectedToSend"); -late final _sel_countOfBytesExpectedToReceive = - objc.registerName("countOfBytesExpectedToReceive"); -late final _sel_taskDescription = objc.registerName("taskDescription"); -late final _sel_setTaskDescription_ = objc.registerName("setTaskDescription:"); - -enum NSURLSessionTaskState { - NSURLSessionTaskStateRunning(0), - NSURLSessionTaskStateSuspended(1), - NSURLSessionTaskStateCanceling(2), - NSURLSessionTaskStateCompleted(3); - - final int value; - const NSURLSessionTaskState(this.value); - - static NSURLSessionTaskState fromValue(int value) => switch (value) { - 0 => NSURLSessionTaskStateRunning, - 1 => NSURLSessionTaskStateSuspended, - 2 => NSURLSessionTaskStateCanceling, - 3 => NSURLSessionTaskStateCompleted, - _ => throw ArgumentError( - "Unknown value for NSURLSessionTaskState: $value"), - }; -} - -late final _sel_state = objc.registerName("state"); -final _objc_msgSend_8b7yc1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_error = objc.registerName("error"); -late final _sel_suspend = objc.registerName("suspend"); -late final _sel_priority = objc.registerName("priority"); -final _objc_msgSend_fcilgx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_fcilgxFpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPriority_ = objc.registerName("setPriority:"); -final _objc_msgSend_s9gjzc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Float)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_prefersIncrementalDelivery = - objc.registerName("prefersIncrementalDelivery"); -late final _sel_setPrefersIncrementalDelivery_ = - objc.registerName("setPrefersIncrementalDelivery:"); - -/// NSURLSessionTask -class NSURLSessionTask extends objc.NSObject { - NSURLSessionTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionTask] that points to the same underlying object as [other]. - NSURLSessionTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionTask] that wraps the given raw object pointer. - NSURLSessionTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionTask); - } - - /// taskIdentifier - int get taskIdentifier { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_taskIdentifier); - } - - /// originalRequest - NSURLRequest? get originalRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_originalRequest); - return _ret.address == 0 - ? null - : NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// currentRequest - NSURLRequest? get currentRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentRequest); - return _ret.address == 0 - ? null - : NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// response - NSURLResponse? get response { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_response); - return _ret.address == 0 - ? null - : NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// progress - NSProgress get progress { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_progress); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// earliestBeginDate - objc.NSDate? get earliestBeginDate { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_earliestBeginDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setEarliestBeginDate: - set earliestBeginDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setEarliestBeginDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// countOfBytesClientExpectsToSend - int get countOfBytesClientExpectsToSend { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesClientExpectsToSend); - } - - /// setCountOfBytesClientExpectsToSend: - set countOfBytesClientExpectsToSend(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setCountOfBytesClientExpectsToSend_, value); - } - - /// countOfBytesClientExpectsToReceive - int get countOfBytesClientExpectsToReceive { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesClientExpectsToReceive); - } - - /// setCountOfBytesClientExpectsToReceive: - set countOfBytesClientExpectsToReceive(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setCountOfBytesClientExpectsToReceive_, value); - } - - /// countOfBytesSent - int get countOfBytesSent { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_countOfBytesSent); - } - - /// countOfBytesReceived - int get countOfBytesReceived { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_countOfBytesReceived); - } - - /// countOfBytesExpectedToSend - int get countOfBytesExpectedToSend { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesExpectedToSend); - } - - /// countOfBytesExpectedToReceive - int get countOfBytesExpectedToReceive { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesExpectedToReceive); - } - - /// taskDescription - objc.NSString? get taskDescription { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_taskDescription); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setTaskDescription: - set taskDescription(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setTaskDescription_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// state - NSURLSessionTaskState get state { - final _ret = _objc_msgSend_8b7yc1(this.ref.pointer, _sel_state); - return NSURLSessionTaskState.fromValue(_ret); - } - - /// error - objc.NSError? get error { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_error); - return _ret.address == 0 - ? null - : objc.NSError.castFromPointer(_ret, retain: true, release: true); - } - - /// suspend - void suspend() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_suspend); - } - - /// resume - void resume() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resume); - } - - /// priority - double get priority { - return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_priority) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_priority); - } - - /// setPriority: - set priority(double value) { - return _objc_msgSend_s9gjzc(this.ref.pointer, _sel_setPriority_, value); - } - - /// prefersIncrementalDelivery - bool get prefersIncrementalDelivery { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_prefersIncrementalDelivery); - } - - /// setPrefersIncrementalDelivery: - set prefersIncrementalDelivery(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setPrefersIncrementalDelivery_, value); - } - - /// init - NSURLSessionTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLSessionTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionTask, _sel_new); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionTask, _sel_allocWithZone_, zone); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLSessionTask alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionTask, _sel_alloc); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLSessionTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLSessionTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_storeCookies_forTask_ = - objc.registerName("storeCookies:forTask:"); -void _ObjCBlock_ffiVoid_NSArray_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSArray_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSArray_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSArray { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSArray_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSArray?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSArray.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSArray?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSArray.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSArray_CallExtension - on objc.ObjCBlock { - void call(objc.NSArray? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getCookiesForTask_completionHandler_ = - objc.registerName("getCookiesForTask:completionHandler:"); - -/// NSHTTPCookieStorage -class NSHTTPCookieStorage extends objc.NSObject { - NSHTTPCookieStorage._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSHTTPCookieStorage] that points to the same underlying object as [other]. - NSHTTPCookieStorage.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSHTTPCookieStorage] that wraps the given raw object pointer. - NSHTTPCookieStorage.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSHTTPCookieStorage]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSHTTPCookieStorage); - } - - /// sharedHTTPCookieStorage - static NSHTTPCookieStorage getSharedHTTPCookieStorage() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookieStorage, _sel_sharedHTTPCookieStorage); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// sharedCookieStorageForGroupContainerIdentifier: - static NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier_( - objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7( - _class_NSHTTPCookieStorage, - _sel_sharedCookieStorageForGroupContainerIdentifier_, - identifier.ref.pointer); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// cookies - objc.NSArray? get cookies { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_cookies); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setCookie: - void setCookie_(NSHTTPCookie cookie) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCookie_, cookie.ref.pointer); - } - - /// deleteCookie: - void deleteCookie_(NSHTTPCookie cookie) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_deleteCookie_, cookie.ref.pointer); - } - - /// removeCookiesSinceDate: - void removeCookiesSinceDate_(objc.NSDate date) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeCookiesSinceDate_, date.ref.pointer); - } - - /// cookiesForURL: - objc.NSArray? cookiesForURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_cookiesForURL_, URL.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setCookies:forURL:mainDocumentURL: - void setCookies_forURL_mainDocumentURL_( - objc.NSArray cookies, objc.NSURL? URL, objc.NSURL? mainDocumentURL) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_setCookies_forURL_mainDocumentURL_, - cookies.ref.pointer, - URL?.ref.pointer ?? ffi.nullptr, - mainDocumentURL?.ref.pointer ?? ffi.nullptr); - } - - /// cookieAcceptPolicy - NSHTTPCookieAcceptPolicy get cookieAcceptPolicy { - final _ret = - _objc_msgSend_1jpuqgg(this.ref.pointer, _sel_cookieAcceptPolicy); - return NSHTTPCookieAcceptPolicy.fromValue(_ret); - } - - /// setCookieAcceptPolicy: - set cookieAcceptPolicy(NSHTTPCookieAcceptPolicy value) { - return _objc_msgSend_199e8fv( - this.ref.pointer, _sel_setCookieAcceptPolicy_, value.value); - } - - /// sortedCookiesUsingDescriptors: - objc.NSArray sortedCookiesUsingDescriptors_(objc.NSArray sortOrder) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_sortedCookiesUsingDescriptors_, sortOrder.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// storeCookies:forTask: - void storeCookies_forTask_(objc.NSArray cookies, NSURLSessionTask task) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_storeCookies_forTask_, - cookies.ref.pointer, task.ref.pointer); - } - - /// getCookiesForTask:completionHandler: - void getCookiesForTask_completionHandler_(NSURLSessionTask task, - objc.ObjCBlock completionHandler) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_getCookiesForTask_completionHandler_, - task.ref.pointer, - completionHandler.ref.pointer); - } - - /// init - NSHTTPCookieStorage init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSHTTPCookieStorage new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookieStorage, _sel_new); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSHTTPCookieStorage allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSHTTPCookieStorage, _sel_allocWithZone_, zone); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSHTTPCookieStorage alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookieStorage, _sel_alloc); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSHTTPCookieStorage, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSHTTPCookieStorage, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSHTTPCookieStorage, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSHTTPCookieStorage, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookieStorage, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSHTTPCookieStorage, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSHTTPCookieStorage, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookieStorage, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookieStorage, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSHTTPCookieStorage self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSHTTPCookieStorage retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSHTTPCookieStorage autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _class_NSIndexPath = objc.getClass("NSIndexPath"); -late final _sel_indexPathWithIndex_ = objc.registerName("indexPathWithIndex:"); -late final _sel_indexPathWithIndexes_length_ = - objc.registerName("indexPathWithIndexes:length:"); -final _objc_msgSend_1educny = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_initWithIndexes_length_ = - objc.registerName("initWithIndexes:length:"); -late final _sel_initWithIndex_ = objc.registerName("initWithIndex:"); -late final _sel_indexPathByAddingIndex_ = - objc.registerName("indexPathByAddingIndex:"); -late final _sel_indexPathByRemovingLastIndex = - objc.registerName("indexPathByRemovingLastIndex"); -late final _sel_indexAtPosition_ = objc.registerName("indexAtPosition:"); -final _objc_msgSend_1eigyr6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_getIndexes_range_ = objc.registerName("getIndexes:range:"); -final _objc_msgSend_oxe0mk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_getIndexes_ = objc.registerName("getIndexes:"); -final _objc_msgSend_v7ntkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - -/// NSIndexPath -class NSIndexPath extends objc.NSObject { - NSIndexPath._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSIndexPath] that points to the same underlying object as [other]. - NSIndexPath.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSIndexPath] that wraps the given raw object pointer. - NSIndexPath.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSIndexPath]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSIndexPath); - } - - /// indexPathWithIndex: - static NSIndexPath indexPathWithIndex_(int index) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSIndexPath, _sel_indexPathWithIndex_, index); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// indexPathWithIndexes:length: - static NSIndexPath indexPathWithIndexes_length_( - ffi.Pointer indexes, int length) { - final _ret = _objc_msgSend_1educny( - _class_NSIndexPath, _sel_indexPathWithIndexes_length_, indexes, length); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithIndexes:length: - NSIndexPath initWithIndexes_length_( - ffi.Pointer indexes, int length) { - final _ret = _objc_msgSend_1educny(this.ref.retainAndReturnPointer(), - _sel_initWithIndexes_length_, indexes, length); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithIndex: - NSIndexPath initWithIndex_(int index) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.retainAndReturnPointer(), _sel_initWithIndex_, index); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// indexPathByAddingIndex: - NSIndexPath indexPathByAddingIndex_(int index) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_indexPathByAddingIndex_, index); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// indexPathByRemovingLastIndex - NSIndexPath indexPathByRemovingLastIndex() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_indexPathByRemovingLastIndex); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// indexAtPosition: - int indexAtPosition_(int position) { - return _objc_msgSend_1eigyr6( - this.ref.pointer, _sel_indexAtPosition_, position); - } - - /// length - int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); - } - - /// getIndexes:range: - void getIndexes_range_( - ffi.Pointer indexes, objc.NSRange positionRange) { - _objc_msgSend_oxe0mk( - this.ref.pointer, _sel_getIndexes_range_, indexes, positionRange); - } - - /// compare: - objc.NSComparisonResult compare_(NSIndexPath otherObject) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_compare_, otherObject.ref.pointer); - return objc.NSComparisonResult.fromValue(_ret); - } - - /// getIndexes: - void getIndexes_(ffi.Pointer indexes) { - _objc_msgSend_v7ntkj(this.ref.pointer, _sel_getIndexes_, indexes); - } - - /// init - NSIndexPath init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSIndexPath new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexPath, _sel_new); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSIndexPath allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSIndexPath, _sel_allocWithZone_, zone); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSIndexPath alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexPath, _sel_alloc); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSIndexPath, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSIndexPath, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSIndexPath, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSIndexPath, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSIndexPath, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSIndexPath, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSIndexPath, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSIndexPath, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSIndexPath, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSIndexPath self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSIndexPath retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSIndexPath autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSIndexPath, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSIndexPath? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSInflectionRule = objc.getClass("NSInflectionRule"); -late final _sel_automaticRule = objc.registerName("automaticRule"); -late final _sel_canInflectLanguage_ = objc.registerName("canInflectLanguage:"); -late final _sel_canInflectPreferredLocalization = - objc.registerName("canInflectPreferredLocalization"); - -/// NSInflectionRule -class NSInflectionRule extends objc.NSObject { - NSInflectionRule._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSInflectionRule] that points to the same underlying object as [other]. - NSInflectionRule.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSInflectionRule] that wraps the given raw object pointer. - NSInflectionRule.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSInflectionRule]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSInflectionRule); - } - - /// init - NSInflectionRule init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// automaticRule - static NSInflectionRule getAutomaticRule() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSInflectionRule, _sel_automaticRule); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// canInflectLanguage: - static bool canInflectLanguage_(objc.NSString language) { - return _objc_msgSend_l8lotg(_class_NSInflectionRule, - _sel_canInflectLanguage_, language.ref.pointer); - } - - /// canInflectPreferredLocalization - static bool getCanInflectPreferredLocalization() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_canInflectPreferredLocalization); - } - - /// new - static NSInflectionRule new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSInflectionRule, _sel_new); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSInflectionRule allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSInflectionRule, _sel_allocWithZone_, zone); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSInflectionRule alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSInflectionRule, _sel_alloc); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSInflectionRule, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSInflectionRule, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSInflectionRule, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSInflectionRule, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSInflectionRule, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSInflectionRule, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSInflectionRule, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSInflectionRule self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSInflectionRule retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSInflectionRule autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSInflectionRule? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSMorphology = objc.getClass("NSMorphology"); - -enum NSGrammaticalGender { - NSGrammaticalGenderNotSet(0), - NSGrammaticalGenderFeminine(1), - NSGrammaticalGenderMasculine(2), - NSGrammaticalGenderNeuter(3); - - final int value; - const NSGrammaticalGender(this.value); - - static NSGrammaticalGender fromValue(int value) => switch (value) { - 0 => NSGrammaticalGenderNotSet, - 1 => NSGrammaticalGenderFeminine, - 2 => NSGrammaticalGenderMasculine, - 3 => NSGrammaticalGenderNeuter, - _ => - throw ArgumentError("Unknown value for NSGrammaticalGender: $value"), - }; -} - -late final _sel_grammaticalGender = objc.registerName("grammaticalGender"); -final _objc_msgSend_y3dgf1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setGrammaticalGender_ = - objc.registerName("setGrammaticalGender:"); -final _objc_msgSend_12a9bks = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalPartOfSpeech { - NSGrammaticalPartOfSpeechNotSet(0), - NSGrammaticalPartOfSpeechDeterminer(1), - NSGrammaticalPartOfSpeechPronoun(2), - NSGrammaticalPartOfSpeechLetter(3), - NSGrammaticalPartOfSpeechAdverb(4), - NSGrammaticalPartOfSpeechParticle(5), - NSGrammaticalPartOfSpeechAdjective(6), - NSGrammaticalPartOfSpeechAdposition(7), - NSGrammaticalPartOfSpeechVerb(8), - NSGrammaticalPartOfSpeechNoun(9), - NSGrammaticalPartOfSpeechConjunction(10), - NSGrammaticalPartOfSpeechNumeral(11), - NSGrammaticalPartOfSpeechInterjection(12), - NSGrammaticalPartOfSpeechPreposition(13), - NSGrammaticalPartOfSpeechAbbreviation(14); - - final int value; - const NSGrammaticalPartOfSpeech(this.value); - - static NSGrammaticalPartOfSpeech fromValue(int value) => switch (value) { - 0 => NSGrammaticalPartOfSpeechNotSet, - 1 => NSGrammaticalPartOfSpeechDeterminer, - 2 => NSGrammaticalPartOfSpeechPronoun, - 3 => NSGrammaticalPartOfSpeechLetter, - 4 => NSGrammaticalPartOfSpeechAdverb, - 5 => NSGrammaticalPartOfSpeechParticle, - 6 => NSGrammaticalPartOfSpeechAdjective, - 7 => NSGrammaticalPartOfSpeechAdposition, - 8 => NSGrammaticalPartOfSpeechVerb, - 9 => NSGrammaticalPartOfSpeechNoun, - 10 => NSGrammaticalPartOfSpeechConjunction, - 11 => NSGrammaticalPartOfSpeechNumeral, - 12 => NSGrammaticalPartOfSpeechInterjection, - 13 => NSGrammaticalPartOfSpeechPreposition, - 14 => NSGrammaticalPartOfSpeechAbbreviation, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalPartOfSpeech: $value"), - }; -} - -late final _sel_partOfSpeech = objc.registerName("partOfSpeech"); -final _objc_msgSend_vk5e30 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPartOfSpeech_ = objc.registerName("setPartOfSpeech:"); -final _objc_msgSend_1k6p0ib = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalNumber { - NSGrammaticalNumberNotSet(0), - NSGrammaticalNumberSingular(1), - NSGrammaticalNumberZero(2), - NSGrammaticalNumberPlural(3), - NSGrammaticalNumberPluralTwo(4), - NSGrammaticalNumberPluralFew(5), - NSGrammaticalNumberPluralMany(6); - - final int value; - const NSGrammaticalNumber(this.value); - - static NSGrammaticalNumber fromValue(int value) => switch (value) { - 0 => NSGrammaticalNumberNotSet, - 1 => NSGrammaticalNumberSingular, - 2 => NSGrammaticalNumberZero, - 3 => NSGrammaticalNumberPlural, - 4 => NSGrammaticalNumberPluralTwo, - 5 => NSGrammaticalNumberPluralFew, - 6 => NSGrammaticalNumberPluralMany, - _ => - throw ArgumentError("Unknown value for NSGrammaticalNumber: $value"), - }; -} - -late final _sel_number = objc.registerName("number"); -final _objc_msgSend_1lu1qy9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setNumber_ = objc.registerName("setNumber:"); -final _objc_msgSend_kwz1vc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalCase { - NSGrammaticalCaseNotSet(0), - NSGrammaticalCaseNominative(1), - NSGrammaticalCaseAccusative(2), - NSGrammaticalCaseDative(3), - NSGrammaticalCaseGenitive(4), - NSGrammaticalCasePrepositional(5), - NSGrammaticalCaseAblative(6), - NSGrammaticalCaseAdessive(7), - NSGrammaticalCaseAllative(8), - NSGrammaticalCaseElative(9), - NSGrammaticalCaseIllative(10), - NSGrammaticalCaseEssive(11), - NSGrammaticalCaseInessive(12), - NSGrammaticalCaseLocative(13), - NSGrammaticalCaseTranslative(14); - - final int value; - const NSGrammaticalCase(this.value); - - static NSGrammaticalCase fromValue(int value) => switch (value) { - 0 => NSGrammaticalCaseNotSet, - 1 => NSGrammaticalCaseNominative, - 2 => NSGrammaticalCaseAccusative, - 3 => NSGrammaticalCaseDative, - 4 => NSGrammaticalCaseGenitive, - 5 => NSGrammaticalCasePrepositional, - 6 => NSGrammaticalCaseAblative, - 7 => NSGrammaticalCaseAdessive, - 8 => NSGrammaticalCaseAllative, - 9 => NSGrammaticalCaseElative, - 10 => NSGrammaticalCaseIllative, - 11 => NSGrammaticalCaseEssive, - 12 => NSGrammaticalCaseInessive, - 13 => NSGrammaticalCaseLocative, - 14 => NSGrammaticalCaseTranslative, - _ => throw ArgumentError("Unknown value for NSGrammaticalCase: $value"), - }; -} - -late final _sel_grammaticalCase = objc.registerName("grammaticalCase"); -final _objc_msgSend_1xz5l6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setGrammaticalCase_ = objc.registerName("setGrammaticalCase:"); -final _objc_msgSend_erklvx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalDetermination { - NSGrammaticalDeterminationNotSet(0), - NSGrammaticalDeterminationIndependent(1), - NSGrammaticalDeterminationDependent(2); - - final int value; - const NSGrammaticalDetermination(this.value); - - static NSGrammaticalDetermination fromValue(int value) => switch (value) { - 0 => NSGrammaticalDeterminationNotSet, - 1 => NSGrammaticalDeterminationIndependent, - 2 => NSGrammaticalDeterminationDependent, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalDetermination: $value"), - }; -} - -late final _sel_determination = objc.registerName("determination"); -final _objc_msgSend_18c2fg3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDetermination_ = objc.registerName("setDetermination:"); -final _objc_msgSend_ug05wa = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalPerson { - NSGrammaticalPersonNotSet(0), - NSGrammaticalPersonFirst(1), - NSGrammaticalPersonSecond(2), - NSGrammaticalPersonThird(3); - - final int value; - const NSGrammaticalPerson(this.value); - - static NSGrammaticalPerson fromValue(int value) => switch (value) { - 0 => NSGrammaticalPersonNotSet, - 1 => NSGrammaticalPersonFirst, - 2 => NSGrammaticalPersonSecond, - 3 => NSGrammaticalPersonThird, - _ => - throw ArgumentError("Unknown value for NSGrammaticalPerson: $value"), - }; -} - -late final _sel_grammaticalPerson = objc.registerName("grammaticalPerson"); -final _objc_msgSend_1ffoin9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setGrammaticalPerson_ = - objc.registerName("setGrammaticalPerson:"); -final _objc_msgSend_ae3g2g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalPronounType { - NSGrammaticalPronounTypeNotSet(0), - NSGrammaticalPronounTypePersonal(1), - NSGrammaticalPronounTypeReflexive(2), - NSGrammaticalPronounTypePossessive(3); - - final int value; - const NSGrammaticalPronounType(this.value); - - static NSGrammaticalPronounType fromValue(int value) => switch (value) { - 0 => NSGrammaticalPronounTypeNotSet, - 1 => NSGrammaticalPronounTypePersonal, - 2 => NSGrammaticalPronounTypeReflexive, - 3 => NSGrammaticalPronounTypePossessive, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalPronounType: $value"), - }; -} - -late final _sel_pronounType = objc.registerName("pronounType"); -final _objc_msgSend_17hihkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPronounType_ = objc.registerName("setPronounType:"); -final _objc_msgSend_1trhr2m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalDefiniteness { - NSGrammaticalDefinitenessNotSet(0), - NSGrammaticalDefinitenessIndefinite(1), - NSGrammaticalDefinitenessDefinite(2); - - final int value; - const NSGrammaticalDefiniteness(this.value); - - static NSGrammaticalDefiniteness fromValue(int value) => switch (value) { - 0 => NSGrammaticalDefinitenessNotSet, - 1 => NSGrammaticalDefinitenessIndefinite, - 2 => NSGrammaticalDefinitenessDefinite, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalDefiniteness: $value"), - }; -} - -late final _sel_definiteness = objc.registerName("definiteness"); -final _objc_msgSend_gnbhg7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDefiniteness_ = objc.registerName("setDefiniteness:"); -final _objc_msgSend_vbzknq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _class_NSMorphologyCustomPronoun = - objc.getClass("NSMorphologyCustomPronoun"); -late final _sel_isSupportedForLanguage_ = - objc.registerName("isSupportedForLanguage:"); -late final _sel_requiredKeysForLanguage_ = - objc.registerName("requiredKeysForLanguage:"); -late final _sel_subjectForm = objc.registerName("subjectForm"); -late final _sel_setSubjectForm_ = objc.registerName("setSubjectForm:"); -late final _sel_objectForm = objc.registerName("objectForm"); -late final _sel_setObjectForm_ = objc.registerName("setObjectForm:"); -late final _sel_possessiveForm = objc.registerName("possessiveForm"); -late final _sel_setPossessiveForm_ = objc.registerName("setPossessiveForm:"); -late final _sel_possessiveAdjectiveForm = - objc.registerName("possessiveAdjectiveForm"); -late final _sel_setPossessiveAdjectiveForm_ = - objc.registerName("setPossessiveAdjectiveForm:"); -late final _sel_reflexiveForm = objc.registerName("reflexiveForm"); -late final _sel_setReflexiveForm_ = objc.registerName("setReflexiveForm:"); - -/// NSMorphologyCustomPronoun -class NSMorphologyCustomPronoun extends objc.NSObject { - NSMorphologyCustomPronoun._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMorphologyCustomPronoun] that points to the same underlying object as [other]. - NSMorphologyCustomPronoun.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMorphologyCustomPronoun] that wraps the given raw object pointer. - NSMorphologyCustomPronoun.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMorphologyCustomPronoun]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMorphologyCustomPronoun); - } - - /// isSupportedForLanguage: - static bool isSupportedForLanguage_(objc.NSString language) { - return _objc_msgSend_l8lotg(_class_NSMorphologyCustomPronoun, - _sel_isSupportedForLanguage_, language.ref.pointer); - } - - /// requiredKeysForLanguage: - static objc.NSArray requiredKeysForLanguage_(objc.NSString language) { - final _ret = _objc_msgSend_juohf7(_class_NSMorphologyCustomPronoun, - _sel_requiredKeysForLanguage_, language.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// subjectForm - objc.NSString? get subjectForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_subjectForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSubjectForm: - set subjectForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setSubjectForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// objectForm - objc.NSString? get objectForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setObjectForm: - set objectForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setObjectForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// possessiveForm - objc.NSString? get possessiveForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_possessiveForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPossessiveForm: - set possessiveForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setPossessiveForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// possessiveAdjectiveForm - objc.NSString? get possessiveAdjectiveForm { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_possessiveAdjectiveForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPossessiveAdjectiveForm: - set possessiveAdjectiveForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setPossessiveAdjectiveForm_, value?.ref.pointer ?? ffi.nullptr); - } - - /// reflexiveForm - objc.NSString? get reflexiveForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reflexiveForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setReflexiveForm: - set reflexiveForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setReflexiveForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// init - NSMorphologyCustomPronoun init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSMorphologyCustomPronoun new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMorphologyCustomPronoun, _sel_new); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSMorphologyCustomPronoun allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMorphologyCustomPronoun, _sel_allocWithZone_, zone); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSMorphologyCustomPronoun alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMorphologyCustomPronoun, _sel_alloc); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMorphologyCustomPronoun, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMorphologyCustomPronoun, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMorphologyCustomPronoun, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSMorphologyCustomPronoun, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMorphologyCustomPronoun, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMorphologyCustomPronoun, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMorphologyCustomPronoun, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphologyCustomPronoun, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphologyCustomPronoun, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMorphologyCustomPronoun self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSMorphologyCustomPronoun retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSMorphologyCustomPronoun autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMorphologyCustomPronoun, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSMorphologyCustomPronoun? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_customPronounForLanguage_ = - objc.registerName("customPronounForLanguage:"); -late final _sel_setCustomPronoun_forLanguage_error_ = - objc.registerName("setCustomPronoun:forLanguage:error:"); -late final _sel_isUnspecified = objc.registerName("isUnspecified"); -late final _sel_userMorphology = objc.registerName("userMorphology"); - -/// NSMorphology -class NSMorphology extends objc.NSObject { - NSMorphology._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMorphology] that points to the same underlying object as [other]. - NSMorphology.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMorphology] that wraps the given raw object pointer. - NSMorphology.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMorphology]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMorphology); - } - - /// grammaticalGender - NSGrammaticalGender get grammaticalGender { - final _ret = _objc_msgSend_y3dgf1(this.ref.pointer, _sel_grammaticalGender); - return NSGrammaticalGender.fromValue(_ret); - } - - /// setGrammaticalGender: - set grammaticalGender(NSGrammaticalGender value) { - return _objc_msgSend_12a9bks( - this.ref.pointer, _sel_setGrammaticalGender_, value.value); - } - - /// partOfSpeech - NSGrammaticalPartOfSpeech get partOfSpeech { - final _ret = _objc_msgSend_vk5e30(this.ref.pointer, _sel_partOfSpeech); - return NSGrammaticalPartOfSpeech.fromValue(_ret); - } - - /// setPartOfSpeech: - set partOfSpeech(NSGrammaticalPartOfSpeech value) { - return _objc_msgSend_1k6p0ib( - this.ref.pointer, _sel_setPartOfSpeech_, value.value); - } - - /// number - NSGrammaticalNumber get number { - final _ret = _objc_msgSend_1lu1qy9(this.ref.pointer, _sel_number); - return NSGrammaticalNumber.fromValue(_ret); - } - - /// setNumber: - set number(NSGrammaticalNumber value) { - return _objc_msgSend_kwz1vc(this.ref.pointer, _sel_setNumber_, value.value); - } - - /// grammaticalCase - NSGrammaticalCase get grammaticalCase { - final _ret = _objc_msgSend_1xz5l6(this.ref.pointer, _sel_grammaticalCase); - return NSGrammaticalCase.fromValue(_ret); - } - - /// setGrammaticalCase: - set grammaticalCase(NSGrammaticalCase value) { - return _objc_msgSend_erklvx( - this.ref.pointer, _sel_setGrammaticalCase_, value.value); - } - - /// determination - NSGrammaticalDetermination get determination { - final _ret = _objc_msgSend_18c2fg3(this.ref.pointer, _sel_determination); - return NSGrammaticalDetermination.fromValue(_ret); - } - - /// setDetermination: - set determination(NSGrammaticalDetermination value) { - return _objc_msgSend_ug05wa( - this.ref.pointer, _sel_setDetermination_, value.value); - } - - /// grammaticalPerson - NSGrammaticalPerson get grammaticalPerson { - final _ret = - _objc_msgSend_1ffoin9(this.ref.pointer, _sel_grammaticalPerson); - return NSGrammaticalPerson.fromValue(_ret); - } - - /// setGrammaticalPerson: - set grammaticalPerson(NSGrammaticalPerson value) { - return _objc_msgSend_ae3g2g( - this.ref.pointer, _sel_setGrammaticalPerson_, value.value); - } - - /// pronounType - NSGrammaticalPronounType get pronounType { - final _ret = _objc_msgSend_17hihkj(this.ref.pointer, _sel_pronounType); - return NSGrammaticalPronounType.fromValue(_ret); - } - - /// setPronounType: - set pronounType(NSGrammaticalPronounType value) { - return _objc_msgSend_1trhr2m( - this.ref.pointer, _sel_setPronounType_, value.value); - } - - /// definiteness - NSGrammaticalDefiniteness get definiteness { - final _ret = _objc_msgSend_gnbhg7(this.ref.pointer, _sel_definiteness); - return NSGrammaticalDefiniteness.fromValue(_ret); - } - - /// setDefiniteness: - set definiteness(NSGrammaticalDefiniteness value) { - return _objc_msgSend_vbzknq( - this.ref.pointer, _sel_setDefiniteness_, value.value); - } - - /// customPronounForLanguage: - NSMorphologyCustomPronoun? customPronounForLanguage_(objc.NSString language) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_customPronounForLanguage_, language.ref.pointer); - return _ret.address == 0 - ? null - : NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// setCustomPronoun:forLanguage:error: - bool setCustomPronoun_forLanguage_error_(NSMorphologyCustomPronoun? features, - objc.NSString language, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_setCustomPronoun_forLanguage_error_, - features?.ref.pointer ?? ffi.nullptr, - language.ref.pointer, - error); - } - - /// isUnspecified - bool get unspecified { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isUnspecified); - } - - /// userMorphology - static NSMorphology getUserMorphology() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMorphology, _sel_userMorphology); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSMorphology init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSMorphology new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMorphology, _sel_new); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSMorphology allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSMorphology, _sel_allocWithZone_, zone); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSMorphology alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMorphology, _sel_alloc); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMorphology, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMorphology, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMorphology, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSMorphology, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMorphology, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMorphology, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMorphology, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphology, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphology, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMorphology self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSMorphology retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSMorphology autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSMorphology, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSMorphology? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMorphology.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSOperationQueue = objc.getClass("NSOperationQueue"); -late final _class_NSOperation = objc.getClass("NSOperation"); -late final _sel_start = objc.registerName("start"); -late final _sel_main = objc.registerName("main"); -late final _sel_isExecuting = objc.registerName("isExecuting"); -late final _sel_isConcurrent = objc.registerName("isConcurrent"); -late final _sel_isAsynchronous = objc.registerName("isAsynchronous"); -late final _sel_isReady = objc.registerName("isReady"); -late final _sel_addDependency_ = objc.registerName("addDependency:"); -late final _sel_removeDependency_ = objc.registerName("removeDependency:"); -late final _sel_dependencies = objc.registerName("dependencies"); - -enum NSOperationQueuePriority { - NSOperationQueuePriorityVeryLow(-8), - NSOperationQueuePriorityLow(-4), - NSOperationQueuePriorityNormal(0), - NSOperationQueuePriorityHigh(4), - NSOperationQueuePriorityVeryHigh(8); - - final int value; - const NSOperationQueuePriority(this.value); - - static NSOperationQueuePriority fromValue(int value) => switch (value) { - -8 => NSOperationQueuePriorityVeryLow, - -4 => NSOperationQueuePriorityLow, - 0 => NSOperationQueuePriorityNormal, - 4 => NSOperationQueuePriorityHigh, - 8 => NSOperationQueuePriorityVeryHigh, - _ => throw ArgumentError( - "Unknown value for NSOperationQueuePriority: $value"), - }; -} - -late final _sel_queuePriority = objc.registerName("queuePriority"); -final _objc_msgSend_10n15g8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setQueuePriority_ = objc.registerName("setQueuePriority:"); -final _objc_msgSend_d8yjnr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_completionBlock = objc.registerName("completionBlock"); -late final _sel_setCompletionBlock_ = objc.registerName("setCompletionBlock:"); -late final _sel_waitUntilFinished = objc.registerName("waitUntilFinished"); -late final _sel_threadPriority = objc.registerName("threadPriority"); -late final _sel_setThreadPriority_ = objc.registerName("setThreadPriority:"); -final _objc_msgSend_suh039 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Double)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, double)>(); - -enum NSQualityOfService { - NSQualityOfServiceUserInteractive(33), - NSQualityOfServiceUserInitiated(25), - NSQualityOfServiceUtility(17), - NSQualityOfServiceBackground(9), - NSQualityOfServiceDefault(-1); - - final int value; - const NSQualityOfService(this.value); - - static NSQualityOfService fromValue(int value) => switch (value) { - 33 => NSQualityOfServiceUserInteractive, - 25 => NSQualityOfServiceUserInitiated, - 17 => NSQualityOfServiceUtility, - 9 => NSQualityOfServiceBackground, - -1 => NSQualityOfServiceDefault, - _ => - throw ArgumentError("Unknown value for NSQualityOfService: $value"), - }; -} - -late final _sel_qualityOfService = objc.registerName("qualityOfService"); -final _objc_msgSend_17dnyeh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setQualityOfService_ = - objc.registerName("setQualityOfService:"); -final _objc_msgSend_1fcr8u4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setName_ = objc.registerName("setName:"); - -/// NSOperation -class NSOperation extends objc.NSObject { - NSOperation._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSOperation] that points to the same underlying object as [other]. - NSOperation.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSOperation] that wraps the given raw object pointer. - NSOperation.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSOperation]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSOperation); - } - - /// start - void start() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_start); - } - - /// main - void main() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_main); - } - - /// isCancelled - bool get cancelled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isCancelled); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// isExecuting - bool get executing { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isExecuting); - } - - /// isFinished - bool get finished { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isFinished); - } - - /// isConcurrent - bool get concurrent { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isConcurrent); - } - - /// isAsynchronous - bool get asynchronous { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isAsynchronous); - } - - /// isReady - bool get ready { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isReady); - } - - /// addDependency: - void addDependency_(NSOperation op) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addDependency_, op.ref.pointer); - } - - /// removeDependency: - void removeDependency_(NSOperation op) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeDependency_, op.ref.pointer); - } - - /// dependencies - objc.NSArray get dependencies { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dependencies); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// queuePriority - NSOperationQueuePriority get queuePriority { - final _ret = _objc_msgSend_10n15g8(this.ref.pointer, _sel_queuePriority); - return NSOperationQueuePriority.fromValue(_ret); - } - - /// setQueuePriority: - set queuePriority(NSOperationQueuePriority value) { - return _objc_msgSend_d8yjnr( - this.ref.pointer, _sel_setQueuePriority_, value.value); - } - - /// completionBlock - objc.ObjCBlock? get completionBlock { - final _ret = _objc_msgSend_2osec1(this.ref.pointer, _sel_completionBlock); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setCompletionBlock: - set completionBlock(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setCompletionBlock_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// waitUntilFinished - void waitUntilFinished() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_waitUntilFinished); - } - - /// threadPriority - double get threadPriority { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_threadPriority) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_threadPriority); - } - - /// setThreadPriority: - set threadPriority(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setThreadPriority_, value); - } - - /// qualityOfService - NSQualityOfService get qualityOfService { - final _ret = _objc_msgSend_17dnyeh(this.ref.pointer, _sel_qualityOfService); - return NSQualityOfService.fromValue(_ret); - } - - /// setQualityOfService: - set qualityOfService(NSQualityOfService value) { - return _objc_msgSend_1fcr8u4( - this.ref.pointer, _sel_setQualityOfService_, value.value); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setName: - set name(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); - } - - /// init - NSOperation init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSOperation new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperation, _sel_new); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSOperation allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSOperation, _sel_allocWithZone_, zone); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSOperation alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperation, _sel_alloc); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSOperation, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSOperation, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSOperation, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSOperation, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOperation, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSOperation, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSOperation, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOperation, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSOperation, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSOperation self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSOperation.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSOperation retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSOperation.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSOperation autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSOperation.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_addOperation_ = objc.registerName("addOperation:"); -late final _sel_addOperations_waitUntilFinished_ = - objc.registerName("addOperations:waitUntilFinished:"); -final _objc_msgSend_1n1qwdd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_addOperationWithBlock_ = - objc.registerName("addOperationWithBlock:"); -late final _sel_addBarrierBlock_ = objc.registerName("addBarrierBlock:"); -late final _sel_maxConcurrentOperationCount = - objc.registerName("maxConcurrentOperationCount"); -late final _sel_setMaxConcurrentOperationCount_ = - objc.registerName("setMaxConcurrentOperationCount:"); -late final _sel_isSuspended = objc.registerName("isSuspended"); -late final _sel_setSuspended_ = objc.registerName("setSuspended:"); -late final _sel_underlyingQueue = objc.registerName("underlyingQueue"); -late final _sel_setUnderlyingQueue_ = objc.registerName("setUnderlyingQueue:"); -late final _sel_cancelAllOperations = objc.registerName("cancelAllOperations"); -late final _sel_waitUntilAllOperationsAreFinished = - objc.registerName("waitUntilAllOperationsAreFinished"); -late final _sel_currentQueue = objc.registerName("currentQueue"); -late final _sel_mainQueue = objc.registerName("mainQueue"); -late final _sel_operations = objc.registerName("operations"); -late final _sel_operationCount = objc.registerName("operationCount"); - -/// NSOperationQueue -class NSOperationQueue extends objc.NSObject { - NSOperationQueue._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSOperationQueue] that points to the same underlying object as [other]. - NSOperationQueue.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSOperationQueue] that wraps the given raw object pointer. - NSOperationQueue.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSOperationQueue]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSOperationQueue); - } - - /// progress - NSProgress get progress { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_progress); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// addOperation: - void addOperation_(NSOperation op) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addOperation_, op.ref.pointer); - } - - /// addOperations:waitUntilFinished: - void addOperations_waitUntilFinished_(objc.NSArray ops, bool wait) { - _objc_msgSend_1n1qwdd(this.ref.pointer, - _sel_addOperations_waitUntilFinished_, ops.ref.pointer, wait); - } - - /// addOperationWithBlock: - void addOperationWithBlock_(objc.ObjCBlock block) { - _objc_msgSend_4daxhl( - this.ref.pointer, _sel_addOperationWithBlock_, block.ref.pointer); - } - - /// addBarrierBlock: - void addBarrierBlock_(objc.ObjCBlock barrier) { - _objc_msgSend_4daxhl( - this.ref.pointer, _sel_addBarrierBlock_, barrier.ref.pointer); - } - - /// maxConcurrentOperationCount - int get maxConcurrentOperationCount { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_maxConcurrentOperationCount); - } - - /// setMaxConcurrentOperationCount: - set maxConcurrentOperationCount(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setMaxConcurrentOperationCount_, value); - } - - /// isSuspended - bool get suspended { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSuspended); - } - - /// setSuspended: - set suspended(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setSuspended_, value); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setName: - set name(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); - } - - /// qualityOfService - NSQualityOfService get qualityOfService { - final _ret = _objc_msgSend_17dnyeh(this.ref.pointer, _sel_qualityOfService); - return NSQualityOfService.fromValue(_ret); - } - - /// setQualityOfService: - set qualityOfService(NSQualityOfService value) { - return _objc_msgSend_1fcr8u4( - this.ref.pointer, _sel_setQualityOfService_, value.value); - } - - /// underlyingQueue - objc.NSObject? get underlyingQueue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_underlyingQueue); - return _ret.address == 0 - ? null - : objc.NSObject.castFromPointer(_ret, retain: true, release: true); - } - - /// setUnderlyingQueue: - set underlyingQueue(objc.NSObject? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setUnderlyingQueue_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// cancelAllOperations - void cancelAllOperations() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancelAllOperations); - } - - /// waitUntilAllOperationsAreFinished - void waitUntilAllOperationsAreFinished() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_waitUntilAllOperationsAreFinished); - } - - /// currentQueue - static NSOperationQueue? getCurrentQueue() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_currentQueue); - return _ret.address == 0 - ? null - : NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// mainQueue - static NSOperationQueue getMainQueue() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_mainQueue); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// operations - objc.NSArray get operations { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_operations); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// operationCount - int get operationCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_operationCount); - } - - /// init - NSOperationQueue init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSOperationQueue new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_new); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSOperationQueue allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSOperationQueue, _sel_allocWithZone_, zone); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSOperationQueue alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_alloc); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSOperationQueue, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSOperationQueue, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSOperationQueue, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSOperationQueue, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOperationQueue, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSOperationQueue, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSOperationQueue, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOperationQueue, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOperationQueue, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSOperationQueue self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSOperationQueue retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSOperationQueue autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSOrthography = objc.getClass("NSOrthography"); -late final _sel_dominantScript = objc.registerName("dominantScript"); -late final _sel_languageMap = objc.registerName("languageMap"); -late final _sel_initWithDominantScript_languageMap_ = - objc.registerName("initWithDominantScript:languageMap:"); -late final _sel_languagesForScript_ = objc.registerName("languagesForScript:"); -late final _sel_dominantLanguageForScript_ = - objc.registerName("dominantLanguageForScript:"); -late final _sel_dominantLanguage = objc.registerName("dominantLanguage"); -late final _sel_allScripts = objc.registerName("allScripts"); -late final _sel_allLanguages = objc.registerName("allLanguages"); -late final _sel_defaultOrthographyForLanguage_ = - objc.registerName("defaultOrthographyForLanguage:"); -late final _sel_orthographyWithDominantScript_languageMap_ = - objc.registerName("orthographyWithDominantScript:languageMap:"); - -/// NSOrthography -class NSOrthography extends objc.NSObject { - NSOrthography._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSOrthography] that points to the same underlying object as [other]. - NSOrthography.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSOrthography] that wraps the given raw object pointer. - NSOrthography.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSOrthography]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSOrthography); - } - - /// dominantScript - objc.NSString get dominantScript { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dominantScript); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// languageMap - objc.NSDictionary get languageMap { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_languageMap); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithDominantScript:languageMap: - NSOrthography initWithDominantScript_languageMap_( - objc.NSString script, objc.NSDictionary map) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithDominantScript_languageMap_, - script.ref.pointer, - map.ref.pointer); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSOrthography? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// languagesForScript: - objc.NSArray? languagesForScript_(objc.NSString script) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_languagesForScript_, script.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// dominantLanguageForScript: - objc.NSString? dominantLanguageForScript_(objc.NSString script) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dominantLanguageForScript_, script.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dominantLanguage - objc.NSString get dominantLanguage { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dominantLanguage); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// allScripts - objc.NSArray get allScripts { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allScripts); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allLanguages - objc.NSArray get allLanguages { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allLanguages); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultOrthographyForLanguage: - static NSOrthography defaultOrthographyForLanguage_(objc.NSString language) { - final _ret = _objc_msgSend_juohf7(_class_NSOrthography, - _sel_defaultOrthographyForLanguage_, language.ref.pointer); - return NSOrthography.castFromPointer(_ret, retain: true, release: true); - } - - /// orthographyWithDominantScript:languageMap: - static NSOrthography orthographyWithDominantScript_languageMap_( - objc.NSString script, objc.NSDictionary map) { - final _ret = _objc_msgSend_iq11qg( - _class_NSOrthography, - _sel_orthographyWithDominantScript_languageMap_, - script.ref.pointer, - map.ref.pointer); - return NSOrthography.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSOrthography init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSOrthography new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrthography, _sel_new); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSOrthography allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSOrthography, _sel_allocWithZone_, zone); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSOrthography alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrthography, _sel_alloc); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSOrthography, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSOrthography, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSOrthography, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSOrthography, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOrthography, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSOrthography, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSOrthography, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOrthography, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOrthography, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSOrthography, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _class_NSPointerArray = objc.getClass("NSPointerArray"); -late final _sel_countByEnumeratingWithState_objects_count_ = - objc.registerName("countByEnumeratingWithState:objects:count:"); -final _objc_msgSend_q12f7y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - ffi.UnsignedLong arg3)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>()(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrTrampoline, - 0) - .cast(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - (objc.getBlockClosure(block) as int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int))(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureTrampoline, - 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. -abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, ffi.UnsignedLong arg3)>> ptr) => - objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - objc.newPointerBlock(_ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)> fromFunction(int Function(ffi.Pointer, ffi.Pointer, ffi.Pointer>, int) fn) => - objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - objc.newClosureBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - fn(arg0, arg1, arg2, arg3)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. -extension ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_CallExtension - on objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> { - int call( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - ffi.UnsignedLong arg3)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>()(ref.pointer, arg0, arg1, arg2, arg3); -} - -enum NSPointerFunctionsOptions { - NSPointerFunctionsStrongMemory(0), - NSPointerFunctionsZeroingWeakMemory(1), - NSPointerFunctionsOpaqueMemory(2), - NSPointerFunctionsMallocMemory(3), - NSPointerFunctionsMachVirtualMemory(4), - NSPointerFunctionsWeakMemory(5), - NSPointerFunctionsOpaquePersonality(256), - NSPointerFunctionsObjectPointerPersonality(512), - NSPointerFunctionsCStringPersonality(768), - NSPointerFunctionsStructPersonality(1024), - NSPointerFunctionsIntegerPersonality(1280), - NSPointerFunctionsCopyIn(65536); - - static const NSPointerFunctionsObjectPersonality = - NSPointerFunctionsStrongMemory; - - final int value; - const NSPointerFunctionsOptions(this.value); - - static NSPointerFunctionsOptions fromValue(int value) => switch (value) { - 0 => NSPointerFunctionsStrongMemory, - 1 => NSPointerFunctionsZeroingWeakMemory, - 2 => NSPointerFunctionsOpaqueMemory, - 3 => NSPointerFunctionsMallocMemory, - 4 => NSPointerFunctionsMachVirtualMemory, - 5 => NSPointerFunctionsWeakMemory, - 256 => NSPointerFunctionsOpaquePersonality, - 512 => NSPointerFunctionsObjectPointerPersonality, - 768 => NSPointerFunctionsCStringPersonality, - 1024 => NSPointerFunctionsStructPersonality, - 1280 => NSPointerFunctionsIntegerPersonality, - 65536 => NSPointerFunctionsCopyIn, - _ => throw ArgumentError( - "Unknown value for NSPointerFunctionsOptions: $value"), - }; - - @override - String toString() { - if (this == NSPointerFunctionsStrongMemory) - return "NSPointerFunctionsOptions.NSPointerFunctionsStrongMemory, NSPointerFunctionsOptions.NSPointerFunctionsObjectPersonality"; - return super.toString(); - } -} - -late final _sel_initWithOptions_ = objc.registerName("initWithOptions:"); -final _objc_msgSend_146ksfy = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _class_NSPointerFunctions = objc.getClass("NSPointerFunctions"); -late final _sel_pointerFunctionsWithOptions_ = - objc.registerName("pointerFunctionsWithOptions:"); -late final _sel_hashFunction = objc.registerName("hashFunction"); -final _objc_msgSend_1sotwf1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer, ffi.Pointer)>>)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setHashFunction_ = objc.registerName("setHashFunction:"); -final _objc_msgSend_1oonnyk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>(); -late final _sel_isEqualFunction = objc.registerName("isEqualFunction"); -final _objc_msgSend_1xqafxe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer, ffi.Pointer, ffi.Pointer)>>)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setIsEqualFunction_ = objc.registerName("setIsEqualFunction:"); -final _objc_msgSend_1i3z8j1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>>)>(); -late final _sel_sizeFunction = objc.registerName("sizeFunction"); -final _objc_msgSend_1u1e56c = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setSizeFunction_ = objc.registerName("setSizeFunction:"); -final _objc_msgSend_10z8lan = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>(); -late final _sel_descriptionFunction = objc.registerName("descriptionFunction"); -final _objc_msgSend_1y69tkw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDescriptionFunction_ = - objc.registerName("setDescriptionFunction:"); -final _objc_msgSend_1a23vur = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>)>(); -late final _sel_relinquishFunction = objc.registerName("relinquishFunction"); -final _objc_msgSend_15kilzc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer, ffi.Pointer)>>)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setRelinquishFunction_ = - objc.registerName("setRelinquishFunction:"); -final _objc_msgSend_18u5cwv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>(); -late final _sel_acquireFunction = objc.registerName("acquireFunction"); -final _objc_msgSend_y49dq4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Pointer)>>, ffi.Bool)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>, - ffi.Bool)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setAcquireFunction_ = objc.registerName("setAcquireFunction:"); -final _objc_msgSend_nyyll3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>, - ffi.Bool)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi - .NativeFunction)>>, - ffi.Bool)>>)>(); -late final _sel_usesStrongWriteBarrier = - objc.registerName("usesStrongWriteBarrier"); -late final _sel_setUsesStrongWriteBarrier_ = - objc.registerName("setUsesStrongWriteBarrier:"); -late final _sel_usesWeakReadAndWriteBarriers = - objc.registerName("usesWeakReadAndWriteBarriers"); -late final _sel_setUsesWeakReadAndWriteBarriers_ = - objc.registerName("setUsesWeakReadAndWriteBarriers:"); - -/// NSPointerFunctions -class NSPointerFunctions extends objc.NSObject { - NSPointerFunctions._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPointerFunctions] that points to the same underlying object as [other]. - NSPointerFunctions.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPointerFunctions] that wraps the given raw object pointer. - NSPointerFunctions.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPointerFunctions]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPointerFunctions); - } - - /// initWithOptions: - NSPointerFunctions initWithOptions_(NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy(this.ref.retainAndReturnPointer(), - _sel_initWithOptions_, options.value); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// pointerFunctionsWithOptions: - static NSPointerFunctions pointerFunctionsWithOptions_( - NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy(_class_NSPointerFunctions, - _sel_pointerFunctionsWithOptions_, options.value); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// hashFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>> - get hashFunction { - return _objc_msgSend_1sotwf1(this.ref.pointer, _sel_hashFunction); - } - - /// setHashFunction: - set hashFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - value) { - return _objc_msgSend_1oonnyk( - this.ref.pointer, _sel_setHashFunction_, value); - } - - /// isEqualFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>> - get isEqualFunction { - return _objc_msgSend_1xqafxe(this.ref.pointer, _sel_isEqualFunction); - } - - /// setIsEqualFunction: - set isEqualFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - value) { - return _objc_msgSend_1i3z8j1( - this.ref.pointer, _sel_setIsEqualFunction_, value); - } - - /// sizeFunction - ffi.Pointer< - ffi.NativeFunction)>> - get sizeFunction { - return _objc_msgSend_1u1e56c(this.ref.pointer, _sel_sizeFunction); - } - - /// setSizeFunction: - set sizeFunction( - ffi.Pointer< - ffi - .NativeFunction)>> - value) { - return _objc_msgSend_10z8lan( - this.ref.pointer, _sel_setSizeFunction_, value); - } - - /// descriptionFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>> - get descriptionFunction { - return _objc_msgSend_1y69tkw(this.ref.pointer, _sel_descriptionFunction); - } - - /// setDescriptionFunction: - set descriptionFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>> - value) { - return _objc_msgSend_1a23vur( - this.ref.pointer, _sel_setDescriptionFunction_, value); - } - - /// relinquishFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>> - get relinquishFunction { - return _objc_msgSend_15kilzc(this.ref.pointer, _sel_relinquishFunction); - } - - /// setRelinquishFunction: - set relinquishFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - value) { - return _objc_msgSend_18u5cwv( - this.ref.pointer, _sel_setRelinquishFunction_, value); - } - - /// acquireFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>, - ffi.Bool)>> get acquireFunction { - return _objc_msgSend_y49dq4(this.ref.pointer, _sel_acquireFunction); - } - - /// setAcquireFunction: - set acquireFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>, - ffi.Bool)>> - value) { - return _objc_msgSend_nyyll3( - this.ref.pointer, _sel_setAcquireFunction_, value); - } - - /// usesStrongWriteBarrier - bool get usesStrongWriteBarrier { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_usesStrongWriteBarrier); - } - - /// setUsesStrongWriteBarrier: - set usesStrongWriteBarrier(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesStrongWriteBarrier_, value); - } - - /// usesWeakReadAndWriteBarriers - bool get usesWeakReadAndWriteBarriers { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_usesWeakReadAndWriteBarriers); - } - - /// setUsesWeakReadAndWriteBarriers: - set usesWeakReadAndWriteBarriers(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesWeakReadAndWriteBarriers_, value); - } - - /// init - NSPointerFunctions init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSPointerFunctions new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerFunctions, _sel_new); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSPointerFunctions allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSPointerFunctions, _sel_allocWithZone_, zone); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSPointerFunctions alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerFunctions, _sel_alloc); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPointerFunctions, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPointerFunctions, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPointerFunctions, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSPointerFunctions, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPointerFunctions, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPointerFunctions, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPointerFunctions, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerFunctions, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerFunctions, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSPointerFunctions self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSPointerFunctions retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSPointerFunctions autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_initWithPointerFunctions_ = - objc.registerName("initWithPointerFunctions:"); -late final _sel_pointerArrayWithOptions_ = - objc.registerName("pointerArrayWithOptions:"); -late final _sel_pointerArrayWithPointerFunctions_ = - objc.registerName("pointerArrayWithPointerFunctions:"); -late final _sel_pointerFunctions = objc.registerName("pointerFunctions"); -late final _sel_pointerAtIndex_ = objc.registerName("pointerAtIndex:"); -final _objc_msgSend_hwxa7r = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_addPointer_ = objc.registerName("addPointer:"); -final _objc_msgSend_hepzs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_removePointerAtIndex_ = - objc.registerName("removePointerAtIndex:"); -late final _sel_insertPointer_atIndex_ = - objc.registerName("insertPointer:atIndex:"); -final _objc_msgSend_vzqe8w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -late final _sel_replacePointerAtIndex_withPointer_ = - objc.registerName("replacePointerAtIndex:withPointer:"); -final _objc_msgSend_19y6iy4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int, ffi.Pointer)>(); -late final _sel_compact = objc.registerName("compact"); -late final _sel_count = objc.registerName("count"); -late final _sel_setCount_ = objc.registerName("setCount:"); -late final _sel_pointerArrayWithStrongObjects = - objc.registerName("pointerArrayWithStrongObjects"); -late final _sel_pointerArrayWithWeakObjects = - objc.registerName("pointerArrayWithWeakObjects"); -late final _sel_strongObjectsPointerArray = - objc.registerName("strongObjectsPointerArray"); -late final _sel_weakObjectsPointerArray = - objc.registerName("weakObjectsPointerArray"); -late final _sel_allObjects = objc.registerName("allObjects"); - -/// NSPointerArray -class NSPointerArray extends objc.NSObject { - NSPointerArray._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPointerArray] that points to the same underlying object as [other]. - NSPointerArray.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPointerArray] that wraps the given raw object pointer. - NSPointerArray.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPointerArray]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPointerArray); - } - - /// initWithOptions: - NSPointerArray initWithOptions_(NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy(this.ref.retainAndReturnPointer(), - _sel_initWithOptions_, options.value); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithPointerFunctions: - NSPointerArray initWithPointerFunctions_(NSPointerFunctions functions) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithPointerFunctions_, functions.ref.pointer); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// pointerArrayWithOptions: - static NSPointerArray pointerArrayWithOptions_( - NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy( - _class_NSPointerArray, _sel_pointerArrayWithOptions_, options.value); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pointerArrayWithPointerFunctions: - static NSPointerArray pointerArrayWithPointerFunctions_( - NSPointerFunctions functions) { - final _ret = _objc_msgSend_juohf7(_class_NSPointerArray, - _sel_pointerArrayWithPointerFunctions_, functions.ref.pointer); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pointerFunctions - NSPointerFunctions get pointerFunctions { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_pointerFunctions); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// pointerAtIndex: - ffi.Pointer pointerAtIndex_(int index) { - return _objc_msgSend_hwxa7r(this.ref.pointer, _sel_pointerAtIndex_, index); - } - - /// addPointer: - void addPointer_(ffi.Pointer pointer) { - _objc_msgSend_hepzs(this.ref.pointer, _sel_addPointer_, pointer); - } - - /// removePointerAtIndex: - void removePointerAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removePointerAtIndex_, index); - } - - /// insertPointer:atIndex: - void insertPointer_atIndex_(ffi.Pointer item, int index) { - _objc_msgSend_vzqe8w( - this.ref.pointer, _sel_insertPointer_atIndex_, item, index); - } - - /// replacePointerAtIndex:withPointer: - void replacePointerAtIndex_withPointer_( - int index, ffi.Pointer item) { - _objc_msgSend_19y6iy4( - this.ref.pointer, _sel_replacePointerAtIndex_withPointer_, index, item); - } - - /// compact - void compact() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_compact); - } - - /// count - int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); - } - - /// setCount: - set count(int value) { - return _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_setCount_, value); - } - - /// pointerArrayWithStrongObjects - static objc.ObjCObjectBase pointerArrayWithStrongObjects() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_pointerArrayWithStrongObjects); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// pointerArrayWithWeakObjects - static objc.ObjCObjectBase pointerArrayWithWeakObjects() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_pointerArrayWithWeakObjects); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// strongObjectsPointerArray - static NSPointerArray strongObjectsPointerArray() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_strongObjectsPointerArray); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// weakObjectsPointerArray - static NSPointerArray weakObjectsPointerArray() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_weakObjectsPointerArray); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allObjects - objc.NSArray get allObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allObjects); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSPointerArray init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSPointerArray new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerArray, _sel_new); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSPointerArray allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSPointerArray, _sel_allocWithZone_, zone); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSPointerArray alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerArray, _sel_alloc); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPointerArray, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPointerArray, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPointerArray, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSPointerArray, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPointerArray, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPointerArray, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPointerArray, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSPointerArray self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSPointerArray retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSPointerArray autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// countByEnumeratingWithState:objects:count: - int countByEnumeratingWithState_objects_count_( - ffi.Pointer state, - ffi.Pointer> buffer, - int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, - _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSPointerArray, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSPointerArray? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSPort = objc.getClass("NSPort"); -late final _sel_port = objc.registerName("port"); -late final _sel_invalidate = objc.registerName("invalidate"); -late final _sel_isValid = objc.registerName("isValid"); -late final _sel_scheduleInRunLoop_forMode_ = - objc.registerName("scheduleInRunLoop:forMode:"); -late final _sel_removeFromRunLoop_forMode_ = - objc.registerName("removeFromRunLoop:forMode:"); -late final _sel_reservedSpaceLength = objc.registerName("reservedSpaceLength"); -late final _sel_sendBeforeDate_components_from_reserved_ = - objc.registerName("sendBeforeDate:components:from:reserved:"); -final _objc_msgSend_1k87i90 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_sendBeforeDate_msgid_components_from_reserved_ = - objc.registerName("sendBeforeDate:msgid:components:from:reserved:"); -final _objc_msgSend_1sldtak = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _class_NSConnection = objc.getClass("NSConnection"); -late final _sel_statistics = objc.registerName("statistics"); -late final _sel_allConnections = objc.registerName("allConnections"); -late final _sel_defaultConnection = objc.registerName("defaultConnection"); -late final _sel_connectionWithRegisteredName_host_ = - objc.registerName("connectionWithRegisteredName:host:"); -late final _class_NSPortNameServer = objc.getClass("NSPortNameServer"); -late final _sel_systemDefaultPortNameServer = - objc.registerName("systemDefaultPortNameServer"); -late final _sel_portForName_ = objc.registerName("portForName:"); -late final _sel_portForName_host_ = objc.registerName("portForName:host:"); -late final _sel_registerPort_name_ = objc.registerName("registerPort:name:"); -late final _sel_removePortForName_ = objc.registerName("removePortForName:"); - -/// NSPortNameServer -class NSPortNameServer extends objc.NSObject { - NSPortNameServer._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPortNameServer] that points to the same underlying object as [other]. - NSPortNameServer.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPortNameServer] that wraps the given raw object pointer. - NSPortNameServer.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPortNameServer]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPortNameServer); - } - - /// systemDefaultPortNameServer - static NSPortNameServer systemDefaultPortNameServer() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPortNameServer, _sel_systemDefaultPortNameServer); - return NSPortNameServer.castFromPointer(_ret, retain: true, release: true); - } - - /// portForName: - NSPort? portForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_portForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// portForName:host: - NSPort? portForName_host_(objc.NSString name, objc.NSString? host) { - final _ret = _objc_msgSend_iq11qg(this.ref.pointer, _sel_portForName_host_, - name.ref.pointer, host?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// registerPort:name: - bool registerPort_name_(NSPort port, objc.NSString name) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_registerPort_name_, - port.ref.pointer, name.ref.pointer); - } - - /// removePortForName: - bool removePortForName_(objc.NSString name) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_removePortForName_, name.ref.pointer); - } - - /// init - NSPortNameServer init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSPortNameServer new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPortNameServer, _sel_new); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSPortNameServer allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSPortNameServer, _sel_allocWithZone_, zone); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSPortNameServer alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPortNameServer, _sel_alloc); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPortNameServer, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPortNameServer, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPortNameServer, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSPortNameServer, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPortNameServer, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPortNameServer, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPortNameServer, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPortNameServer, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPortNameServer, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _sel_connectionWithRegisteredName_host_usingNameServer_ = - objc.registerName("connectionWithRegisteredName:host:usingNameServer:"); -late final _class_NSDistantObject = objc.getClass("NSDistantObject"); -late final _sel_proxyWithTarget_connection_ = - objc.registerName("proxyWithTarget:connection:"); -late final _sel_initWithTarget_connection_ = - objc.registerName("initWithTarget:connection:"); -late final _sel_proxyWithLocal_connection_ = - objc.registerName("proxyWithLocal:connection:"); -late final _sel_initWithLocal_connection_ = - objc.registerName("initWithLocal:connection:"); -late final _sel_setProtocolForProxy_ = - objc.registerName("setProtocolForProxy:"); -late final _sel_connectionForProxy = objc.registerName("connectionForProxy"); - -/// NSDistantObject -class NSDistantObject extends objc.NSProxy { - NSDistantObject._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDistantObject] that points to the same underlying object as [other]. - NSDistantObject.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDistantObject] that wraps the given raw object pointer. - NSDistantObject.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDistantObject]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDistantObject); - } - - /// proxyWithTarget:connection: - static objc.ObjCObjectBase? proxyWithTarget_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - _class_NSDistantObject, - _sel_proxyWithTarget_connection_, - target.ref.pointer, - connection.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// initWithTarget:connection: - NSDistantObject? initWithTarget_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithTarget_connection_, - target.ref.pointer, - connection.ref.pointer); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: false, release: true); - } - - /// proxyWithLocal:connection: - static objc.ObjCObjectBase proxyWithLocal_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - _class_NSDistantObject, - _sel_proxyWithLocal_connection_, - target.ref.pointer, - connection.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// initWithLocal:connection: - NSDistantObject initWithLocal_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithLocal_connection_, - target.ref.pointer, - connection.ref.pointer); - return NSDistantObject.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSDistantObject? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: false, release: true); - } - - /// setProtocolForProxy: - void setProtocolForProxy_(objc.Protocol? proto) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setProtocolForProxy_, - proto?.ref.pointer ?? ffi.nullptr); - } - - /// connectionForProxy - NSConnection get connectionForProxy { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_connectionForProxy); - return NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// alloc - static objc.ObjCObjectBase alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDistantObject, _sel_alloc); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// self - NSDistantObject self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSDistantObject retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSDistantObject autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_rootProxyForConnectionWithRegisteredName_host_ = - objc.registerName("rootProxyForConnectionWithRegisteredName:host:"); -late final _sel_rootProxyForConnectionWithRegisteredName_host_usingNameServer_ = - objc.registerName( - "rootProxyForConnectionWithRegisteredName:host:usingNameServer:"); -late final _sel_serviceConnectionWithName_rootObject_usingNameServer_ = - objc.registerName("serviceConnectionWithName:rootObject:usingNameServer:"); -late final _sel_serviceConnectionWithName_rootObject_ = - objc.registerName("serviceConnectionWithName:rootObject:"); -late final _sel_requestTimeout = objc.registerName("requestTimeout"); -late final _sel_setRequestTimeout_ = objc.registerName("setRequestTimeout:"); -late final _sel_replyTimeout = objc.registerName("replyTimeout"); -late final _sel_setReplyTimeout_ = objc.registerName("setReplyTimeout:"); -late final _sel_rootObject = objc.registerName("rootObject"); -late final _sel_setRootObject_ = objc.registerName("setRootObject:"); -late final _sel_independentConversationQueueing = - objc.registerName("independentConversationQueueing"); -late final _sel_setIndependentConversationQueueing_ = - objc.registerName("setIndependentConversationQueueing:"); -late final _sel_rootProxy = objc.registerName("rootProxy"); -late final _sel_addRequestMode_ = objc.registerName("addRequestMode:"); -late final _sel_removeRequestMode_ = objc.registerName("removeRequestMode:"); -late final _sel_requestModes = objc.registerName("requestModes"); -late final _sel_registerName_ = objc.registerName("registerName:"); -late final _sel_registerName_withNameServer_ = - objc.registerName("registerName:withNameServer:"); -late final _sel_connectionWithReceivePort_sendPort_ = - objc.registerName("connectionWithReceivePort:sendPort:"); -late final _sel_currentConversation = objc.registerName("currentConversation"); -late final _sel_initWithReceivePort_sendPort_ = - objc.registerName("initWithReceivePort:sendPort:"); -late final _sel_sendPort = objc.registerName("sendPort"); -late final _sel_receivePort = objc.registerName("receivePort"); -late final _sel_enableMultipleThreads = - objc.registerName("enableMultipleThreads"); -late final _sel_multipleThreadsEnabled = - objc.registerName("multipleThreadsEnabled"); -late final _sel_addRunLoop_ = objc.registerName("addRunLoop:"); -late final _sel_removeRunLoop_ = objc.registerName("removeRunLoop:"); -late final _sel_runInNewThread = objc.registerName("runInNewThread"); -late final _sel_remoteObjects = objc.registerName("remoteObjects"); -late final _sel_localObjects = objc.registerName("localObjects"); -late final _sel_dispatchWithComponents_ = - objc.registerName("dispatchWithComponents:"); - -/// NSConnection -class NSConnection extends objc.NSObject { - NSConnection._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSConnection] that points to the same underlying object as [other]. - NSConnection.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSConnection] that wraps the given raw object pointer. - NSConnection.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSConnection]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSConnection); - } - - /// statistics - objc.NSDictionary get statistics { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_statistics); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// allConnections - static objc.NSArray allConnections() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSConnection, _sel_allConnections); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultConnection - static NSConnection defaultConnection() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSConnection, _sel_defaultConnection); - return NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// connectionWithRegisteredName:host: - static NSConnection? connectionWithRegisteredName_host_( - objc.NSString name, objc.NSString? hostName) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_connectionWithRegisteredName_host_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// connectionWithRegisteredName:host:usingNameServer: - static NSConnection? connectionWithRegisteredName_host_usingNameServer_( - objc.NSString name, objc.NSString? hostName, NSPortNameServer server) { - final _ret = _objc_msgSend_aud7dn( - _class_NSConnection, - _sel_connectionWithRegisteredName_host_usingNameServer_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr, - server.ref.pointer); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// rootProxyForConnectionWithRegisteredName:host: - static NSDistantObject? rootProxyForConnectionWithRegisteredName_host_( - objc.NSString name, objc.NSString? hostName) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_rootProxyForConnectionWithRegisteredName_host_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// rootProxyForConnectionWithRegisteredName:host:usingNameServer: - static NSDistantObject? - rootProxyForConnectionWithRegisteredName_host_usingNameServer_( - objc.NSString name, - objc.NSString? hostName, - NSPortNameServer server) { - final _ret = _objc_msgSend_aud7dn( - _class_NSConnection, - _sel_rootProxyForConnectionWithRegisteredName_host_usingNameServer_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr, - server.ref.pointer); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// serviceConnectionWithName:rootObject:usingNameServer: - static NSConnection? serviceConnectionWithName_rootObject_usingNameServer_( - objc.NSString name, objc.ObjCObjectBase root, NSPortNameServer server) { - final _ret = _objc_msgSend_aud7dn( - _class_NSConnection, - _sel_serviceConnectionWithName_rootObject_usingNameServer_, - name.ref.pointer, - root.ref.pointer, - server.ref.pointer); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// serviceConnectionWithName:rootObject: - static NSConnection? serviceConnectionWithName_rootObject_( - objc.NSString name, objc.ObjCObjectBase root) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_serviceConnectionWithName_rootObject_, - name.ref.pointer, - root.ref.pointer); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// requestTimeout - double get requestTimeout { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_requestTimeout) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_requestTimeout); - } - - /// setRequestTimeout: - set requestTimeout(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setRequestTimeout_, value); - } - - /// replyTimeout - double get replyTimeout { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_replyTimeout) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_replyTimeout); - } - - /// setReplyTimeout: - set replyTimeout(double value) { - return _objc_msgSend_suh039(this.ref.pointer, _sel_setReplyTimeout_, value); - } - - /// rootObject - objc.ObjCObjectBase? get rootObject { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setRootObject: - set rootObject(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setRootObject_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// independentConversationQueueing - bool get independentConversationQueueing { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_independentConversationQueueing); - } - - /// setIndependentConversationQueueing: - set independentConversationQueueing(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setIndependentConversationQueueing_, value); - } - - /// isValid - bool get valid { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValid); - } - - /// rootProxy - NSDistantObject get rootProxy { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootProxy); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// invalidate - void invalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidate); - } - - /// addRequestMode: - void addRequestMode_(objc.NSString rmode) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addRequestMode_, rmode.ref.pointer); - } - - /// removeRequestMode: - void removeRequestMode_(objc.NSString rmode) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeRequestMode_, rmode.ref.pointer); - } - - /// requestModes - objc.NSArray get requestModes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_requestModes); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// registerName: - bool registerName_(objc.NSString? name) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_registerName_, name?.ref.pointer ?? ffi.nullptr); - } - - /// registerName:withNameServer: - bool registerName_withNameServer_( - objc.NSString? name, NSPortNameServer server) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_registerName_withNameServer_, - name?.ref.pointer ?? ffi.nullptr, - server.ref.pointer); - } - - /// connectionWithReceivePort:sendPort: - static NSConnection? connectionWithReceivePort_sendPort_( - NSPort? receivePort, NSPort? sendPort) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_connectionWithReceivePort_sendPort_, - receivePort?.ref.pointer ?? ffi.nullptr, - sendPort?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// currentConversation - static objc.ObjCObjectBase? currentConversation() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSConnection, _sel_currentConversation); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// initWithReceivePort:sendPort: - NSConnection? initWithReceivePort_sendPort_( - NSPort? receivePort, NSPort? sendPort) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithReceivePort_sendPort_, - receivePort?.ref.pointer ?? ffi.nullptr, - sendPort?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// sendPort - NSPort get sendPort { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sendPort); - return NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// receivePort - NSPort get receivePort { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_receivePort); - return NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// enableMultipleThreads - void enableMultipleThreads() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_enableMultipleThreads); - } - - /// multipleThreadsEnabled - bool get multipleThreadsEnabled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_multipleThreadsEnabled); - } - - /// addRunLoop: - void addRunLoop_(objc.NSRunLoop runloop) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addRunLoop_, runloop.ref.pointer); - } - - /// removeRunLoop: - void removeRunLoop_(objc.NSRunLoop runloop) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeRunLoop_, runloop.ref.pointer); - } - - /// runInNewThread - void runInNewThread() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_runInNewThread); - } - - /// remoteObjects - objc.NSArray get remoteObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_remoteObjects); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localObjects - objc.NSArray get localObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localObjects); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// dispatchWithComponents: - void dispatchWithComponents_(objc.NSArray components) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_dispatchWithComponents_, components.ref.pointer); - } - - /// init - NSConnection init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSConnection new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSConnection, _sel_new); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSConnection allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSConnection, _sel_allocWithZone_, zone); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSConnection alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSConnection, _sel_alloc); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSConnection, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSConnection, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSConnection, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSConnection, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSConnection, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSConnection, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSConnection, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSConnection, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSConnection, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _sel_addConnection_toRunLoop_forMode_ = - objc.registerName("addConnection:toRunLoop:forMode:"); -late final _sel_removeConnection_fromRunLoop_forMode_ = - objc.registerName("removeConnection:fromRunLoop:forMode:"); - -/// NSPort -class NSPort extends objc.NSObject { - NSPort._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPort] that points to the same underlying object as [other]. - NSPort.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPort] that wraps the given raw object pointer. - NSPort.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPort]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPort); - } - - /// port - static NSPort port() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPort, _sel_port); - return NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// invalidate - void invalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidate); - } - - /// isValid - bool get valid { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValid); - } - - /// setDelegate: - void setDelegate_(objc.ObjCObjectBase? anObject) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDelegate_, - anObject?.ref.pointer ?? ffi.nullptr); - } - - /// delegate - objc.ObjCObjectBase? delegate() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// scheduleInRunLoop:forMode: - void scheduleInRunLoop_forMode_(objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, - runLoop.ref.pointer, mode.ref.pointer); - } - - /// removeFromRunLoop:forMode: - void removeFromRunLoop_forMode_(objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeFromRunLoop_forMode_, - runLoop.ref.pointer, mode.ref.pointer); - } - - /// reservedSpaceLength - int get reservedSpaceLength { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_reservedSpaceLength); - } - - /// sendBeforeDate:components:from:reserved: - bool sendBeforeDate_components_from_reserved_( - objc.NSDate limitDate, - objc.NSMutableArray? components, - NSPort? receivePort, - int headerSpaceReserved) { - return _objc_msgSend_1k87i90( - this.ref.pointer, - _sel_sendBeforeDate_components_from_reserved_, - limitDate.ref.pointer, - components?.ref.pointer ?? ffi.nullptr, - receivePort?.ref.pointer ?? ffi.nullptr, - headerSpaceReserved); - } - - /// sendBeforeDate:msgid:components:from:reserved: - bool sendBeforeDate_msgid_components_from_reserved_( - objc.NSDate limitDate, - int msgID, - objc.NSMutableArray? components, - NSPort? receivePort, - int headerSpaceReserved) { - return _objc_msgSend_1sldtak( - this.ref.pointer, - _sel_sendBeforeDate_msgid_components_from_reserved_, - limitDate.ref.pointer, - msgID, - components?.ref.pointer ?? ffi.nullptr, - receivePort?.ref.pointer ?? ffi.nullptr, - headerSpaceReserved); - } - - /// addConnection:toRunLoop:forMode: - void addConnection_toRunLoop_forMode_( - NSConnection conn, objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_addConnection_toRunLoop_forMode_, - conn.ref.pointer, - runLoop.ref.pointer, - mode.ref.pointer); - } - - /// removeConnection:fromRunLoop:forMode: - void removeConnection_fromRunLoop_forMode_( - NSConnection conn, objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_removeConnection_fromRunLoop_forMode_, - conn.ref.pointer, - runLoop.ref.pointer, - mode.ref.pointer); - } - - /// init - NSPort init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSPort new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPort, _sel_new); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSPort allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSPort, _sel_allocWithZone_, zone); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSPort alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPort, _sel_alloc); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPort, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPort, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPort, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSPort, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPort, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPort, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPort, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPort, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSPort, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSPort? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSPort.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSProcessInfo = objc.getClass("NSProcessInfo"); -late final _sel_processInfo = objc.registerName("processInfo"); -late final _sel_environment = objc.registerName("environment"); -late final _sel_arguments = objc.registerName("arguments"); -late final _sel_hostName = objc.registerName("hostName"); -late final _sel_processName = objc.registerName("processName"); -late final _sel_setProcessName_ = objc.registerName("setProcessName:"); -late final _sel_processIdentifier = objc.registerName("processIdentifier"); -late final _sel_globallyUniqueString = - objc.registerName("globallyUniqueString"); -late final _sel_operatingSystem = objc.registerName("operatingSystem"); -late final _sel_operatingSystemName = objc.registerName("operatingSystemName"); -late final _sel_operatingSystemVersionString = - objc.registerName("operatingSystemVersionString"); - -final class NSOperatingSystemVersion extends ffi.Struct { - @ffi.Long() - external int majorVersion; - - @ffi.Long() - external int minorVersion; - - @ffi.Long() - external int patchVersion; -} - -late final _sel_operatingSystemVersion = - objc.registerName("operatingSystemVersion"); -final _objc_msgSend_1wzlp4e = objc.msgSendPointer - .cast< - ffi.NativeFunction< - NSOperatingSystemVersion Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - NSOperatingSystemVersion Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1wzlp4eStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_processorCount = objc.registerName("processorCount"); -late final _sel_activeProcessorCount = - objc.registerName("activeProcessorCount"); -late final _sel_physicalMemory = objc.registerName("physicalMemory"); -late final _sel_isOperatingSystemAtLeastVersion_ = - objc.registerName("isOperatingSystemAtLeastVersion:"); -final _objc_msgSend_1cw7twn = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, NSOperatingSystemVersion)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, NSOperatingSystemVersion)>(); -late final _sel_systemUptime = objc.registerName("systemUptime"); -late final _sel_disableSuddenTermination = - objc.registerName("disableSuddenTermination"); -late final _sel_enableSuddenTermination = - objc.registerName("enableSuddenTermination"); -late final _sel_disableAutomaticTermination_ = - objc.registerName("disableAutomaticTermination:"); -late final _sel_enableAutomaticTermination_ = - objc.registerName("enableAutomaticTermination:"); -late final _sel_automaticTerminationSupportEnabled = - objc.registerName("automaticTerminationSupportEnabled"); -late final _sel_setAutomaticTerminationSupportEnabled_ = - objc.registerName("setAutomaticTerminationSupportEnabled:"); - -enum NSActivityOptions { - NSActivityIdleDisplaySleepDisabled(1099511627776), - NSActivityIdleSystemSleepDisabled(1048576), - NSActivitySuddenTerminationDisabled(16384), - NSActivityAutomaticTerminationDisabled(32768), - NSActivityAnimationTrackingEnabled(35184372088832), - NSActivityTrackingEnabled(70368744177664), - NSActivityUserInitiated(16777215), - NSActivityUserInitiatedAllowingIdleSystemSleep(15728639), - NSActivityBackground(255), - NSActivityLatencyCritical(1095216660480), - NSActivityUserInteractive(1095233437695); - - final int value; - const NSActivityOptions(this.value); - - static NSActivityOptions fromValue(int value) => switch (value) { - 1099511627776 => NSActivityIdleDisplaySleepDisabled, - 1048576 => NSActivityIdleSystemSleepDisabled, - 16384 => NSActivitySuddenTerminationDisabled, - 32768 => NSActivityAutomaticTerminationDisabled, - 35184372088832 => NSActivityAnimationTrackingEnabled, - 70368744177664 => NSActivityTrackingEnabled, - 16777215 => NSActivityUserInitiated, - 15728639 => NSActivityUserInitiatedAllowingIdleSystemSleep, - 255 => NSActivityBackground, - 1095216660480 => NSActivityLatencyCritical, - 1095233437695 => NSActivityUserInteractive, - _ => throw ArgumentError("Unknown value for NSActivityOptions: $value"), - }; -} - -late final _sel_beginActivityWithOptions_reason_ = - objc.registerName("beginActivityWithOptions:reason:"); -final _objc_msgSend_1pavxqs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Uint64, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_endActivity_ = objc.registerName("endActivity:"); -late final _sel_performActivityWithOptions_reason_usingBlock_ = - objc.registerName("performActivityWithOptions:reason:usingBlock:"); -final _objc_msgSend_17597p1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Uint64, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_bool_fnPtrTrampoline( - ffi.Pointer block, bool arg0) => - block.ref.target - .cast>() - .asFunction()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Bool)>(_ObjCBlock_ffiVoid_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_bool_closureTrampoline( - ffi.Pointer block, bool arg0) => - (objc.getBlockClosure(block) as void Function(bool))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Bool)>(_ObjCBlock_ffiVoid_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_bool_listenerTrampoline( - ffi.Pointer block, bool arg0) { - (objc.getBlockClosure(block) as void Function(bool))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable, ffi.Bool)> - _ObjCBlock_ffiVoid_bool_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Bool)>.listener(_ObjCBlock_ffiVoid_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_bool_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(bool) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_bool_closureCallable, (bool arg0) => fn(arg0)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(bool) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_bool_listenerCallable.nativeFunction.cast(), - (bool arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_117qins(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_bool_CallExtension - on objc.ObjCBlock { - void call(bool arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, ffi.Bool arg0)>>() - .asFunction, bool)>()( - ref.pointer, arg0); -} - -late final _sel_performExpiringActivityWithReason_usingBlock_ = - objc.registerName("performExpiringActivityWithReason:usingBlock:"); -late final _sel_userName = objc.registerName("userName"); -late final _sel_fullUserName = objc.registerName("fullUserName"); - -enum NSProcessInfoThermalState { - NSProcessInfoThermalStateNominal(0), - NSProcessInfoThermalStateFair(1), - NSProcessInfoThermalStateSerious(2), - NSProcessInfoThermalStateCritical(3); - - final int value; - const NSProcessInfoThermalState(this.value); - - static NSProcessInfoThermalState fromValue(int value) => switch (value) { - 0 => NSProcessInfoThermalStateNominal, - 1 => NSProcessInfoThermalStateFair, - 2 => NSProcessInfoThermalStateSerious, - 3 => NSProcessInfoThermalStateCritical, - _ => throw ArgumentError( - "Unknown value for NSProcessInfoThermalState: $value"), - }; -} - -late final _sel_thermalState = objc.registerName("thermalState"); -final _objc_msgSend_1ssuop7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isLowPowerModeEnabled = - objc.registerName("isLowPowerModeEnabled"); -late final _sel_isMacCatalystApp = objc.registerName("isMacCatalystApp"); -late final _sel_isiOSAppOnMac = objc.registerName("isiOSAppOnMac"); - -/// NSProcessInfo -class NSProcessInfo extends objc.NSObject { - NSProcessInfo._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSProcessInfo] that points to the same underlying object as [other]. - NSProcessInfo.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSProcessInfo] that wraps the given raw object pointer. - NSProcessInfo.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSProcessInfo]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSProcessInfo); - } - - /// processInfo - static NSProcessInfo getProcessInfo() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProcessInfo, _sel_processInfo); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } - - /// environment - objc.NSDictionary get environment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_environment); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// arguments - objc.NSArray get arguments { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_arguments); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// hostName - objc.NSString get hostName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_hostName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// processName - objc.NSString get processName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_processName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setProcessName: - set processName(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setProcessName_, value.ref.pointer); - } - - /// processIdentifier - int get processIdentifier { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_processIdentifier); - } - - /// globallyUniqueString - objc.NSString get globallyUniqueString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_globallyUniqueString); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// operatingSystem - int operatingSystem() { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_operatingSystem); - } - - /// operatingSystemName - objc.NSString operatingSystemName() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_operatingSystemName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// operatingSystemVersionString - objc.NSString get operatingSystemVersionString { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_operatingSystemVersionString); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// operatingSystemVersion - NSOperatingSystemVersion get operatingSystemVersion { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1wzlp4eStret( - _ptr, this.ref.pointer, _sel_operatingSystemVersion) - : _ptr.ref = _objc_msgSend_1wzlp4e( - this.ref.pointer, _sel_operatingSystemVersion); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// processorCount - int get processorCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_processorCount); - } - - /// activeProcessorCount - int get activeProcessorCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_activeProcessorCount); - } - - /// physicalMemory - int get physicalMemory { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_physicalMemory); - } - - /// isOperatingSystemAtLeastVersion: - bool isOperatingSystemAtLeastVersion_(NSOperatingSystemVersion version) { - return _objc_msgSend_1cw7twn( - this.ref.pointer, _sel_isOperatingSystemAtLeastVersion_, version); - } - - /// systemUptime - double get systemUptime { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_systemUptime) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_systemUptime); - } - - /// disableSuddenTermination - void disableSuddenTermination() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_disableSuddenTermination); - } - - /// enableSuddenTermination - void enableSuddenTermination() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_enableSuddenTermination); - } - - /// disableAutomaticTermination: - void disableAutomaticTermination_(objc.NSString reason) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_disableAutomaticTermination_, - reason.ref.pointer); - } - - /// enableAutomaticTermination: - void enableAutomaticTermination_(objc.NSString reason) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_enableAutomaticTermination_, reason.ref.pointer); - } - - /// automaticTerminationSupportEnabled - bool get automaticTerminationSupportEnabled { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_automaticTerminationSupportEnabled); - } - - /// setAutomaticTerminationSupportEnabled: - set automaticTerminationSupportEnabled(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAutomaticTerminationSupportEnabled_, value); - } - - /// beginActivityWithOptions:reason: - objc.ObjCObjectBase beginActivityWithOptions_reason_( - NSActivityOptions options, objc.NSString reason) { - final _ret = _objc_msgSend_1pavxqs( - this.ref.pointer, - _sel_beginActivityWithOptions_reason_, - options.value, - reason.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// endActivity: - void endActivity_(objc.ObjCObjectBase activity) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_endActivity_, activity.ref.pointer); - } - - /// performActivityWithOptions:reason:usingBlock: - void performActivityWithOptions_reason_usingBlock_(NSActivityOptions options, - objc.NSString reason, objc.ObjCBlock block) { - _objc_msgSend_17597p1( - this.ref.pointer, - _sel_performActivityWithOptions_reason_usingBlock_, - options.value, - reason.ref.pointer, - block.ref.pointer); - } - - /// performExpiringActivityWithReason:usingBlock: - void performExpiringActivityWithReason_usingBlock_( - objc.NSString reason, objc.ObjCBlock block) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_performExpiringActivityWithReason_usingBlock_, - reason.ref.pointer, - block.ref.pointer); - } - - /// userName - objc.NSString get userName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// fullUserName - objc.NSString get fullUserName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fullUserName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// thermalState - NSProcessInfoThermalState get thermalState { - final _ret = _objc_msgSend_1ssuop7(this.ref.pointer, _sel_thermalState); - return NSProcessInfoThermalState.fromValue(_ret); - } - - /// isLowPowerModeEnabled - bool get lowPowerModeEnabled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLowPowerModeEnabled); - } - - /// isMacCatalystApp - bool get macCatalystApp { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isMacCatalystApp); - } - - /// isiOSAppOnMac - bool get iOSAppOnMac { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isiOSAppOnMac); - } - - /// init - NSProcessInfo init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSProcessInfo new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProcessInfo, _sel_new); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSProcessInfo allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSProcessInfo, _sel_allocWithZone_, zone); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSProcessInfo alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProcessInfo, _sel_alloc); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSProcessInfo, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSProcessInfo, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSProcessInfo, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSProcessInfo, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSProcessInfo, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSProcessInfo, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSProcessInfo, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSProcessInfo, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSProcessInfo, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSProcessInfo self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSProcessInfo retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSProcessInfo autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSTextCheckingResult = objc.getClass("NSTextCheckingResult"); - -enum NSTextCheckingType { - NSTextCheckingTypeOrthography(1), - NSTextCheckingTypeSpelling(2), - NSTextCheckingTypeGrammar(4), - NSTextCheckingTypeDate(8), - NSTextCheckingTypeAddress(16), - NSTextCheckingTypeLink(32), - NSTextCheckingTypeQuote(64), - NSTextCheckingTypeDash(128), - NSTextCheckingTypeReplacement(256), - NSTextCheckingTypeCorrection(512), - NSTextCheckingTypeRegularExpression(1024), - NSTextCheckingTypePhoneNumber(2048), - NSTextCheckingTypeTransitInformation(4096); - - final int value; - const NSTextCheckingType(this.value); - - static NSTextCheckingType fromValue(int value) => switch (value) { - 1 => NSTextCheckingTypeOrthography, - 2 => NSTextCheckingTypeSpelling, - 4 => NSTextCheckingTypeGrammar, - 8 => NSTextCheckingTypeDate, - 16 => NSTextCheckingTypeAddress, - 32 => NSTextCheckingTypeLink, - 64 => NSTextCheckingTypeQuote, - 128 => NSTextCheckingTypeDash, - 256 => NSTextCheckingTypeReplacement, - 512 => NSTextCheckingTypeCorrection, - 1024 => NSTextCheckingTypeRegularExpression, - 2048 => NSTextCheckingTypePhoneNumber, - 4096 => NSTextCheckingTypeTransitInformation, - _ => - throw ArgumentError("Unknown value for NSTextCheckingType: $value"), - }; -} - -late final _sel_resultType = objc.registerName("resultType"); -final _objc_msgSend_1d8v3ql = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Uint64 Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_range = objc.registerName("range"); -final _objc_msgSend_vi3lef = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - objc.NSRange Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_vi3lefStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); -late final _sel_orthography = objc.registerName("orthography"); -late final _sel_grammarDetails = objc.registerName("grammarDetails"); -late final _sel_duration = objc.registerName("duration"); -late final _sel_components = objc.registerName("components"); -late final _sel_replacementString = objc.registerName("replacementString"); -late final _sel_alternativeStrings = objc.registerName("alternativeStrings"); -late final _class_NSRegularExpression = objc.getClass("NSRegularExpression"); - -enum NSRegularExpressionOptions { - NSRegularExpressionCaseInsensitive(1), - NSRegularExpressionAllowCommentsAndWhitespace(2), - NSRegularExpressionIgnoreMetacharacters(4), - NSRegularExpressionDotMatchesLineSeparators(8), - NSRegularExpressionAnchorsMatchLines(16), - NSRegularExpressionUseUnixLineSeparators(32), - NSRegularExpressionUseUnicodeWordBoundaries(64); - - final int value; - const NSRegularExpressionOptions(this.value); - - static NSRegularExpressionOptions fromValue(int value) => switch (value) { - 1 => NSRegularExpressionCaseInsensitive, - 2 => NSRegularExpressionAllowCommentsAndWhitespace, - 4 => NSRegularExpressionIgnoreMetacharacters, - 8 => NSRegularExpressionDotMatchesLineSeparators, - 16 => NSRegularExpressionAnchorsMatchLines, - 32 => NSRegularExpressionUseUnixLineSeparators, - 64 => NSRegularExpressionUseUnicodeWordBoundaries, - _ => throw ArgumentError( - "Unknown value for NSRegularExpressionOptions: $value"), - }; -} - -late final _sel_regularExpressionWithPattern_options_error_ = - objc.registerName("regularExpressionWithPattern:options:error:"); -final _objc_msgSend_mq25jr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_initWithPattern_options_error_ = - objc.registerName("initWithPattern:options:error:"); -late final _sel_pattern = objc.registerName("pattern"); -late final _sel_options = objc.registerName("options"); -final _objc_msgSend_jt3cu0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_numberOfCaptureGroups = - objc.registerName("numberOfCaptureGroups"); -late final _sel_escapedPatternForString_ = - objc.registerName("escapedPatternForString:"); - -enum NSMatchingOptions { - NSMatchingReportProgress(1), - NSMatchingReportCompletion(2), - NSMatchingAnchored(4), - NSMatchingWithTransparentBounds(8), - NSMatchingWithoutAnchoringBounds(16); - - final int value; - const NSMatchingOptions(this.value); - - static NSMatchingOptions fromValue(int value) => switch (value) { - 1 => NSMatchingReportProgress, - 2 => NSMatchingReportCompletion, - 4 => NSMatchingAnchored, - 8 => NSMatchingWithTransparentBounds, - 16 => NSMatchingWithoutAnchoringBounds, - _ => throw ArgumentError("Unknown value for NSMatchingOptions: $value"), - }; -} - -enum NSMatchingFlags { - NSMatchingProgress(1), - NSMatchingCompleted(2), - NSMatchingHitEnd(4), - NSMatchingRequiredEnd(8), - NSMatchingInternalError(16); - - final int value; - const NSMatchingFlags(this.value); - - static NSMatchingFlags fromValue(int value) => switch (value) { - 1 => NSMatchingProgress, - 2 => NSMatchingCompleted, - 4 => NSMatchingHitEnd, - 8 => NSMatchingRequiredEnd, - 16 => NSMatchingInternalError, - _ => throw ArgumentError("Unknown value for NSMatchingFlags: $value"), - }; -} - -void - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.UnsignedLong arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, int, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrTrampoline) - .cast(); -void - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - int, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureTrampoline) - .cast(); -void - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - int, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerCallable = - ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function( - NSTextCheckingResult?, ffi.UnsignedLong, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock)> - fromFunctionPointer(ffi.Pointer arg0, ffi.UnsignedLong arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(void Function(NSTextCheckingResult?, NSMatchingFlags, ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureCallable, - (ffi.Pointer arg0, int arg1, ffi.Pointer arg2) => fn( - arg0.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(arg0, retain: true, release: true), - NSMatchingFlags.fromValue(arg1), - arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function( - NSTextCheckingResult?, ffi.UnsignedLong, ffi.Pointer)> - listener( - void Function( - NSTextCheckingResult?, NSMatchingFlags, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, int arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(arg0, - retain: false, release: true), - NSMatchingFlags.fromValue(arg1), - arg2)); - final wrapper = _wrapListenerBlock_9w6y6n(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function( - NSTextCheckingResult?, ffi.UnsignedLong, ffi.Pointer)> { - void call(NSTextCheckingResult? arg0, NSMatchingFlags arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.UnsignedLong arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1.value, arg2); -} - -late final _sel_enumerateMatchesInString_options_range_usingBlock_ = - objc.registerName("enumerateMatchesInString:options:range:usingBlock:"); -final _objc_msgSend_1c1lm06 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_matchesInString_options_range_ = - objc.registerName("matchesInString:options:range:"); -final _objc_msgSend_1ntyxzp = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -late final _sel_numberOfMatchesInString_options_range_ = - objc.registerName("numberOfMatchesInString:options:range:"); -final _objc_msgSend_1y9v6af = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -late final _sel_firstMatchInString_options_range_ = - objc.registerName("firstMatchInString:options:range:"); -late final _sel_rangeOfFirstMatchInString_options_range_ = - objc.registerName("rangeOfFirstMatchInString:options:range:"); -final _objc_msgSend_6yg79o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -final _objc_msgSend_6yg79oStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -late final _sel_stringByReplacingMatchesInString_options_range_withTemplate_ = - objc.registerName( - "stringByReplacingMatchesInString:options:range:withTemplate:"); -final _objc_msgSend_zsgini = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_replaceMatchesInString_options_range_withTemplate_ = - objc.registerName("replaceMatchesInString:options:range:withTemplate:"); -final _objc_msgSend_19w8ucc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_replacementStringForResult_inString_offset_template_ = - objc.registerName("replacementStringForResult:inString:offset:template:"); -late final _sel_escapedTemplateForString_ = - objc.registerName("escapedTemplateForString:"); - -/// NSRegularExpression -class NSRegularExpression extends objc.NSObject { - NSRegularExpression._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSRegularExpression] that points to the same underlying object as [other]. - NSRegularExpression.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSRegularExpression] that wraps the given raw object pointer. - NSRegularExpression.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSRegularExpression]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSRegularExpression); - } - - /// regularExpressionWithPattern:options:error: - static NSRegularExpression? regularExpressionWithPattern_options_error_( - objc.NSString pattern, - NSRegularExpressionOptions options, - ffi.Pointer> error) { - final _ret = _objc_msgSend_mq25jr( - _class_NSRegularExpression, - _sel_regularExpressionWithPattern_options_error_, - pattern.ref.pointer, - options.value, - error); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithPattern:options:error: - NSRegularExpression? initWithPattern_options_error_( - objc.NSString pattern, - NSRegularExpressionOptions options, - ffi.Pointer> error) { - final _ret = _objc_msgSend_mq25jr( - this.ref.retainAndReturnPointer(), - _sel_initWithPattern_options_error_, - pattern.ref.pointer, - options.value, - error); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// pattern - objc.NSString get pattern { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_pattern); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// options - NSRegularExpressionOptions get options { - final _ret = _objc_msgSend_jt3cu0(this.ref.pointer, _sel_options); - return NSRegularExpressionOptions.fromValue(_ret); - } - - /// numberOfCaptureGroups - int get numberOfCaptureGroups { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_numberOfCaptureGroups); - } - - /// escapedPatternForString: - static objc.NSString escapedPatternForString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(_class_NSRegularExpression, - _sel_escapedPatternForString_, string.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// enumerateMatchesInString:options:range:usingBlock: - void enumerateMatchesInString_options_range_usingBlock_( - objc.NSString string, - NSMatchingOptions options, - objc.NSRange range, - objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)> - block) { - _objc_msgSend_1c1lm06( - this.ref.pointer, - _sel_enumerateMatchesInString_options_range_usingBlock_, - string.ref.pointer, - options.value, - range, - block.ref.pointer); - } - - /// matchesInString:options:range: - objc.NSArray matchesInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - final _ret = _objc_msgSend_1ntyxzp( - this.ref.pointer, - _sel_matchesInString_options_range_, - string.ref.pointer, - options.value, - range); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// numberOfMatchesInString:options:range: - int numberOfMatchesInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - return _objc_msgSend_1y9v6af( - this.ref.pointer, - _sel_numberOfMatchesInString_options_range_, - string.ref.pointer, - options.value, - range); - } - - /// firstMatchInString:options:range: - NSTextCheckingResult? firstMatchInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - final _ret = _objc_msgSend_1ntyxzp( - this.ref.pointer, - _sel_firstMatchInString_options_range_, - string.ref.pointer, - options.value, - range); - return _ret.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// rangeOfFirstMatchInString:options:range: - objc.NSRange rangeOfFirstMatchInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_6yg79oStret( - _ptr, - this.ref.pointer, - _sel_rangeOfFirstMatchInString_options_range_, - string.ref.pointer, - options.value, - range) - : _ptr.ref = _objc_msgSend_6yg79o( - this.ref.pointer, - _sel_rangeOfFirstMatchInString_options_range_, - string.ref.pointer, - options.value, - range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// stringByReplacingMatchesInString:options:range:withTemplate: - objc.NSString stringByReplacingMatchesInString_options_range_withTemplate_( - objc.NSString string, - NSMatchingOptions options, - objc.NSRange range, - objc.NSString templ) { - final _ret = _objc_msgSend_zsgini( - this.ref.pointer, - _sel_stringByReplacingMatchesInString_options_range_withTemplate_, - string.ref.pointer, - options.value, - range, - templ.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// replaceMatchesInString:options:range:withTemplate: - int replaceMatchesInString_options_range_withTemplate_( - objc.NSMutableString string, - NSMatchingOptions options, - objc.NSRange range, - objc.NSString templ) { - return _objc_msgSend_19w8ucc( - this.ref.pointer, - _sel_replaceMatchesInString_options_range_withTemplate_, - string.ref.pointer, - options.value, - range, - templ.ref.pointer); - } - - /// replacementStringForResult:inString:offset:template: - objc.NSString replacementStringForResult_inString_offset_template_( - NSTextCheckingResult result, - objc.NSString string, - int offset, - objc.NSString templ) { - final _ret = _objc_msgSend_eyseqq( - this.ref.pointer, - _sel_replacementStringForResult_inString_offset_template_, - result.ref.pointer, - string.ref.pointer, - offset, - templ.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// escapedTemplateForString: - static objc.NSString escapedTemplateForString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(_class_NSRegularExpression, - _sel_escapedTemplateForString_, string.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSRegularExpression init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSRegularExpression new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSRegularExpression, _sel_new); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSRegularExpression allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSRegularExpression, _sel_allocWithZone_, zone); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSRegularExpression alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSRegularExpression, _sel_alloc); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSRegularExpression, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSRegularExpression, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSRegularExpression, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSRegularExpression, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSRegularExpression, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSRegularExpression, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSRegularExpression, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSRegularExpression, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSRegularExpression, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSRegularExpression self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSRegularExpression retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSRegularExpression autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSRegularExpression, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSRegularExpression? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_regularExpression = objc.registerName("regularExpression"); -late final _sel_phoneNumber = objc.registerName("phoneNumber"); -late final _sel_numberOfRanges = objc.registerName("numberOfRanges"); -late final _sel_rangeAtIndex_ = objc.registerName("rangeAtIndex:"); -final _objc_msgSend_rmij85 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_rmij85Stret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_rangeWithName_ = objc.registerName("rangeWithName:"); -final _objc_msgSend_1pl4rx6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1pl4rx6Stret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_resultByAdjustingRangesWithOffset_ = - objc.registerName("resultByAdjustingRangesWithOffset:"); -late final _sel_addressComponents = objc.registerName("addressComponents"); -late final _sel_orthographyCheckingResultWithRange_orthography_ = - objc.registerName("orthographyCheckingResultWithRange:orthography:"); -final _objc_msgSend_1g0atks = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_spellCheckingResultWithRange_ = - objc.registerName("spellCheckingResultWithRange:"); -late final _sel_grammarCheckingResultWithRange_details_ = - objc.registerName("grammarCheckingResultWithRange:details:"); -late final _sel_dateCheckingResultWithRange_date_ = - objc.registerName("dateCheckingResultWithRange:date:"); -late final _sel_dateCheckingResultWithRange_date_timeZone_duration_ = - objc.registerName("dateCheckingResultWithRange:date:timeZone:duration:"); -final _objc_msgSend_1trgi6b = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer, - ffi.Double)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer, - double)>(); -late final _sel_addressCheckingResultWithRange_components_ = - objc.registerName("addressCheckingResultWithRange:components:"); -late final _sel_linkCheckingResultWithRange_URL_ = - objc.registerName("linkCheckingResultWithRange:URL:"); -late final _sel_quoteCheckingResultWithRange_replacementString_ = - objc.registerName("quoteCheckingResultWithRange:replacementString:"); -late final _sel_dashCheckingResultWithRange_replacementString_ = - objc.registerName("dashCheckingResultWithRange:replacementString:"); -late final _sel_replacementCheckingResultWithRange_replacementString_ = - objc.registerName("replacementCheckingResultWithRange:replacementString:"); -late final _sel_correctionCheckingResultWithRange_replacementString_ = - objc.registerName("correctionCheckingResultWithRange:replacementString:"); -late final _sel_correctionCheckingResultWithRange_replacementString_alternativeStrings_ = - objc.registerName( - "correctionCheckingResultWithRange:replacementString:alternativeStrings:"); -final _objc_msgSend_1desjtb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_regularExpressionCheckingResultWithRanges_count_regularExpression_ = - objc.registerName( - "regularExpressionCheckingResultWithRanges:count:regularExpression:"); -final _objc_msgSend_1s39epe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_phoneNumberCheckingResultWithRange_phoneNumber_ = - objc.registerName("phoneNumberCheckingResultWithRange:phoneNumber:"); -late final _sel_transitInformationCheckingResultWithRange_components_ = - objc.registerName("transitInformationCheckingResultWithRange:components:"); - -/// NSTextCheckingResult -class NSTextCheckingResult extends objc.NSObject { - NSTextCheckingResult._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTextCheckingResult] that points to the same underlying object as [other]. - NSTextCheckingResult.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTextCheckingResult] that wraps the given raw object pointer. - NSTextCheckingResult.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTextCheckingResult]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTextCheckingResult); - } - - /// resultType - NSTextCheckingType get resultType { - final _ret = _objc_msgSend_1d8v3ql(this.ref.pointer, _sel_resultType); - return NSTextCheckingType.fromValue(_ret); - } - - /// range - objc.NSRange get range { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_vi3lefStret(_ptr, this.ref.pointer, _sel_range) - : _ptr.ref = _objc_msgSend_vi3lef(this.ref.pointer, _sel_range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// orthography - NSOrthography? get orthography { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_orthography); - return _ret.address == 0 - ? null - : NSOrthography.castFromPointer(_ret, retain: true, release: true); - } - - /// grammarDetails - objc.NSArray? get grammarDetails { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_grammarDetails); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// date - objc.NSDate? get date { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_date); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZone - NSTimeZone? get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// duration - double get duration { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_duration) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_duration); - } - - /// components - objc.NSDictionary? get components { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_components); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// replacementString - objc.NSString? get replacementString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_replacementString); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// alternativeStrings - objc.NSArray? get alternativeStrings { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_alternativeStrings); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// regularExpression - NSRegularExpression? get regularExpression { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_regularExpression); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// phoneNumber - objc.NSString? get phoneNumber { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_phoneNumber); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// numberOfRanges - int get numberOfRanges { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_numberOfRanges); - } - - /// rangeAtIndex: - objc.NSRange rangeAtIndex_(int idx) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_rmij85Stret( - _ptr, this.ref.pointer, _sel_rangeAtIndex_, idx) - : _ptr.ref = - _objc_msgSend_rmij85(this.ref.pointer, _sel_rangeAtIndex_, idx); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// rangeWithName: - objc.NSRange rangeWithName_(objc.NSString name) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1pl4rx6Stret( - _ptr, this.ref.pointer, _sel_rangeWithName_, name.ref.pointer) - : _ptr.ref = _objc_msgSend_1pl4rx6( - this.ref.pointer, _sel_rangeWithName_, name.ref.pointer); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// resultByAdjustingRangesWithOffset: - NSTextCheckingResult resultByAdjustingRangesWithOffset_(int offset) { - final _ret = _objc_msgSend_crtxa9( - this.ref.pointer, _sel_resultByAdjustingRangesWithOffset_, offset); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// addressComponents - objc.NSDictionary? get addressComponents { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_addressComponents); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// orthographyCheckingResultWithRange:orthography: - static NSTextCheckingResult orthographyCheckingResultWithRange_orthography_( - objc.NSRange range, NSOrthography orthography) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_orthographyCheckingResultWithRange_orthography_, - range, - orthography.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// spellCheckingResultWithRange: - static NSTextCheckingResult spellCheckingResultWithRange_( - objc.NSRange range) { - final _ret = _objc_msgSend_176f8tz( - _class_NSTextCheckingResult, _sel_spellCheckingResultWithRange_, range); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// grammarCheckingResultWithRange:details: - static NSTextCheckingResult grammarCheckingResultWithRange_details_( - objc.NSRange range, objc.NSArray details) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_grammarCheckingResultWithRange_details_, - range, - details.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// dateCheckingResultWithRange:date: - static NSTextCheckingResult dateCheckingResultWithRange_date_( - objc.NSRange range, objc.NSDate date) { - final _ret = _objc_msgSend_1g0atks(_class_NSTextCheckingResult, - _sel_dateCheckingResultWithRange_date_, range, date.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// dateCheckingResultWithRange:date:timeZone:duration: - static NSTextCheckingResult - dateCheckingResultWithRange_date_timeZone_duration_(objc.NSRange range, - objc.NSDate date, NSTimeZone timeZone, double duration) { - final _ret = _objc_msgSend_1trgi6b( - _class_NSTextCheckingResult, - _sel_dateCheckingResultWithRange_date_timeZone_duration_, - range, - date.ref.pointer, - timeZone.ref.pointer, - duration); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// addressCheckingResultWithRange:components: - static NSTextCheckingResult addressCheckingResultWithRange_components_( - objc.NSRange range, objc.NSDictionary components) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_addressCheckingResultWithRange_components_, - range, - components.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// linkCheckingResultWithRange:URL: - static NSTextCheckingResult linkCheckingResultWithRange_URL_( - objc.NSRange range, objc.NSURL url) { - final _ret = _objc_msgSend_1g0atks(_class_NSTextCheckingResult, - _sel_linkCheckingResultWithRange_URL_, range, url.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// quoteCheckingResultWithRange:replacementString: - static NSTextCheckingResult quoteCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_quoteCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// dashCheckingResultWithRange:replacementString: - static NSTextCheckingResult dashCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_dashCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// replacementCheckingResultWithRange:replacementString: - static NSTextCheckingResult - replacementCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_replacementCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// correctionCheckingResultWithRange:replacementString: - static NSTextCheckingResult - correctionCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_correctionCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// correctionCheckingResultWithRange:replacementString:alternativeStrings: - static NSTextCheckingResult - correctionCheckingResultWithRange_replacementString_alternativeStrings_( - objc.NSRange range, - objc.NSString replacementString, - objc.NSArray alternativeStrings) { - final _ret = _objc_msgSend_1desjtb( - _class_NSTextCheckingResult, - _sel_correctionCheckingResultWithRange_replacementString_alternativeStrings_, - range, - replacementString.ref.pointer, - alternativeStrings.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// regularExpressionCheckingResultWithRanges:count:regularExpression: - static NSTextCheckingResult - regularExpressionCheckingResultWithRanges_count_regularExpression_( - ffi.Pointer ranges, - int count, - NSRegularExpression regularExpression) { - final _ret = _objc_msgSend_1s39epe( - _class_NSTextCheckingResult, - _sel_regularExpressionCheckingResultWithRanges_count_regularExpression_, - ranges, - count, - regularExpression.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// phoneNumberCheckingResultWithRange:phoneNumber: - static NSTextCheckingResult phoneNumberCheckingResultWithRange_phoneNumber_( - objc.NSRange range, objc.NSString phoneNumber) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_phoneNumberCheckingResultWithRange_phoneNumber_, - range, - phoneNumber.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// transitInformationCheckingResultWithRange:components: - static NSTextCheckingResult - transitInformationCheckingResultWithRange_components_( - objc.NSRange range, objc.NSDictionary components) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_transitInformationCheckingResultWithRange_components_, - range, - components.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSTextCheckingResult init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSTextCheckingResult new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTextCheckingResult, _sel_new); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSTextCheckingResult allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSTextCheckingResult, _sel_allocWithZone_, zone); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSTextCheckingResult alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTextCheckingResult, _sel_alloc); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTextCheckingResult, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTextCheckingResult, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTextCheckingResult, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSTextCheckingResult, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTextCheckingResult, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTextCheckingResult, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTextCheckingResult, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTextCheckingResult, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTextCheckingResult, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSTextCheckingResult self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSTextCheckingResult retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSTextCheckingResult autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSTextCheckingResult, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSTextCheckingResult? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _class_NSTimer = objc.getClass("NSTimer"); -late final _sel_timerWithTimeInterval_invocation_repeats_ = - objc.registerName("timerWithTimeInterval:invocation:repeats:"); -final _objc_msgSend_1dbp0rg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer, - bool)>(); -late final _sel_scheduledTimerWithTimeInterval_invocation_repeats_ = - objc.registerName("scheduledTimerWithTimeInterval:invocation:repeats:"); -late final _sel_timerWithTimeInterval_target_selector_userInfo_repeats_ = objc - .registerName("timerWithTimeInterval:target:selector:userInfo:repeats:"); -final _objc_msgSend_12fx7q4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_ = - objc.registerName( - "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:"); -void _ObjCBlock_ffiVoid_NSTimer_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTimer_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTimer_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTimer_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTimer_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTimer_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTimer_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSTimer_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSTimer_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSTimer { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSTimer_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSTimer) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTimer_closureCallable, - (ffi.Pointer arg0) => fn( - NSTimer.castFromPointer(arg0, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSTimer) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTimer_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => - fn(NSTimer.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSTimer_CallExtension - on objc.ObjCBlock { - void call(NSTimer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_timerWithTimeInterval_repeats_block_ = - objc.registerName("timerWithTimeInterval:repeats:block:"); -final _objc_msgSend_1t6yrah = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Bool, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - double, - bool, - ffi.Pointer)>(); -late final _sel_scheduledTimerWithTimeInterval_repeats_block_ = - objc.registerName("scheduledTimerWithTimeInterval:repeats:block:"); -late final _sel_initWithFireDate_interval_repeats_block_ = - objc.registerName("initWithFireDate:interval:repeats:block:"); -final _objc_msgSend_tzx95k = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Bool, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - double, - bool, - ffi.Pointer)>(); -late final _sel_initWithFireDate_interval_target_selector_userInfo_repeats_ = - objc.registerName( - "initWithFireDate:interval:target:selector:userInfo:repeats:"); -final _objc_msgSend_1thgzrb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_fire = objc.registerName("fire"); -late final _sel_fireDate = objc.registerName("fireDate"); -late final _sel_setFireDate_ = objc.registerName("setFireDate:"); -late final _sel_timeInterval = objc.registerName("timeInterval"); -late final _sel_tolerance = objc.registerName("tolerance"); -late final _sel_setTolerance_ = objc.registerName("setTolerance:"); - -/// NSTimer -class NSTimer extends objc.NSObject { - NSTimer._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTimer] that points to the same underlying object as [other]. - NSTimer.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTimer] that wraps the given raw object pointer. - NSTimer.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTimer]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTimer); - } - - /// timerWithTimeInterval:invocation:repeats: - static NSTimer timerWithTimeInterval_invocation_repeats_( - double ti, objc.NSInvocation invocation, bool yesOrNo) { - final _ret = _objc_msgSend_1dbp0rg( - _class_NSTimer, - _sel_timerWithTimeInterval_invocation_repeats_, - ti, - invocation.ref.pointer, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// scheduledTimerWithTimeInterval:invocation:repeats: - static NSTimer scheduledTimerWithTimeInterval_invocation_repeats_( - double ti, objc.NSInvocation invocation, bool yesOrNo) { - final _ret = _objc_msgSend_1dbp0rg( - _class_NSTimer, - _sel_scheduledTimerWithTimeInterval_invocation_repeats_, - ti, - invocation.ref.pointer, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// timerWithTimeInterval:target:selector:userInfo:repeats: - static NSTimer timerWithTimeInterval_target_selector_userInfo_repeats_( - double ti, - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? userInfo, - bool yesOrNo) { - final _ret = _objc_msgSend_12fx7q4( - _class_NSTimer, - _sel_timerWithTimeInterval_target_selector_userInfo_repeats_, - ti, - aTarget.ref.pointer, - aSelector, - userInfo?.ref.pointer ?? ffi.nullptr, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: - static NSTimer - scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( - double ti, - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? userInfo, - bool yesOrNo) { - final _ret = _objc_msgSend_12fx7q4( - _class_NSTimer, - _sel_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_, - ti, - aTarget.ref.pointer, - aSelector, - userInfo?.ref.pointer ?? ffi.nullptr, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// timerWithTimeInterval:repeats:block: - static NSTimer timerWithTimeInterval_repeats_block_(double interval, - bool repeats, objc.ObjCBlock block) { - final _ret = _objc_msgSend_1t6yrah( - _class_NSTimer, - _sel_timerWithTimeInterval_repeats_block_, - interval, - repeats, - block.ref.pointer); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// scheduledTimerWithTimeInterval:repeats:block: - static NSTimer scheduledTimerWithTimeInterval_repeats_block_(double interval, - bool repeats, objc.ObjCBlock block) { - final _ret = _objc_msgSend_1t6yrah( - _class_NSTimer, - _sel_scheduledTimerWithTimeInterval_repeats_block_, - interval, - repeats, - block.ref.pointer); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithFireDate:interval:repeats:block: - NSTimer initWithFireDate_interval_repeats_block_( - objc.NSDate date, - double interval, - bool repeats, - objc.ObjCBlock block) { - final _ret = _objc_msgSend_tzx95k( - this.ref.retainAndReturnPointer(), - _sel_initWithFireDate_interval_repeats_block_, - date.ref.pointer, - interval, - repeats, - block.ref.pointer); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithFireDate:interval:target:selector:userInfo:repeats: - NSTimer initWithFireDate_interval_target_selector_userInfo_repeats_( - objc.NSDate date, - double ti, - objc.ObjCObjectBase t, - ffi.Pointer s, - objc.ObjCObjectBase? ui, - bool rep) { - final _ret = _objc_msgSend_1thgzrb( - this.ref.retainAndReturnPointer(), - _sel_initWithFireDate_interval_target_selector_userInfo_repeats_, - date.ref.pointer, - ti, - t.ref.pointer, - s, - ui?.ref.pointer ?? ffi.nullptr, - rep); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// fire - void fire() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_fire); - } - - /// fireDate - objc.NSDate get fireDate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fireDate); - return objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setFireDate: - set fireDate(objc.NSDate value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFireDate_, value.ref.pointer); - } - - /// timeInterval - double get timeInterval { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_timeInterval) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeInterval); - } - - /// tolerance - double get tolerance { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_tolerance) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_tolerance); - } - - /// setTolerance: - set tolerance(double value) { - return _objc_msgSend_suh039(this.ref.pointer, _sel_setTolerance_, value); - } - - /// invalidate - void invalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidate); - } - - /// isValid - bool get valid { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValid); - } - - /// userInfo - objc.ObjCObjectBase? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// init - NSTimer init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSTimer new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimer, _sel_new); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSTimer allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSTimer, _sel_allocWithZone_, zone); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSTimer alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimer, _sel_alloc); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTimer, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTimer, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTimer, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSTimer, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTimer, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTimer, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTimer, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTimer, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimer, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSURLCache = objc.getClass("NSURLCache"); -late final _sel_sharedURLCache = objc.registerName("sharedURLCache"); -late final _sel_setSharedURLCache_ = objc.registerName("setSharedURLCache:"); -late final _sel_initWithMemoryCapacity_diskCapacity_diskPath_ = - objc.registerName("initWithMemoryCapacity:diskCapacity:diskPath:"); -final _objc_msgSend_ebb7er = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -late final _sel_initWithMemoryCapacity_diskCapacity_directoryURL_ = - objc.registerName("initWithMemoryCapacity:diskCapacity:directoryURL:"); -late final _class_NSCachedURLResponse = objc.getClass("NSCachedURLResponse"); -late final _sel_initWithResponse_data_ = - objc.registerName("initWithResponse:data:"); - -enum NSURLCacheStoragePolicy { - NSURLCacheStorageAllowed(0), - NSURLCacheStorageAllowedInMemoryOnly(1), - NSURLCacheStorageNotAllowed(2); - - final int value; - const NSURLCacheStoragePolicy(this.value); - - static NSURLCacheStoragePolicy fromValue(int value) => switch (value) { - 0 => NSURLCacheStorageAllowed, - 1 => NSURLCacheStorageAllowedInMemoryOnly, - 2 => NSURLCacheStorageNotAllowed, - _ => throw ArgumentError( - "Unknown value for NSURLCacheStoragePolicy: $value"), - }; -} - -late final _sel_initWithResponse_data_userInfo_storagePolicy_ = - objc.registerName("initWithResponse:data:userInfo:storagePolicy:"); -final _objc_msgSend_nhp99d = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_storagePolicy = objc.registerName("storagePolicy"); -final _objc_msgSend_1xh4qg4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); - -/// NSCachedURLResponse -class NSCachedURLResponse extends objc.NSObject { - NSCachedURLResponse._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSCachedURLResponse] that points to the same underlying object as [other]. - NSCachedURLResponse.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSCachedURLResponse] that wraps the given raw object pointer. - NSCachedURLResponse.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSCachedURLResponse]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSCachedURLResponse); - } - - /// initWithResponse:data: - NSCachedURLResponse initWithResponse_data_( - NSURLResponse response, objc.NSData data) { - final _ret = _objc_msgSend_iq11qg(this.ref.retainAndReturnPointer(), - _sel_initWithResponse_data_, response.ref.pointer, data.ref.pointer); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithResponse:data:userInfo:storagePolicy: - NSCachedURLResponse initWithResponse_data_userInfo_storagePolicy_( - NSURLResponse response, - objc.NSData data, - objc.NSDictionary? userInfo, - NSURLCacheStoragePolicy storagePolicy) { - final _ret = _objc_msgSend_nhp99d( - this.ref.retainAndReturnPointer(), - _sel_initWithResponse_data_userInfo_storagePolicy_, - response.ref.pointer, - data.ref.pointer, - userInfo?.ref.pointer ?? ffi.nullptr, - storagePolicy.value); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// response - NSURLResponse get response { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_response); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// data - objc.NSData get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// userInfo - objc.NSDictionary? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// storagePolicy - NSURLCacheStoragePolicy get storagePolicy { - final _ret = _objc_msgSend_1xh4qg4(this.ref.pointer, _sel_storagePolicy); - return NSURLCacheStoragePolicy.fromValue(_ret); - } - - /// init - NSCachedURLResponse init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSCachedURLResponse new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCachedURLResponse, _sel_new); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSCachedURLResponse allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSCachedURLResponse, _sel_allocWithZone_, zone); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSCachedURLResponse alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCachedURLResponse, _sel_alloc); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSCachedURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSCachedURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSCachedURLResponse, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSCachedURLResponse, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSCachedURLResponse, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSCachedURLResponse, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSCachedURLResponse, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCachedURLResponse, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCachedURLResponse, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSCachedURLResponse self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSCachedURLResponse retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSCachedURLResponse autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSCachedURLResponse, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSCachedURLResponse? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_cachedResponseForRequest_ = - objc.registerName("cachedResponseForRequest:"); -late final _sel_storeCachedResponse_forRequest_ = - objc.registerName("storeCachedResponse:forRequest:"); -late final _sel_removeCachedResponseForRequest_ = - objc.registerName("removeCachedResponseForRequest:"); -late final _sel_removeAllCachedResponses = - objc.registerName("removeAllCachedResponses"); -late final _sel_removeCachedResponsesSinceDate_ = - objc.registerName("removeCachedResponsesSinceDate:"); -late final _sel_memoryCapacity = objc.registerName("memoryCapacity"); -late final _sel_setMemoryCapacity_ = objc.registerName("setMemoryCapacity:"); -late final _sel_diskCapacity = objc.registerName("diskCapacity"); -late final _sel_setDiskCapacity_ = objc.registerName("setDiskCapacity:"); -late final _sel_currentMemoryUsage = objc.registerName("currentMemoryUsage"); -late final _sel_currentDiskUsage = objc.registerName("currentDiskUsage"); -late final _class_NSURLSessionDataTask = objc.getClass("NSURLSessionDataTask"); - -/// NSURLSessionDataTask -class NSURLSessionDataTask extends NSURLSessionTask { - NSURLSessionDataTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionDataTask] that points to the same underlying object as [other]. - NSURLSessionDataTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionDataTask] that wraps the given raw object pointer. - NSURLSessionDataTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionDataTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionDataTask); - } - - /// init - NSURLSessionDataTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionDataTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionDataTask, _sel_new); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionDataTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionDataTask, _sel_allocWithZone_, zone); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionDataTask alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionDataTask, _sel_alloc); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionDataTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionDataTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDataTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDataTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionDataTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionDataTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionDataTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDataTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDataTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionDataTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionDataTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionDataTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_storeCachedResponse_forDataTask_ = - objc.registerName("storeCachedResponse:forDataTask:"); -void _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSCachedURLResponse_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSCachedURLResponse_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSCachedURLResponse_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerCallable = ffi - .NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSCachedURLResponse { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSCachedURLResponse?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSCachedURLResponse_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSCachedURLResponse?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSCachedURLResponse_CallExtension - on objc.ObjCBlock { - void call(NSCachedURLResponse? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getCachedResponseForDataTask_completionHandler_ = - objc.registerName("getCachedResponseForDataTask:completionHandler:"); -late final _sel_removeCachedResponseForDataTask_ = - objc.registerName("removeCachedResponseForDataTask:"); - -/// NSURLCache -class NSURLCache extends objc.NSObject { - NSURLCache._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLCache] that points to the same underlying object as [other]. - NSURLCache.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLCache] that wraps the given raw object pointer. - NSURLCache.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLCache]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCache); - } - - /// sharedURLCache - static NSURLCache getSharedURLCache() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_sharedURLCache); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// setSharedURLCache: - static void setSharedURLCache(NSURLCache value) { - return _objc_msgSend_ukcdfq( - _class_NSURLCache, _sel_setSharedURLCache_, value.ref.pointer); - } - - /// initWithMemoryCapacity:diskCapacity:diskPath: - NSURLCache initWithMemoryCapacity_diskCapacity_diskPath_( - int memoryCapacity, int diskCapacity, objc.NSString? path) { - final _ret = _objc_msgSend_ebb7er( - this.ref.retainAndReturnPointer(), - _sel_initWithMemoryCapacity_diskCapacity_diskPath_, - memoryCapacity, - diskCapacity, - path?.ref.pointer ?? ffi.nullptr); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithMemoryCapacity:diskCapacity:directoryURL: - NSURLCache initWithMemoryCapacity_diskCapacity_directoryURL_( - int memoryCapacity, int diskCapacity, objc.NSURL? directoryURL) { - final _ret = _objc_msgSend_ebb7er( - this.ref.retainAndReturnPointer(), - _sel_initWithMemoryCapacity_diskCapacity_directoryURL_, - memoryCapacity, - diskCapacity, - directoryURL?.ref.pointer ?? ffi.nullptr); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// cachedResponseForRequest: - NSCachedURLResponse? cachedResponseForRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_cachedResponseForRequest_, request.ref.pointer); - return _ret.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// storeCachedResponse:forRequest: - void storeCachedResponse_forRequest_( - NSCachedURLResponse cachedResponse, NSURLRequest request) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_storeCachedResponse_forRequest_, - cachedResponse.ref.pointer, - request.ref.pointer); - } - - /// removeCachedResponseForRequest: - void removeCachedResponseForRequest_(NSURLRequest request) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_removeCachedResponseForRequest_, - request.ref.pointer); - } - - /// removeAllCachedResponses - void removeAllCachedResponses() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllCachedResponses); - } - - /// removeCachedResponsesSinceDate: - void removeCachedResponsesSinceDate_(objc.NSDate date) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_removeCachedResponsesSinceDate_, - date.ref.pointer); - } - - /// memoryCapacity - int get memoryCapacity { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_memoryCapacity); - } - - /// setMemoryCapacity: - set memoryCapacity(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMemoryCapacity_, value); - } - - /// diskCapacity - int get diskCapacity { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_diskCapacity); - } - - /// setDiskCapacity: - set diskCapacity(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setDiskCapacity_, value); - } - - /// currentMemoryUsage - int get currentMemoryUsage { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_currentMemoryUsage); - } - - /// currentDiskUsage - int get currentDiskUsage { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_currentDiskUsage); - } - - /// storeCachedResponse:forDataTask: - void storeCachedResponse_forDataTask_( - NSCachedURLResponse cachedResponse, NSURLSessionDataTask dataTask) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_storeCachedResponse_forDataTask_, - cachedResponse.ref.pointer, - dataTask.ref.pointer); - } - - /// getCachedResponseForDataTask:completionHandler: - void getCachedResponseForDataTask_completionHandler_( - NSURLSessionDataTask dataTask, - objc.ObjCBlock - completionHandler) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_getCachedResponseForDataTask_completionHandler_, - dataTask.ref.pointer, - completionHandler.ref.pointer); - } - - /// removeCachedResponseForDataTask: - void removeCachedResponseForDataTask_(NSURLSessionDataTask dataTask) { - _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_removeCachedResponseForDataTask_, dataTask.ref.pointer); - } - - /// init - NSURLCache init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLCache new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_new); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLCache allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLCache, _sel_allocWithZone_, zone); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLCache alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_alloc); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLCache, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLCache, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLCache, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLCache, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLCache, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLCache, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLCache, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCache, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLCache self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLCache retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLCache autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSURLConnection = objc.getClass("NSURLConnection"); -late final _sel_initWithRequest_delegate_startImmediately_ = - objc.registerName("initWithRequest:delegate:startImmediately:"); -final _objc_msgSend_at5jtv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_initWithRequest_delegate_ = - objc.registerName("initWithRequest:delegate:"); -late final _sel_connectionWithRequest_delegate_ = - objc.registerName("connectionWithRequest:delegate:"); -late final _sel_unscheduleFromRunLoop_forMode_ = - objc.registerName("unscheduleFromRunLoop:forMode:"); -late final _sel_setDelegateQueue_ = objc.registerName("setDelegateQueue:"); -late final _sel_canHandleRequest_ = objc.registerName("canHandleRequest:"); -late final _sel_sendSynchronousRequest_returningResponse_error_ = - objc.registerName("sendSynchronousRequest:returningResponse:error:"); -void _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(NSURLResponse?, objc.NSData?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSURLResponse?, objc.NSData?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 ? null : NSURLResponse.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : objc.NSData.castFromPointer(arg1, retain: true, release: true), - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(NSURLResponse?, objc.NSData?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : NSURLResponse.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : objc.NSData.castFromPointer(arg1, - retain: false, release: true), - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(NSURLResponse?, objc.NSData?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_CallExtension on objc - .ObjCBlock { - void call(NSURLResponse? arg0, objc.NSData? arg1, objc.NSError? arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, - arg1?.ref.pointer ?? ffi.nullptr, - arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_sendAsynchronousRequest_queue_completionHandler_ = - objc.registerName("sendAsynchronousRequest:queue:completionHandler:"); -void _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock?, objc.NSError)>`. -abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock?, objc.NSError)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, - objc.NSError)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock?, objc.NSError)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock?, objc.NSError)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock?, objc.NSError)> fromFunction( - void Function(objc.ObjCObjectBase?, objc.NSError) fn) => - objc.ObjCBlock?, objc.NSError)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0.address == 0 - ? null - : objc.ObjCObjectBase(arg0, retain: true, release: true), - objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock?, objc.NSError)> - listener(void Function(objc.ObjCObjectBase?, objc.NSError) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - arg0.address == 0 - ? null - : objc.ObjCObjectBase(arg0, retain: false, release: true), - objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, - objc.NSError)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock?, objc.NSError)>`. -extension ObjCBlock_ffiVoid_objcObjCObject_NSError_CallExtension on objc - .ObjCBlock?, objc.NSError)> { - void call(objc.ObjCObjectBase? arg0, objc.NSError arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1.ref.pointer); -} - -final _objc_msgSend_10t0qpd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); - -/// NSURLConnection -class NSURLConnection extends objc.NSObject { - NSURLConnection._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLConnection] that points to the same underlying object as [other]. - NSURLConnection.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLConnection] that wraps the given raw object pointer. - NSURLConnection.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLConnection]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLConnection); - } - - /// initWithRequest:delegate:startImmediately: - NSURLConnection? initWithRequest_delegate_startImmediately_( - NSURLRequest request, - objc.ObjCObjectBase? delegate, - bool startImmediately) { - final _ret = _objc_msgSend_at5jtv( - this.ref.retainAndReturnPointer(), - _sel_initWithRequest_delegate_startImmediately_, - request.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr, - startImmediately); - return _ret.address == 0 - ? null - : NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithRequest:delegate: - NSURLConnection? initWithRequest_delegate_( - NSURLRequest request, objc.ObjCObjectBase? delegate) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithRequest_delegate_, - request.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// connectionWithRequest:delegate: - static NSURLConnection? connectionWithRequest_delegate_( - NSURLRequest request, objc.ObjCObjectBase? delegate) { - final _ret = _objc_msgSend_iq11qg( - _class_NSURLConnection, - _sel_connectionWithRequest_delegate_, - request.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// originalRequest - NSURLRequest get originalRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_originalRequest); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// currentRequest - NSURLRequest get currentRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentRequest); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// start - void start() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_start); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// scheduleInRunLoop:forMode: - void scheduleInRunLoop_forMode_(objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// unscheduleFromRunLoop:forMode: - void unscheduleFromRunLoop_forMode_( - objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_unscheduleFromRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// setDelegateQueue: - void setDelegateQueue_(NSOperationQueue? queue) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDelegateQueue_, - queue?.ref.pointer ?? ffi.nullptr); - } - - /// canHandleRequest: - static bool canHandleRequest_(NSURLRequest request) { - return _objc_msgSend_l8lotg( - _class_NSURLConnection, _sel_canHandleRequest_, request.ref.pointer); - } - - /// sendSynchronousRequest:returningResponse:error: - static objc.NSData? sendSynchronousRequest_returningResponse_error_( - NSURLRequest request, - ffi.Pointer> response, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1dca44n( - _class_NSURLConnection, - _sel_sendSynchronousRequest_returningResponse_error_, - request.ref.pointer, - response, - error); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// sendAsynchronousRequest:queue:completionHandler: - static void sendAsynchronousRequest_queue_completionHandler_( - NSURLRequest request, - NSOperationQueue queue, - objc.ObjCBlock< - ffi.Void Function(NSURLResponse?, objc.NSData?, objc.NSError?)> - handler) { - _objc_msgSend_10t0qpd( - _class_NSURLConnection, - _sel_sendAsynchronousRequest_queue_completionHandler_, - request.ref.pointer, - queue.ref.pointer, - handler.ref.pointer); - } - - /// init - NSURLConnection init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLConnection new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLConnection, _sel_new); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLConnection allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLConnection, _sel_allocWithZone_, zone); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLConnection alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLConnection, _sel_alloc); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLConnection, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLConnection, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLConnection, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLConnection, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLConnection, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLConnection, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLConnection, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLConnection, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLConnection, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLConnection self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLConnection retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLConnection autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSURLCredential = objc.getClass("NSURLCredential"); - -enum NSURLCredentialPersistence { - NSURLCredentialPersistenceNone(0), - NSURLCredentialPersistenceForSession(1), - NSURLCredentialPersistencePermanent(2), - NSURLCredentialPersistenceSynchronizable(3); - - final int value; - const NSURLCredentialPersistence(this.value); - - static NSURLCredentialPersistence fromValue(int value) => switch (value) { - 0 => NSURLCredentialPersistenceNone, - 1 => NSURLCredentialPersistenceForSession, - 2 => NSURLCredentialPersistencePermanent, - 3 => NSURLCredentialPersistenceSynchronizable, - _ => throw ArgumentError( - "Unknown value for NSURLCredentialPersistence: $value"), - }; -} - -late final _sel_persistence = objc.registerName("persistence"); -final _objc_msgSend_1dwdxi1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_initWithUser_password_persistence_ = - objc.registerName("initWithUser:password:persistence:"); -final _objc_msgSend_nwxkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_credentialWithUser_password_persistence_ = - objc.registerName("credentialWithUser:password:persistence:"); -late final _sel_user = objc.registerName("user"); -late final _sel_password = objc.registerName("password"); -late final _sel_hasPassword = objc.registerName("hasPassword"); - -final class __SecIdentity extends ffi.Opaque {} - -late final _sel_initWithIdentity_certificates_persistence_ = - objc.registerName("initWithIdentity:certificates:persistence:"); -final _objc_msgSend_1lfx01 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<__SecIdentity>, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<__SecIdentity>, - ffi.Pointer, - int)>(); -late final _sel_credentialWithIdentity_certificates_persistence_ = - objc.registerName("credentialWithIdentity:certificates:persistence:"); -late final _sel_identity = objc.registerName("identity"); -final _objc_msgSend_1dyqaf3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer<__SecIdentity> Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer<__SecIdentity> Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_certificates = objc.registerName("certificates"); - -final class __SecTrust extends ffi.Opaque {} - -late final _sel_initWithTrust_ = objc.registerName("initWithTrust:"); -final _objc_msgSend_a2ucgd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<__SecTrust>)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<__SecTrust>)>(); -late final _sel_credentialForTrust_ = objc.registerName("credentialForTrust:"); - -/// NSURLCredential -class NSURLCredential extends objc.NSObject { - NSURLCredential._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLCredential] that points to the same underlying object as [other]. - NSURLCredential.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLCredential] that wraps the given raw object pointer. - NSURLCredential.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLCredential]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCredential); - } - - /// persistence - NSURLCredentialPersistence get persistence { - final _ret = _objc_msgSend_1dwdxi1(this.ref.pointer, _sel_persistence); - return NSURLCredentialPersistence.fromValue(_ret); - } - - /// initWithUser:password:persistence: - NSURLCredential initWithUser_password_persistence_(objc.NSString user, - objc.NSString password, NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_nwxkj( - this.ref.retainAndReturnPointer(), - _sel_initWithUser_password_persistence_, - user.ref.pointer, - password.ref.pointer, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// credentialWithUser:password:persistence: - static NSURLCredential credentialWithUser_password_persistence_( - objc.NSString user, - objc.NSString password, - NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_nwxkj( - _class_NSURLCredential, - _sel_credentialWithUser_password_persistence_, - user.ref.pointer, - password.ref.pointer, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// user - objc.NSString? get user { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_user); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// password - objc.NSString? get password { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_password); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// hasPassword - bool get hasPassword { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasPassword); - } - - /// initWithIdentity:certificates:persistence: - NSURLCredential initWithIdentity_certificates_persistence_( - ffi.Pointer<__SecIdentity> identity, - objc.NSArray? certArray, - NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_1lfx01( - this.ref.retainAndReturnPointer(), - _sel_initWithIdentity_certificates_persistence_, - identity, - certArray?.ref.pointer ?? ffi.nullptr, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// credentialWithIdentity:certificates:persistence: - static NSURLCredential credentialWithIdentity_certificates_persistence_( - ffi.Pointer<__SecIdentity> identity, - objc.NSArray? certArray, - NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_1lfx01( - _class_NSURLCredential, - _sel_credentialWithIdentity_certificates_persistence_, - identity, - certArray?.ref.pointer ?? ffi.nullptr, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// identity - ffi.Pointer<__SecIdentity> get identity { - return _objc_msgSend_1dyqaf3(this.ref.pointer, _sel_identity); - } - - /// certificates - objc.NSArray get certificates { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_certificates); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithTrust: - NSURLCredential initWithTrust_(ffi.Pointer<__SecTrust> trust) { - final _ret = _objc_msgSend_a2ucgd( - this.ref.retainAndReturnPointer(), _sel_initWithTrust_, trust); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// credentialForTrust: - static NSURLCredential credentialForTrust_(ffi.Pointer<__SecTrust> trust) { - final _ret = _objc_msgSend_a2ucgd( - _class_NSURLCredential, _sel_credentialForTrust_, trust); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLCredential init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLCredential new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCredential, _sel_new); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLCredential allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLCredential, _sel_allocWithZone_, zone); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLCredential alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCredential, _sel_alloc); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLCredential, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLCredential, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLCredential, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLCredential, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLCredential, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLCredential, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLCredential, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredential, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredential, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLCredential self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLCredential retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLCredential autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSURLCredential, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLCredential? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSURLProtectionSpace = objc.getClass("NSURLProtectionSpace"); -late final _sel_initWithHost_port_protocol_realm_authenticationMethod_ = - objc.registerName("initWithHost:port:protocol:realm:authenticationMethod:"); -final _objc_msgSend_sfgdlr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_initWithProxyHost_port_type_realm_authenticationMethod_ = objc - .registerName("initWithProxyHost:port:type:realm:authenticationMethod:"); -late final _sel_realm = objc.registerName("realm"); -late final _sel_receivesCredentialSecurely = - objc.registerName("receivesCredentialSecurely"); -late final _sel_host = objc.registerName("host"); -late final _sel_proxyType = objc.registerName("proxyType"); -late final _sel_protocol = objc.registerName("protocol"); -late final _sel_authenticationMethod = - objc.registerName("authenticationMethod"); -late final _sel_distinguishedNames = objc.registerName("distinguishedNames"); -late final _sel_serverTrust = objc.registerName("serverTrust"); -final _objc_msgSend_uv0l05 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer<__SecTrust> Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer<__SecTrust> Function( - ffi.Pointer, ffi.Pointer)>(); - -/// NSURLProtectionSpace -class NSURLProtectionSpace extends objc.NSObject { - NSURLProtectionSpace._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLProtectionSpace] that points to the same underlying object as [other]. - NSURLProtectionSpace.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLProtectionSpace] that wraps the given raw object pointer. - NSURLProtectionSpace.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLProtectionSpace]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLProtectionSpace); - } - - /// initWithHost:port:protocol:realm:authenticationMethod: - NSURLProtectionSpace initWithHost_port_protocol_realm_authenticationMethod_( - objc.NSString host, - int port, - objc.NSString? protocol, - objc.NSString? realm, - objc.NSString? authenticationMethod) { - final _ret = _objc_msgSend_sfgdlr( - this.ref.retainAndReturnPointer(), - _sel_initWithHost_port_protocol_realm_authenticationMethod_, - host.ref.pointer, - port, - protocol?.ref.pointer ?? ffi.nullptr, - realm?.ref.pointer ?? ffi.nullptr, - authenticationMethod?.ref.pointer ?? ffi.nullptr); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithProxyHost:port:type:realm:authenticationMethod: - NSURLProtectionSpace initWithProxyHost_port_type_realm_authenticationMethod_( - objc.NSString host, - int port, - objc.NSString? type, - objc.NSString? realm, - objc.NSString? authenticationMethod) { - final _ret = _objc_msgSend_sfgdlr( - this.ref.retainAndReturnPointer(), - _sel_initWithProxyHost_port_type_realm_authenticationMethod_, - host.ref.pointer, - port, - type?.ref.pointer ?? ffi.nullptr, - realm?.ref.pointer ?? ffi.nullptr, - authenticationMethod?.ref.pointer ?? ffi.nullptr); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// realm - objc.NSString? get realm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_realm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// receivesCredentialSecurely - bool get receivesCredentialSecurely { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_receivesCredentialSecurely); - } - - /// isProxy - bool get isProxy { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isProxy); - } - - /// host - objc.NSString get host { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_host); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// port - int get port { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_port); - } - - /// proxyType - objc.NSString? get proxyType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_proxyType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// protocol - objc.NSString? get protocol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_protocol); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// authenticationMethod - objc.NSString get authenticationMethod { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_authenticationMethod); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// distinguishedNames - objc.NSArray? get distinguishedNames { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_distinguishedNames); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// serverTrust - ffi.Pointer<__SecTrust> get serverTrust { - return _objc_msgSend_uv0l05(this.ref.pointer, _sel_serverTrust); - } - - /// init - NSURLProtectionSpace init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLProtectionSpace new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtectionSpace, _sel_new); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLProtectionSpace allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLProtectionSpace, _sel_allocWithZone_, zone); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLProtectionSpace alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtectionSpace, _sel_alloc); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLProtectionSpace, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLProtectionSpace, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLProtectionSpace, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLProtectionSpace, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLProtectionSpace, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLProtectionSpace, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLProtectionSpace, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtectionSpace, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtectionSpace, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLProtectionSpace self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLProtectionSpace retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLProtectionSpace autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSURLProtectionSpace, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLProtectionSpace? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _class_NSURLCredentialStorage = - objc.getClass("NSURLCredentialStorage"); -late final _sel_sharedCredentialStorage = - objc.registerName("sharedCredentialStorage"); -late final _sel_credentialsForProtectionSpace_ = - objc.registerName("credentialsForProtectionSpace:"); -late final _sel_allCredentials = objc.registerName("allCredentials"); -late final _sel_setCredential_forProtectionSpace_ = - objc.registerName("setCredential:forProtectionSpace:"); -late final _sel_removeCredential_forProtectionSpace_ = - objc.registerName("removeCredential:forProtectionSpace:"); -late final _sel_removeCredential_forProtectionSpace_options_ = - objc.registerName("removeCredential:forProtectionSpace:options:"); -late final _sel_defaultCredentialForProtectionSpace_ = - objc.registerName("defaultCredentialForProtectionSpace:"); -late final _sel_setDefaultCredential_forProtectionSpace_ = - objc.registerName("setDefaultCredential:forProtectionSpace:"); -void _ObjCBlock_ffiVoid_NSDictionary_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDictionary_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDictionary_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSDictionary { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSDictionary_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSDictionary?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSDictionary?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSDictionary_CallExtension - on objc.ObjCBlock { - void call(objc.NSDictionary? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getCredentialsForProtectionSpace_task_completionHandler_ = objc - .registerName("getCredentialsForProtectionSpace:task:completionHandler:"); -late final _sel_setCredential_forProtectionSpace_task_ = - objc.registerName("setCredential:forProtectionSpace:task:"); -late final _sel_removeCredential_forProtectionSpace_options_task_ = - objc.registerName("removeCredential:forProtectionSpace:options:task:"); -final _objc_msgSend_19b8ge5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_NSURLCredential_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSURLCredential_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLCredential_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLCredential_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSURLCredential_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLCredential_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLCredential_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURLCredential_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURLCredential_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURLCredential { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSURLCredential_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSURLCredential?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLCredential_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSURLCredential.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSURLCredential?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLCredential_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSURLCredential.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURLCredential_CallExtension - on objc.ObjCBlock { - void call(NSURLCredential? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getDefaultCredentialForProtectionSpace_task_completionHandler_ = - objc.registerName( - "getDefaultCredentialForProtectionSpace:task:completionHandler:"); -late final _sel_setDefaultCredential_forProtectionSpace_task_ = - objc.registerName("setDefaultCredential:forProtectionSpace:task:"); - -/// NSURLCredentialStorage -class NSURLCredentialStorage extends objc.NSObject { - NSURLCredentialStorage._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLCredentialStorage] that points to the same underlying object as [other]. - NSURLCredentialStorage.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLCredentialStorage] that wraps the given raw object pointer. - NSURLCredentialStorage.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLCredentialStorage]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCredentialStorage); - } - - /// sharedCredentialStorage - static NSURLCredentialStorage getSharedCredentialStorage() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredentialStorage, _sel_sharedCredentialStorage); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// credentialsForProtectionSpace: - objc.NSDictionary? credentialsForProtectionSpace_( - NSURLProtectionSpace space) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_credentialsForProtectionSpace_, space.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// allCredentials - objc.NSDictionary get allCredentials { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allCredentials); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setCredential:forProtectionSpace: - void setCredential_forProtectionSpace_( - NSURLCredential credential, NSURLProtectionSpace space) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_setCredential_forProtectionSpace_, - credential.ref.pointer, - space.ref.pointer); - } - - /// removeCredential:forProtectionSpace: - void removeCredential_forProtectionSpace_( - NSURLCredential credential, NSURLProtectionSpace space) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_removeCredential_forProtectionSpace_, - credential.ref.pointer, - space.ref.pointer); - } - - /// removeCredential:forProtectionSpace:options: - void removeCredential_forProtectionSpace_options_(NSURLCredential credential, - NSURLProtectionSpace space, objc.NSDictionary? options) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_removeCredential_forProtectionSpace_options_, - credential.ref.pointer, - space.ref.pointer, - options?.ref.pointer ?? ffi.nullptr); - } - - /// defaultCredentialForProtectionSpace: - NSURLCredential? defaultCredentialForProtectionSpace_( - NSURLProtectionSpace space) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_defaultCredentialForProtectionSpace_, space.ref.pointer); - return _ret.address == 0 - ? null - : NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// setDefaultCredential:forProtectionSpace: - void setDefaultCredential_forProtectionSpace_( - NSURLCredential credential, NSURLProtectionSpace space) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_setDefaultCredential_forProtectionSpace_, - credential.ref.pointer, - space.ref.pointer); - } - - /// getCredentialsForProtectionSpace:task:completionHandler: - void getCredentialsForProtectionSpace_task_completionHandler_( - NSURLProtectionSpace protectionSpace, - NSURLSessionTask task, - objc.ObjCBlock completionHandler) { - _objc_msgSend_10t0qpd( - this.ref.pointer, - _sel_getCredentialsForProtectionSpace_task_completionHandler_, - protectionSpace.ref.pointer, - task.ref.pointer, - completionHandler.ref.pointer); - } - - /// setCredential:forProtectionSpace:task: - void setCredential_forProtectionSpace_task_(NSURLCredential credential, - NSURLProtectionSpace protectionSpace, NSURLSessionTask task) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_setCredential_forProtectionSpace_task_, - credential.ref.pointer, - protectionSpace.ref.pointer, - task.ref.pointer); - } - - /// removeCredential:forProtectionSpace:options:task: - void removeCredential_forProtectionSpace_options_task_( - NSURLCredential credential, - NSURLProtectionSpace protectionSpace, - objc.NSDictionary? options, - NSURLSessionTask task) { - _objc_msgSend_19b8ge5( - this.ref.pointer, - _sel_removeCredential_forProtectionSpace_options_task_, - credential.ref.pointer, - protectionSpace.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - task.ref.pointer); - } - - /// getDefaultCredentialForProtectionSpace:task:completionHandler: - void getDefaultCredentialForProtectionSpace_task_completionHandler_( - NSURLProtectionSpace space, - NSURLSessionTask task, - objc.ObjCBlock completionHandler) { - _objc_msgSend_10t0qpd( - this.ref.pointer, - _sel_getDefaultCredentialForProtectionSpace_task_completionHandler_, - space.ref.pointer, - task.ref.pointer, - completionHandler.ref.pointer); - } - - /// setDefaultCredential:forProtectionSpace:task: - void setDefaultCredential_forProtectionSpace_task_(NSURLCredential credential, - NSURLProtectionSpace protectionSpace, NSURLSessionTask task) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_setDefaultCredential_forProtectionSpace_task_, - credential.ref.pointer, - protectionSpace.ref.pointer, - task.ref.pointer); - } - - /// init - NSURLCredentialStorage init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLCredentialStorage new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCredentialStorage, _sel_new); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLCredentialStorage allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLCredentialStorage, _sel_allocWithZone_, zone); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLCredentialStorage alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLCredentialStorage, _sel_alloc); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLCredentialStorage, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLCredentialStorage, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLCredentialStorage, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLCredentialStorage, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLCredentialStorage, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLCredentialStorage, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLCredentialStorage, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredentialStorage, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredentialStorage, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLCredentialStorage self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLCredentialStorage retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLCredentialStorage autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _class_NSURLProtocol = objc.getClass("NSURLProtocol"); -late final _sel_initWithRequest_cachedResponse_client_ = - objc.registerName("initWithRequest:cachedResponse:client:"); -late final _sel_client = objc.registerName("client"); -late final _sel_request = objc.registerName("request"); -late final _sel_cachedResponse = objc.registerName("cachedResponse"); -late final _sel_canInitWithRequest_ = objc.registerName("canInitWithRequest:"); -late final _sel_canonicalRequestForRequest_ = - objc.registerName("canonicalRequestForRequest:"); -late final _sel_requestIsCacheEquivalent_toRequest_ = - objc.registerName("requestIsCacheEquivalent:toRequest:"); -late final _sel_startLoading = objc.registerName("startLoading"); -late final _sel_stopLoading = objc.registerName("stopLoading"); -late final _sel_propertyForKey_inRequest_ = - objc.registerName("propertyForKey:inRequest:"); -late final _class_NSMutableURLRequest = objc.getClass("NSMutableURLRequest"); -late final _sel_setURL_ = objc.registerName("setURL:"); -late final _sel_setCachePolicy_ = objc.registerName("setCachePolicy:"); -final _objc_msgSend_12vaadl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setTimeoutInterval_ = objc.registerName("setTimeoutInterval:"); -late final _sel_setMainDocumentURL_ = objc.registerName("setMainDocumentURL:"); -late final _sel_setNetworkServiceType_ = - objc.registerName("setNetworkServiceType:"); -final _objc_msgSend_br89tg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setAllowsCellularAccess_ = - objc.registerName("setAllowsCellularAccess:"); -late final _sel_setAllowsExpensiveNetworkAccess_ = - objc.registerName("setAllowsExpensiveNetworkAccess:"); -late final _sel_setAllowsConstrainedNetworkAccess_ = - objc.registerName("setAllowsConstrainedNetworkAccess:"); -late final _sel_setAssumesHTTP3Capable_ = - objc.registerName("setAssumesHTTP3Capable:"); -late final _sel_setAttribution_ = objc.registerName("setAttribution:"); -final _objc_msgSend_1w8eyjo = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setRequiresDNSSECValidation_ = - objc.registerName("setRequiresDNSSECValidation:"); -late final _sel_setHTTPMethod_ = objc.registerName("setHTTPMethod:"); -late final _sel_setAllHTTPHeaderFields_ = - objc.registerName("setAllHTTPHeaderFields:"); -late final _sel_setValue_forHTTPHeaderField_ = - objc.registerName("setValue:forHTTPHeaderField:"); -late final _sel_addValue_forHTTPHeaderField_ = - objc.registerName("addValue:forHTTPHeaderField:"); -late final _sel_setHTTPBody_ = objc.registerName("setHTTPBody:"); -late final _sel_setHTTPBodyStream_ = objc.registerName("setHTTPBodyStream:"); -late final _sel_setHTTPShouldHandleCookies_ = - objc.registerName("setHTTPShouldHandleCookies:"); -late final _sel_setHTTPShouldUsePipelining_ = - objc.registerName("setHTTPShouldUsePipelining:"); - -/// NSMutableURLRequest -class NSMutableURLRequest extends NSURLRequest { - NSMutableURLRequest._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMutableURLRequest] that points to the same underlying object as [other]. - NSMutableURLRequest.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMutableURLRequest] that wraps the given raw object pointer. - NSMutableURLRequest.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMutableURLRequest]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableURLRequest); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setURL: - set URL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setURL_, value?.ref.pointer ?? ffi.nullptr); - } - - /// cachePolicy - NSURLRequestCachePolicy get cachePolicy { - final _ret = _objc_msgSend_2xak1q(this.ref.pointer, _sel_cachePolicy); - return NSURLRequestCachePolicy.fromValue(_ret); - } - - /// setCachePolicy: - set cachePolicy(NSURLRequestCachePolicy value) { - return _objc_msgSend_12vaadl( - this.ref.pointer, _sel_setCachePolicy_, value.value); - } - - /// timeoutInterval - double get timeoutInterval { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_timeoutInterval) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeoutInterval); - } - - /// setTimeoutInterval: - set timeoutInterval(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setTimeoutInterval_, value); - } - - /// mainDocumentURL - objc.NSURL? get mainDocumentURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mainDocumentURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setMainDocumentURL: - set mainDocumentURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setMainDocumentURL_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// networkServiceType - NSURLRequestNetworkServiceType get networkServiceType { - final _ret = - _objc_msgSend_ttt73t(this.ref.pointer, _sel_networkServiceType); - return NSURLRequestNetworkServiceType.fromValue(_ret); - } - - /// setNetworkServiceType: - set networkServiceType(NSURLRequestNetworkServiceType value) { - return _objc_msgSend_br89tg( - this.ref.pointer, _sel_setNetworkServiceType_, value.value); - } - - /// allowsCellularAccess - bool get allowsCellularAccess { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsCellularAccess); - } - - /// setAllowsCellularAccess: - set allowsCellularAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsCellularAccess_, value); - } - - /// allowsExpensiveNetworkAccess - bool get allowsExpensiveNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExpensiveNetworkAccess); - } - - /// setAllowsExpensiveNetworkAccess: - set allowsExpensiveNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsExpensiveNetworkAccess_, value); - } - - /// allowsConstrainedNetworkAccess - bool get allowsConstrainedNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsConstrainedNetworkAccess); - } - - /// setAllowsConstrainedNetworkAccess: - set allowsConstrainedNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsConstrainedNetworkAccess_, value); - } - - /// assumesHTTP3Capable - bool get assumesHTTP3Capable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_assumesHTTP3Capable); - } - - /// setAssumesHTTP3Capable: - set assumesHTTP3Capable(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAssumesHTTP3Capable_, value); - } - - /// attribution - NSURLRequestAttribution get attribution { - final _ret = _objc_msgSend_t5yka9(this.ref.pointer, _sel_attribution); - return NSURLRequestAttribution.fromValue(_ret); - } - - /// setAttribution: - set attribution(NSURLRequestAttribution value) { - return _objc_msgSend_1w8eyjo( - this.ref.pointer, _sel_setAttribution_, value.value); - } - - /// requiresDNSSECValidation - bool get requiresDNSSECValidation { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_requiresDNSSECValidation); - } - - /// setRequiresDNSSECValidation: - set requiresDNSSECValidation(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setRequiresDNSSECValidation_, value); - } - - /// HTTPMethod - objc.NSString get HTTPMethod { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPMethod); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPMethod: - set HTTPMethod(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setHTTPMethod_, value.ref.pointer); - } - - /// allHTTPHeaderFields - objc.NSDictionary? get allHTTPHeaderFields { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allHTTPHeaderFields); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setAllHTTPHeaderFields: - set allHTTPHeaderFields(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAllHTTPHeaderFields_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setValue:forHTTPHeaderField: - void setValue_forHTTPHeaderField_(objc.NSString? value, objc.NSString field) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_setValue_forHTTPHeaderField_, - value?.ref.pointer ?? ffi.nullptr, field.ref.pointer); - } - - /// addValue:forHTTPHeaderField: - void addValue_forHTTPHeaderField_(objc.NSString value, objc.NSString field) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_addValue_forHTTPHeaderField_, - value.ref.pointer, field.ref.pointer); - } - - /// HTTPBody - objc.NSData? get HTTPBody { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBody); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPBody: - set HTTPBody(objc.NSData? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setHTTPBody_, value?.ref.pointer ?? ffi.nullptr); - } - - /// HTTPBodyStream - objc.NSInputStream? get HTTPBodyStream { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBodyStream); - return _ret.address == 0 - ? null - : objc.NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPBodyStream: - set HTTPBodyStream(objc.NSInputStream? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setHTTPBodyStream_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// HTTPShouldHandleCookies - bool get HTTPShouldHandleCookies { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldHandleCookies); - } - - /// setHTTPShouldHandleCookies: - set HTTPShouldHandleCookies(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldHandleCookies_, value); - } - - /// HTTPShouldUsePipelining - bool get HTTPShouldUsePipelining { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldUsePipelining); - } - - /// setHTTPShouldUsePipelining: - set HTTPShouldUsePipelining(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldUsePipelining_, value); - } - - /// requestWithURL: - static NSMutableURLRequest requestWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableURLRequest, _sel_requestWithURL_, URL.ref.pointer); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool getSupportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableURLRequest, _sel_supportsSecureCoding); - } - - /// requestWithURL:cachePolicy:timeoutInterval: - static NSMutableURLRequest requestWithURL_cachePolicy_timeoutInterval_( - objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, - double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - _class_NSMutableURLRequest, - _sel_requestWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithURL: - NSMutableURLRequest initWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, URL.ref.pointer); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithURL:cachePolicy:timeoutInterval: - NSMutableURLRequest initWithURL_cachePolicy_timeoutInterval_(objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// init - NSMutableURLRequest init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSMutableURLRequest new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableURLRequest, _sel_new); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSMutableURLRequest allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMutableURLRequest, _sel_allocWithZone_, zone); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSMutableURLRequest alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableURLRequest, _sel_alloc); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMutableURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMutableURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMutableURLRequest, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSMutableURLRequest, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableURLRequest, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableURLRequest, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMutableURLRequest, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableURLRequest, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableURLRequest, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMutableURLRequest self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSMutableURLRequest retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSMutableURLRequest autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithCoder: - NSMutableURLRequest? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_setProperty_forKey_inRequest_ = - objc.registerName("setProperty:forKey:inRequest:"); -late final _sel_removePropertyForKey_inRequest_ = - objc.registerName("removePropertyForKey:inRequest:"); -late final _sel_registerClass_ = objc.registerName("registerClass:"); -late final _sel_unregisterClass_ = objc.registerName("unregisterClass:"); -late final _sel_canInitWithTask_ = objc.registerName("canInitWithTask:"); -late final _sel_initWithTask_cachedResponse_client_ = - objc.registerName("initWithTask:cachedResponse:client:"); -late final _sel_task = objc.registerName("task"); - -/// NSURLProtocol -class NSURLProtocol extends objc.NSObject { - NSURLProtocol._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLProtocol] that points to the same underlying object as [other]. - NSURLProtocol.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLProtocol] that wraps the given raw object pointer. - NSURLProtocol.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLProtocol]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLProtocol); - } - - /// initWithRequest:cachedResponse:client: - NSURLProtocol initWithRequest_cachedResponse_client_(NSURLRequest request, - NSCachedURLResponse? cachedResponse, objc.ObjCObjectBase? client) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithRequest_cachedResponse_client_, - request.ref.pointer, - cachedResponse?.ref.pointer ?? ffi.nullptr, - client?.ref.pointer ?? ffi.nullptr); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// client - objc.ObjCObjectBase? get client { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_client); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// request - NSURLRequest get request { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_request); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// cachedResponse - NSCachedURLResponse? get cachedResponse { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_cachedResponse); - return _ret.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// canInitWithRequest: - static bool canInitWithRequest_(NSURLRequest request) { - return _objc_msgSend_l8lotg( - _class_NSURLProtocol, _sel_canInitWithRequest_, request.ref.pointer); - } - - /// canonicalRequestForRequest: - static NSURLRequest canonicalRequestForRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7(_class_NSURLProtocol, - _sel_canonicalRequestForRequest_, request.ref.pointer); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// requestIsCacheEquivalent:toRequest: - static bool requestIsCacheEquivalent_toRequest_( - NSURLRequest a, NSURLRequest b) { - return _objc_msgSend_1ywe6ev(_class_NSURLProtocol, - _sel_requestIsCacheEquivalent_toRequest_, a.ref.pointer, b.ref.pointer); - } - - /// startLoading - void startLoading() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_startLoading); - } - - /// stopLoading - void stopLoading() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stopLoading); - } - - /// propertyForKey:inRequest: - static objc.ObjCObjectBase? propertyForKey_inRequest_( - objc.NSString key, NSURLRequest request) { - final _ret = _objc_msgSend_iq11qg(_class_NSURLProtocol, - _sel_propertyForKey_inRequest_, key.ref.pointer, request.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setProperty:forKey:inRequest: - static void setProperty_forKey_inRequest_(objc.ObjCObjectBase value, - objc.NSString key, NSMutableURLRequest request) { - _objc_msgSend_tenbla( - _class_NSURLProtocol, - _sel_setProperty_forKey_inRequest_, - value.ref.pointer, - key.ref.pointer, - request.ref.pointer); - } - - /// removePropertyForKey:inRequest: - static void removePropertyForKey_inRequest_( - objc.NSString key, NSMutableURLRequest request) { - _objc_msgSend_1tjlcwl( - _class_NSURLProtocol, - _sel_removePropertyForKey_inRequest_, - key.ref.pointer, - request.ref.pointer); - } - - /// registerClass: - static bool registerClass_(objc.ObjCObjectBase protocolClass) { - return _objc_msgSend_l8lotg( - _class_NSURLProtocol, _sel_registerClass_, protocolClass.ref.pointer); - } - - /// unregisterClass: - static void unregisterClass_(objc.ObjCObjectBase protocolClass) { - _objc_msgSend_ukcdfq( - _class_NSURLProtocol, _sel_unregisterClass_, protocolClass.ref.pointer); - } - - /// canInitWithTask: - static bool canInitWithTask_(NSURLSessionTask task) { - return _objc_msgSend_l8lotg( - _class_NSURLProtocol, _sel_canInitWithTask_, task.ref.pointer); - } - - /// initWithTask:cachedResponse:client: - NSURLProtocol initWithTask_cachedResponse_client_(NSURLSessionTask task, - NSCachedURLResponse? cachedResponse, objc.ObjCObjectBase? client) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithTask_cachedResponse_client_, - task.ref.pointer, - cachedResponse?.ref.pointer ?? ffi.nullptr, - client?.ref.pointer ?? ffi.nullptr); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// task - NSURLSessionTask? get task { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_task); - return _ret.address == 0 - ? null - : NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLProtocol init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLProtocol new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtocol, _sel_new); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLProtocol allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLProtocol, _sel_allocWithZone_, zone); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLProtocol alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtocol, _sel_alloc); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLProtocol, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLProtocol, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLProtocol, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLProtocol, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLProtocol, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLProtocol, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLProtocol, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtocol, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtocol, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLProtocol self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLProtocol.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLProtocol retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLProtocol.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLProtocol autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLProtocol.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSXMLParser = objc.getClass("NSXMLParser"); -late final _sel_initWithContentsOfURL_ = - objc.registerName("initWithContentsOfURL:"); -late final _sel_initWithData_ = objc.registerName("initWithData:"); -late final _sel_initWithStream_ = objc.registerName("initWithStream:"); -late final _sel_shouldProcessNamespaces = - objc.registerName("shouldProcessNamespaces"); -late final _sel_setShouldProcessNamespaces_ = - objc.registerName("setShouldProcessNamespaces:"); -late final _sel_shouldReportNamespacePrefixes = - objc.registerName("shouldReportNamespacePrefixes"); -late final _sel_setShouldReportNamespacePrefixes_ = - objc.registerName("setShouldReportNamespacePrefixes:"); - -enum NSXMLParserExternalEntityResolvingPolicy { - NSXMLParserResolveExternalEntitiesNever(0), - NSXMLParserResolveExternalEntitiesNoNetwork(1), - NSXMLParserResolveExternalEntitiesSameOriginOnly(2), - NSXMLParserResolveExternalEntitiesAlways(3); - - final int value; - const NSXMLParserExternalEntityResolvingPolicy(this.value); - - static NSXMLParserExternalEntityResolvingPolicy fromValue(int value) => - switch (value) { - 0 => NSXMLParserResolveExternalEntitiesNever, - 1 => NSXMLParserResolveExternalEntitiesNoNetwork, - 2 => NSXMLParserResolveExternalEntitiesSameOriginOnly, - 3 => NSXMLParserResolveExternalEntitiesAlways, - _ => throw ArgumentError( - "Unknown value for NSXMLParserExternalEntityResolvingPolicy: $value"), - }; -} - -late final _sel_externalEntityResolvingPolicy = - objc.registerName("externalEntityResolvingPolicy"); -final _objc_msgSend_6drw9t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setExternalEntityResolvingPolicy_ = - objc.registerName("setExternalEntityResolvingPolicy:"); -final _objc_msgSend_1277g64 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_allowedExternalEntityURLs = - objc.registerName("allowedExternalEntityURLs"); -late final _sel_setAllowedExternalEntityURLs_ = - objc.registerName("setAllowedExternalEntityURLs:"); -late final _sel_parse = objc.registerName("parse"); -late final _sel_abortParsing = objc.registerName("abortParsing"); -late final _sel_parserError = objc.registerName("parserError"); -late final _sel_shouldResolveExternalEntities = - objc.registerName("shouldResolveExternalEntities"); -late final _sel_setShouldResolveExternalEntities_ = - objc.registerName("setShouldResolveExternalEntities:"); -late final _sel_publicID = objc.registerName("publicID"); -late final _sel_systemID = objc.registerName("systemID"); -late final _sel_lineNumber = objc.registerName("lineNumber"); -late final _sel_columnNumber = objc.registerName("columnNumber"); - -/// NSXMLParser -class NSXMLParser extends objc.NSObject { - NSXMLParser._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLParser] that points to the same underlying object as [other]. - NSXMLParser.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLParser] that wraps the given raw object pointer. - NSXMLParser.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLParser]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLParser); - } - - /// initWithContentsOfURL: - NSXMLParser? initWithContentsOfURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithData: - NSXMLParser initWithData_(objc.NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithData_, data.ref.pointer); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithStream: - NSXMLParser initWithStream_(objc.NSInputStream stream) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithStream_, stream.ref.pointer); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// shouldProcessNamespaces - bool get shouldProcessNamespaces { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_shouldProcessNamespaces); - } - - /// setShouldProcessNamespaces: - set shouldProcessNamespaces(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldProcessNamespaces_, value); - } - - /// shouldReportNamespacePrefixes - bool get shouldReportNamespacePrefixes { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_shouldReportNamespacePrefixes); - } - - /// setShouldReportNamespacePrefixes: - set shouldReportNamespacePrefixes(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldReportNamespacePrefixes_, value); - } - - /// externalEntityResolvingPolicy - NSXMLParserExternalEntityResolvingPolicy get externalEntityResolvingPolicy { - final _ret = _objc_msgSend_6drw9t( - this.ref.pointer, _sel_externalEntityResolvingPolicy); - return NSXMLParserExternalEntityResolvingPolicy.fromValue(_ret); - } - - /// setExternalEntityResolvingPolicy: - set externalEntityResolvingPolicy( - NSXMLParserExternalEntityResolvingPolicy value) { - return _objc_msgSend_1277g64( - this.ref.pointer, _sel_setExternalEntityResolvingPolicy_, value.value); - } - - /// allowedExternalEntityURLs - objc.NSSet? get allowedExternalEntityURLs { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allowedExternalEntityURLs); - return _ret.address == 0 - ? null - : objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setAllowedExternalEntityURLs: - set allowedExternalEntityURLs(objc.NSSet? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setAllowedExternalEntityURLs_, value?.ref.pointer ?? ffi.nullptr); - } - - /// parse - bool parse() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_parse); - } - - /// abortParsing - void abortParsing() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_abortParsing); - } - - /// parserError - objc.NSError? get parserError { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_parserError); - return _ret.address == 0 - ? null - : objc.NSError.castFromPointer(_ret, retain: true, release: true); - } - - /// shouldResolveExternalEntities - bool get shouldResolveExternalEntities { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_shouldResolveExternalEntities); - } - - /// setShouldResolveExternalEntities: - set shouldResolveExternalEntities(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldResolveExternalEntities_, value); - } - - /// publicID - objc.NSString? get publicID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_publicID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// systemID - objc.NSString? get systemID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_systemID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// lineNumber - int get lineNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_lineNumber); - } - - /// columnNumber - int get columnNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_columnNumber); - } - - /// init - NSXMLParser init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSXMLParser new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLParser, _sel_new); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSXMLParser allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSXMLParser, _sel_allocWithZone_, zone); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSXMLParser alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLParser, _sel_alloc); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSXMLParser, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSXMLParser, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSXMLParser, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSXMLParser, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLParser, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSXMLParser, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSXMLParser, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLParser, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSXMLParser, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSXMLParser self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSXMLParser.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSXMLParser retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSXMLParser.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSXMLParser autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSXMLParser.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSFileWrapper = objc.getClass("NSFileWrapper"); - -enum NSFileWrapperReadingOptions { - NSFileWrapperReadingImmediate(1), - NSFileWrapperReadingWithoutMapping(2); - - final int value; - const NSFileWrapperReadingOptions(this.value); - - static NSFileWrapperReadingOptions fromValue(int value) => switch (value) { - 1 => NSFileWrapperReadingImmediate, - 2 => NSFileWrapperReadingWithoutMapping, - _ => throw ArgumentError( - "Unknown value for NSFileWrapperReadingOptions: $value"), - }; -} - -late final _sel_initWithURL_options_error_ = - objc.registerName("initWithURL:options:error:"); -final _objc_msgSend_g0dcla = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_initDirectoryWithFileWrappers_ = - objc.registerName("initDirectoryWithFileWrappers:"); -late final _sel_initRegularFileWithContents_ = - objc.registerName("initRegularFileWithContents:"); -late final _sel_initSymbolicLinkWithDestinationURL_ = - objc.registerName("initSymbolicLinkWithDestinationURL:"); -late final _sel_initWithSerializedRepresentation_ = - objc.registerName("initWithSerializedRepresentation:"); -late final _sel_isDirectory = objc.registerName("isDirectory"); -late final _sel_isRegularFile = objc.registerName("isRegularFile"); -late final _sel_isSymbolicLink = objc.registerName("isSymbolicLink"); -late final _sel_preferredFilename = objc.registerName("preferredFilename"); -late final _sel_setPreferredFilename_ = - objc.registerName("setPreferredFilename:"); -late final _sel_filename = objc.registerName("filename"); -late final _sel_setFilename_ = objc.registerName("setFilename:"); -late final _sel_fileAttributes = objc.registerName("fileAttributes"); -late final _sel_setFileAttributes_ = objc.registerName("setFileAttributes:"); -late final _sel_matchesContentsOfURL_ = - objc.registerName("matchesContentsOfURL:"); -late final _sel_readFromURL_options_error_ = - objc.registerName("readFromURL:options:error:"); -final _objc_msgSend_138eppz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); - -enum NSFileWrapperWritingOptions { - NSFileWrapperWritingAtomic(1), - NSFileWrapperWritingWithNameUpdating(2); - - final int value; - const NSFileWrapperWritingOptions(this.value); - - static NSFileWrapperWritingOptions fromValue(int value) => switch (value) { - 1 => NSFileWrapperWritingAtomic, - 2 => NSFileWrapperWritingWithNameUpdating, - _ => throw ArgumentError( - "Unknown value for NSFileWrapperWritingOptions: $value"), - }; -} - -late final _sel_writeToURL_options_originalContentsURL_error_ = - objc.registerName("writeToURL:options:originalContentsURL:error:"); -final _objc_msgSend_nrvb12 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_serializedRepresentation = - objc.registerName("serializedRepresentation"); -late final _sel_addFileWrapper_ = objc.registerName("addFileWrapper:"); -late final _sel_addRegularFileWithContents_preferredFilename_ = - objc.registerName("addRegularFileWithContents:preferredFilename:"); -late final _sel_removeFileWrapper_ = objc.registerName("removeFileWrapper:"); -late final _sel_fileWrappers = objc.registerName("fileWrappers"); -late final _sel_keyForFileWrapper_ = objc.registerName("keyForFileWrapper:"); -late final _sel_regularFileContents = objc.registerName("regularFileContents"); -late final _sel_symbolicLinkDestinationURL = - objc.registerName("symbolicLinkDestinationURL"); -late final _sel_initSymbolicLinkWithDestination_ = - objc.registerName("initSymbolicLinkWithDestination:"); -late final _sel_needsToBeUpdatedFromPath_ = - objc.registerName("needsToBeUpdatedFromPath:"); -late final _sel_updateFromPath_ = objc.registerName("updateFromPath:"); -late final _sel_writeToFile_atomically_updateFilenames_ = - objc.registerName("writeToFile:atomically:updateFilenames:"); -final _objc_msgSend_1vcrzki = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Bool)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool, - bool)>(); -late final _sel_addFileWithPath_ = objc.registerName("addFileWithPath:"); -late final _sel_addSymbolicLinkWithDestination_preferredFilename_ = - objc.registerName("addSymbolicLinkWithDestination:preferredFilename:"); -late final _sel_symbolicLinkDestination = - objc.registerName("symbolicLinkDestination"); - -/// NSFileWrapper -class NSFileWrapper extends objc.NSObject { - NSFileWrapper._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFileWrapper] that points to the same underlying object as [other]. - NSFileWrapper.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFileWrapper] that wraps the given raw object pointer. - NSFileWrapper.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFileWrapper]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFileWrapper); - } - - /// initWithURL:options:error: - NSFileWrapper? initWithURL_options_error_( - objc.NSURL url, - NSFileWrapperReadingOptions options, - ffi.Pointer> outError) { - final _ret = _objc_msgSend_g0dcla( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_options_error_, - url.ref.pointer, - options.value, - outError); - return _ret.address == 0 - ? null - : NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initDirectoryWithFileWrappers: - NSFileWrapper initDirectoryWithFileWrappers_( - objc.NSDictionary childrenByPreferredName) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), - _sel_initDirectoryWithFileWrappers_, - childrenByPreferredName.ref.pointer); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initRegularFileWithContents: - NSFileWrapper initRegularFileWithContents_(objc.NSData contents) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initRegularFileWithContents_, contents.ref.pointer); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initSymbolicLinkWithDestinationURL: - NSFileWrapper initSymbolicLinkWithDestinationURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initSymbolicLinkWithDestinationURL_, url.ref.pointer); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithSerializedRepresentation: - NSFileWrapper? initWithSerializedRepresentation_( - objc.NSData serializeRepresentation) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), - _sel_initWithSerializedRepresentation_, - serializeRepresentation.ref.pointer); - return _ret.address == 0 - ? null - : NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSFileWrapper? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// isDirectory - bool get directory { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isDirectory); - } - - /// isRegularFile - bool get regularFile { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isRegularFile); - } - - /// isSymbolicLink - bool get symbolicLink { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSymbolicLink); - } - - /// preferredFilename - objc.NSString? get preferredFilename { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredFilename); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPreferredFilename: - set preferredFilename(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setPreferredFilename_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// filename - objc.NSString? get filename { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_filename); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setFilename: - set filename(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFilename_, value?.ref.pointer ?? ffi.nullptr); - } - - /// fileAttributes - objc.NSDictionary get fileAttributes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileAttributes); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileAttributes: - set fileAttributes(objc.NSDictionary value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFileAttributes_, value.ref.pointer); - } - - /// matchesContentsOfURL: - bool matchesContentsOfURL_(objc.NSURL url) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_matchesContentsOfURL_, url.ref.pointer); - } - - /// readFromURL:options:error: - bool readFromURL_options_error_( - objc.NSURL url, - NSFileWrapperReadingOptions options, - ffi.Pointer> outError) { - return _objc_msgSend_138eppz( - this.ref.pointer, - _sel_readFromURL_options_error_, - url.ref.pointer, - options.value, - outError); - } - - /// writeToURL:options:originalContentsURL:error: - bool writeToURL_options_originalContentsURL_error_( - objc.NSURL url, - NSFileWrapperWritingOptions options, - objc.NSURL? originalContentsURL, - ffi.Pointer> outError) { - return _objc_msgSend_nrvb12( - this.ref.pointer, - _sel_writeToURL_options_originalContentsURL_error_, - url.ref.pointer, - options.value, - originalContentsURL?.ref.pointer ?? ffi.nullptr, - outError); - } - - /// serializedRepresentation - objc.NSData? get serializedRepresentation { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_serializedRepresentation); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// addFileWrapper: - objc.NSString addFileWrapper_(NSFileWrapper child) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_addFileWrapper_, child.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addRegularFileWithContents:preferredFilename: - objc.NSString addRegularFileWithContents_preferredFilename_( - objc.NSData data, objc.NSString fileName) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_addRegularFileWithContents_preferredFilename_, - data.ref.pointer, - fileName.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// removeFileWrapper: - void removeFileWrapper_(NSFileWrapper child) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeFileWrapper_, child.ref.pointer); - } - - /// fileWrappers - objc.NSDictionary? get fileWrappers { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileWrappers); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// keyForFileWrapper: - objc.NSString? keyForFileWrapper_(NSFileWrapper child) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_keyForFileWrapper_, child.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// regularFileContents - objc.NSData? get regularFileContents { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_regularFileContents); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// symbolicLinkDestinationURL - objc.NSURL? get symbolicLinkDestinationURL { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_symbolicLinkDestinationURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithPath: - objc.ObjCObjectBase? initWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// initSymbolicLinkWithDestination: - objc.ObjCObjectBase initSymbolicLinkWithDestination_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initSymbolicLinkWithDestination_, path.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// needsToBeUpdatedFromPath: - bool needsToBeUpdatedFromPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_needsToBeUpdatedFromPath_, path.ref.pointer); - } - - /// updateFromPath: - bool updateFromPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_updateFromPath_, path.ref.pointer); - } - - /// writeToFile:atomically:updateFilenames: - bool writeToFile_atomically_updateFilenames_( - objc.NSString path, bool atomicFlag, bool updateFilenamesFlag) { - return _objc_msgSend_1vcrzki( - this.ref.pointer, - _sel_writeToFile_atomically_updateFilenames_, - path.ref.pointer, - atomicFlag, - updateFilenamesFlag); - } - - /// addFileWithPath: - objc.NSString addFileWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_addFileWithPath_, path.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addSymbolicLinkWithDestination:preferredFilename: - objc.NSString addSymbolicLinkWithDestination_preferredFilename_( - objc.NSString path, objc.NSString filename) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_addSymbolicLinkWithDestination_preferredFilename_, - path.ref.pointer, - filename.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// symbolicLinkDestination - objc.NSString symbolicLinkDestination() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_symbolicLinkDestination); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSFileWrapper init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFileWrapper new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileWrapper, _sel_new); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFileWrapper allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFileWrapper, _sel_allocWithZone_, zone); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFileWrapper alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileWrapper, _sel_alloc); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFileWrapper, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFileWrapper, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFileWrapper, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFileWrapper, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFileWrapper, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFileWrapper, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFileWrapper, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileWrapper, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileWrapper, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSFileWrapper self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSFileWrapper.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSFileWrapper retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSFileWrapper.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSFileWrapper autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSFileWrapper.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSFileWrapper, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _class_NSURLSession = objc.getClass("NSURLSession"); -late final _sel_sharedSession = objc.registerName("sharedSession"); -late final _class_NSURLSessionConfiguration = - objc.getClass("NSURLSessionConfiguration"); -late final _sel_defaultSessionConfiguration = - objc.registerName("defaultSessionConfiguration"); -late final _sel_ephemeralSessionConfiguration = - objc.registerName("ephemeralSessionConfiguration"); -late final _sel_backgroundSessionConfigurationWithIdentifier_ = - objc.registerName("backgroundSessionConfigurationWithIdentifier:"); -late final _sel_identifier = objc.registerName("identifier"); -late final _sel_requestCachePolicy = objc.registerName("requestCachePolicy"); -late final _sel_setRequestCachePolicy_ = - objc.registerName("setRequestCachePolicy:"); -late final _sel_timeoutIntervalForRequest = - objc.registerName("timeoutIntervalForRequest"); -late final _sel_setTimeoutIntervalForRequest_ = - objc.registerName("setTimeoutIntervalForRequest:"); -late final _sel_timeoutIntervalForResource = - objc.registerName("timeoutIntervalForResource"); -late final _sel_setTimeoutIntervalForResource_ = - objc.registerName("setTimeoutIntervalForResource:"); -late final _sel_waitsForConnectivity = - objc.registerName("waitsForConnectivity"); -late final _sel_setWaitsForConnectivity_ = - objc.registerName("setWaitsForConnectivity:"); -late final _sel_isDiscretionary = objc.registerName("isDiscretionary"); -late final _sel_setDiscretionary_ = objc.registerName("setDiscretionary:"); -late final _sel_sharedContainerIdentifier = - objc.registerName("sharedContainerIdentifier"); -late final _sel_setSharedContainerIdentifier_ = - objc.registerName("setSharedContainerIdentifier:"); -late final _sel_sessionSendsLaunchEvents = - objc.registerName("sessionSendsLaunchEvents"); -late final _sel_setSessionSendsLaunchEvents_ = - objc.registerName("setSessionSendsLaunchEvents:"); -late final _sel_connectionProxyDictionary = - objc.registerName("connectionProxyDictionary"); -late final _sel_setConnectionProxyDictionary_ = - objc.registerName("setConnectionProxyDictionary:"); - -enum SSLProtocol { - kSSLProtocolUnknown(0), - kTLSProtocol1(4), - kTLSProtocol11(7), - kTLSProtocol12(8), - kDTLSProtocol1(9), - kTLSProtocol13(10), - kDTLSProtocol12(11), - kTLSProtocolMaxSupported(999), - kSSLProtocol2(1), - kSSLProtocol3(2), - kSSLProtocol3Only(3), - kTLSProtocol1Only(5), - kSSLProtocolAll(6); - - final int value; - const SSLProtocol(this.value); - - static SSLProtocol fromValue(int value) => switch (value) { - 0 => kSSLProtocolUnknown, - 4 => kTLSProtocol1, - 7 => kTLSProtocol11, - 8 => kTLSProtocol12, - 9 => kDTLSProtocol1, - 10 => kTLSProtocol13, - 11 => kDTLSProtocol12, - 999 => kTLSProtocolMaxSupported, - 1 => kSSLProtocol2, - 2 => kSSLProtocol3, - 3 => kSSLProtocol3Only, - 5 => kTLSProtocol1Only, - 6 => kSSLProtocolAll, - _ => throw ArgumentError("Unknown value for SSLProtocol: $value"), - }; -} - -late final _sel_TLSMinimumSupportedProtocol = - objc.registerName("TLSMinimumSupportedProtocol"); -final _objc_msgSend_ewo6ux = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setTLSMinimumSupportedProtocol_ = - objc.registerName("setTLSMinimumSupportedProtocol:"); -final _objc_msgSend_hcgw10 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_TLSMaximumSupportedProtocol = - objc.registerName("TLSMaximumSupportedProtocol"); -late final _sel_setTLSMaximumSupportedProtocol_ = - objc.registerName("setTLSMaximumSupportedProtocol:"); - -enum tls_protocol_version_t { - tls_protocol_version_TLSv10(769), - tls_protocol_version_TLSv11(770), - tls_protocol_version_TLSv12(771), - tls_protocol_version_TLSv13(772), - tls_protocol_version_DTLSv10(-257), - tls_protocol_version_DTLSv12(-259); - - final int value; - const tls_protocol_version_t(this.value); - - static tls_protocol_version_t fromValue(int value) => switch (value) { - 769 => tls_protocol_version_TLSv10, - 770 => tls_protocol_version_TLSv11, - 771 => tls_protocol_version_TLSv12, - 772 => tls_protocol_version_TLSv13, - -257 => tls_protocol_version_DTLSv10, - -259 => tls_protocol_version_DTLSv12, - _ => throw ArgumentError( - "Unknown value for tls_protocol_version_t: $value"), - }; -} - -late final _sel_TLSMinimumSupportedProtocolVersion = - objc.registerName("TLSMinimumSupportedProtocolVersion"); -final _objc_msgSend_a6qtz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Uint16 Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setTLSMinimumSupportedProtocolVersion_ = - objc.registerName("setTLSMinimumSupportedProtocolVersion:"); -final _objc_msgSend_yb8bfm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Uint16)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_TLSMaximumSupportedProtocolVersion = - objc.registerName("TLSMaximumSupportedProtocolVersion"); -late final _sel_setTLSMaximumSupportedProtocolVersion_ = - objc.registerName("setTLSMaximumSupportedProtocolVersion:"); -late final _sel_HTTPShouldSetCookies = - objc.registerName("HTTPShouldSetCookies"); -late final _sel_setHTTPShouldSetCookies_ = - objc.registerName("setHTTPShouldSetCookies:"); -late final _sel_HTTPCookieAcceptPolicy = - objc.registerName("HTTPCookieAcceptPolicy"); -late final _sel_setHTTPCookieAcceptPolicy_ = - objc.registerName("setHTTPCookieAcceptPolicy:"); -late final _sel_HTTPAdditionalHeaders = - objc.registerName("HTTPAdditionalHeaders"); -late final _sel_setHTTPAdditionalHeaders_ = - objc.registerName("setHTTPAdditionalHeaders:"); -late final _sel_HTTPMaximumConnectionsPerHost = - objc.registerName("HTTPMaximumConnectionsPerHost"); -late final _sel_setHTTPMaximumConnectionsPerHost_ = - objc.registerName("setHTTPMaximumConnectionsPerHost:"); -late final _sel_HTTPCookieStorage = objc.registerName("HTTPCookieStorage"); -late final _sel_setHTTPCookieStorage_ = - objc.registerName("setHTTPCookieStorage:"); -late final _sel_URLCredentialStorage = - objc.registerName("URLCredentialStorage"); -late final _sel_setURLCredentialStorage_ = - objc.registerName("setURLCredentialStorage:"); -late final _sel_URLCache = objc.registerName("URLCache"); -late final _sel_setURLCache_ = objc.registerName("setURLCache:"); -late final _sel_shouldUseExtendedBackgroundIdleMode = - objc.registerName("shouldUseExtendedBackgroundIdleMode"); -late final _sel_setShouldUseExtendedBackgroundIdleMode_ = - objc.registerName("setShouldUseExtendedBackgroundIdleMode:"); -late final _sel_protocolClasses = objc.registerName("protocolClasses"); -late final _sel_setProtocolClasses_ = objc.registerName("setProtocolClasses:"); - -enum NSURLSessionMultipathServiceType { - NSURLSessionMultipathServiceTypeNone(0), - NSURLSessionMultipathServiceTypeHandover(1), - NSURLSessionMultipathServiceTypeInteractive(2), - NSURLSessionMultipathServiceTypeAggregate(3); - - final int value; - const NSURLSessionMultipathServiceType(this.value); - - static NSURLSessionMultipathServiceType fromValue(int value) => - switch (value) { - 0 => NSURLSessionMultipathServiceTypeNone, - 1 => NSURLSessionMultipathServiceTypeHandover, - 2 => NSURLSessionMultipathServiceTypeInteractive, - 3 => NSURLSessionMultipathServiceTypeAggregate, - _ => throw ArgumentError( - "Unknown value for NSURLSessionMultipathServiceType: $value"), - }; -} - -late final _sel_multipathServiceType = - objc.registerName("multipathServiceType"); -final _objc_msgSend_zqvllq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setMultipathServiceType_ = - objc.registerName("setMultipathServiceType:"); -final _objc_msgSend_1ngj1qh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_backgroundSessionConfiguration_ = - objc.registerName("backgroundSessionConfiguration:"); - -/// NSURLSessionConfiguration -class NSURLSessionConfiguration extends objc.NSObject { - NSURLSessionConfiguration._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionConfiguration] that points to the same underlying object as [other]. - NSURLSessionConfiguration.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionConfiguration] that wraps the given raw object pointer. - NSURLSessionConfiguration.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionConfiguration]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionConfiguration); - } - - /// defaultSessionConfiguration - static NSURLSessionConfiguration getDefaultSessionConfiguration() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_defaultSessionConfiguration); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// ephemeralSessionConfiguration - static NSURLSessionConfiguration getEphemeralSessionConfiguration() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_ephemeralSessionConfiguration); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// backgroundSessionConfigurationWithIdentifier: - static NSURLSessionConfiguration - backgroundSessionConfigurationWithIdentifier_(objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7( - _class_NSURLSessionConfiguration, - _sel_backgroundSessionConfigurationWithIdentifier_, - identifier.ref.pointer); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// identifier - objc.NSString? get identifier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_identifier); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// requestCachePolicy - NSURLRequestCachePolicy get requestCachePolicy { - final _ret = - _objc_msgSend_2xak1q(this.ref.pointer, _sel_requestCachePolicy); - return NSURLRequestCachePolicy.fromValue(_ret); - } - - /// setRequestCachePolicy: - set requestCachePolicy(NSURLRequestCachePolicy value) { - return _objc_msgSend_12vaadl( - this.ref.pointer, _sel_setRequestCachePolicy_, value.value); - } - - /// timeoutIntervalForRequest - double get timeoutIntervalForRequest { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_timeoutIntervalForRequest) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_timeoutIntervalForRequest); - } - - /// setTimeoutIntervalForRequest: - set timeoutIntervalForRequest(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setTimeoutIntervalForRequest_, value); - } - - /// timeoutIntervalForResource - double get timeoutIntervalForResource { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_timeoutIntervalForResource) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_timeoutIntervalForResource); - } - - /// setTimeoutIntervalForResource: - set timeoutIntervalForResource(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setTimeoutIntervalForResource_, value); - } - - /// networkServiceType - NSURLRequestNetworkServiceType get networkServiceType { - final _ret = - _objc_msgSend_ttt73t(this.ref.pointer, _sel_networkServiceType); - return NSURLRequestNetworkServiceType.fromValue(_ret); - } - - /// setNetworkServiceType: - set networkServiceType(NSURLRequestNetworkServiceType value) { - return _objc_msgSend_br89tg( - this.ref.pointer, _sel_setNetworkServiceType_, value.value); - } - - /// allowsCellularAccess - bool get allowsCellularAccess { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsCellularAccess); - } - - /// setAllowsCellularAccess: - set allowsCellularAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsCellularAccess_, value); - } - - /// allowsExpensiveNetworkAccess - bool get allowsExpensiveNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExpensiveNetworkAccess); - } - - /// setAllowsExpensiveNetworkAccess: - set allowsExpensiveNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsExpensiveNetworkAccess_, value); - } - - /// allowsConstrainedNetworkAccess - bool get allowsConstrainedNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsConstrainedNetworkAccess); - } - - /// setAllowsConstrainedNetworkAccess: - set allowsConstrainedNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsConstrainedNetworkAccess_, value); - } - - /// requiresDNSSECValidation - bool get requiresDNSSECValidation { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_requiresDNSSECValidation); - } - - /// setRequiresDNSSECValidation: - set requiresDNSSECValidation(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setRequiresDNSSECValidation_, value); - } - - /// waitsForConnectivity - bool get waitsForConnectivity { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_waitsForConnectivity); - } - - /// setWaitsForConnectivity: - set waitsForConnectivity(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setWaitsForConnectivity_, value); - } - - /// isDiscretionary - bool get discretionary { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isDiscretionary); - } - - /// setDiscretionary: - set discretionary(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setDiscretionary_, value); - } - - /// sharedContainerIdentifier - objc.NSString? get sharedContainerIdentifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedContainerIdentifier); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSharedContainerIdentifier: - set sharedContainerIdentifier(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setSharedContainerIdentifier_, value?.ref.pointer ?? ffi.nullptr); - } - - /// sessionSendsLaunchEvents - bool get sessionSendsLaunchEvents { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_sessionSendsLaunchEvents); - } - - /// setSessionSendsLaunchEvents: - set sessionSendsLaunchEvents(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setSessionSendsLaunchEvents_, value); - } - - /// connectionProxyDictionary - objc.NSDictionary? get connectionProxyDictionary { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_connectionProxyDictionary); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setConnectionProxyDictionary: - set connectionProxyDictionary(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setConnectionProxyDictionary_, value?.ref.pointer ?? ffi.nullptr); - } - - /// TLSMinimumSupportedProtocol - SSLProtocol get TLSMinimumSupportedProtocol { - final _ret = _objc_msgSend_ewo6ux( - this.ref.pointer, _sel_TLSMinimumSupportedProtocol); - return SSLProtocol.fromValue(_ret); - } - - /// setTLSMinimumSupportedProtocol: - set TLSMinimumSupportedProtocol(SSLProtocol value) { - return _objc_msgSend_hcgw10( - this.ref.pointer, _sel_setTLSMinimumSupportedProtocol_, value.value); - } - - /// TLSMaximumSupportedProtocol - SSLProtocol get TLSMaximumSupportedProtocol { - final _ret = _objc_msgSend_ewo6ux( - this.ref.pointer, _sel_TLSMaximumSupportedProtocol); - return SSLProtocol.fromValue(_ret); - } - - /// setTLSMaximumSupportedProtocol: - set TLSMaximumSupportedProtocol(SSLProtocol value) { - return _objc_msgSend_hcgw10( - this.ref.pointer, _sel_setTLSMaximumSupportedProtocol_, value.value); - } - - /// TLSMinimumSupportedProtocolVersion - tls_protocol_version_t get TLSMinimumSupportedProtocolVersion { - final _ret = _objc_msgSend_a6qtz( - this.ref.pointer, _sel_TLSMinimumSupportedProtocolVersion); - return tls_protocol_version_t.fromValue(_ret); - } - - /// setTLSMinimumSupportedProtocolVersion: - set TLSMinimumSupportedProtocolVersion(tls_protocol_version_t value) { - return _objc_msgSend_yb8bfm(this.ref.pointer, - _sel_setTLSMinimumSupportedProtocolVersion_, value.value); - } - - /// TLSMaximumSupportedProtocolVersion - tls_protocol_version_t get TLSMaximumSupportedProtocolVersion { - final _ret = _objc_msgSend_a6qtz( - this.ref.pointer, _sel_TLSMaximumSupportedProtocolVersion); - return tls_protocol_version_t.fromValue(_ret); - } - - /// setTLSMaximumSupportedProtocolVersion: - set TLSMaximumSupportedProtocolVersion(tls_protocol_version_t value) { - return _objc_msgSend_yb8bfm(this.ref.pointer, - _sel_setTLSMaximumSupportedProtocolVersion_, value.value); - } - - /// HTTPShouldUsePipelining - bool get HTTPShouldUsePipelining { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldUsePipelining); - } - - /// setHTTPShouldUsePipelining: - set HTTPShouldUsePipelining(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldUsePipelining_, value); - } - - /// HTTPShouldSetCookies - bool get HTTPShouldSetCookies { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldSetCookies); - } - - /// setHTTPShouldSetCookies: - set HTTPShouldSetCookies(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldSetCookies_, value); - } - - /// HTTPCookieAcceptPolicy - NSHTTPCookieAcceptPolicy get HTTPCookieAcceptPolicy { - final _ret = - _objc_msgSend_1jpuqgg(this.ref.pointer, _sel_HTTPCookieAcceptPolicy); - return NSHTTPCookieAcceptPolicy.fromValue(_ret); - } - - /// setHTTPCookieAcceptPolicy: - set HTTPCookieAcceptPolicy(NSHTTPCookieAcceptPolicy value) { - return _objc_msgSend_199e8fv( - this.ref.pointer, _sel_setHTTPCookieAcceptPolicy_, value.value); - } - - /// HTTPAdditionalHeaders - objc.NSDictionary? get HTTPAdditionalHeaders { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPAdditionalHeaders); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPAdditionalHeaders: - set HTTPAdditionalHeaders(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setHTTPAdditionalHeaders_, value?.ref.pointer ?? ffi.nullptr); - } - - /// HTTPMaximumConnectionsPerHost - int get HTTPMaximumConnectionsPerHost { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_HTTPMaximumConnectionsPerHost); - } - - /// setHTTPMaximumConnectionsPerHost: - set HTTPMaximumConnectionsPerHost(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setHTTPMaximumConnectionsPerHost_, value); - } - - /// HTTPCookieStorage - NSHTTPCookieStorage? get HTTPCookieStorage { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPCookieStorage); - return _ret.address == 0 - ? null - : NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// setHTTPCookieStorage: - set HTTPCookieStorage(NSHTTPCookieStorage? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setHTTPCookieStorage_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// URLCredentialStorage - NSURLCredentialStorage? get URLCredentialStorage { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URLCredentialStorage); - return _ret.address == 0 - ? null - : NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// setURLCredentialStorage: - set URLCredentialStorage(NSURLCredentialStorage? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setURLCredentialStorage_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// URLCache - NSURLCache? get URLCache { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URLCache); - return _ret.address == 0 - ? null - : NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// setURLCache: - set URLCache(NSURLCache? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setURLCache_, value?.ref.pointer ?? ffi.nullptr); - } - - /// shouldUseExtendedBackgroundIdleMode - bool get shouldUseExtendedBackgroundIdleMode { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_shouldUseExtendedBackgroundIdleMode); - } - - /// setShouldUseExtendedBackgroundIdleMode: - set shouldUseExtendedBackgroundIdleMode(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldUseExtendedBackgroundIdleMode_, value); - } - - /// protocolClasses - objc.NSArray? get protocolClasses { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_protocolClasses); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setProtocolClasses: - set protocolClasses(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setProtocolClasses_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// multipathServiceType - NSURLSessionMultipathServiceType get multipathServiceType { - final _ret = - _objc_msgSend_zqvllq(this.ref.pointer, _sel_multipathServiceType); - return NSURLSessionMultipathServiceType.fromValue(_ret); - } - - /// setMultipathServiceType: - set multipathServiceType(NSURLSessionMultipathServiceType value) { - return _objc_msgSend_1ngj1qh( - this.ref.pointer, _sel_setMultipathServiceType_, value.value); - } - - /// init - NSURLSessionConfiguration init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionConfiguration new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionConfiguration, _sel_new); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// backgroundSessionConfiguration: - static NSURLSessionConfiguration backgroundSessionConfiguration_( - objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionConfiguration, - _sel_backgroundSessionConfiguration_, identifier.ref.pointer); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// allocWithZone: - static NSURLSessionConfiguration allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionConfiguration, _sel_allocWithZone_, zone); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionConfiguration alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionConfiguration, _sel_alloc); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionConfiguration, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionConfiguration, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionConfiguration, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionConfiguration, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionConfiguration, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionConfiguration, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionConfiguration, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionConfiguration self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionConfiguration retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionConfiguration autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_sessionWithConfiguration_ = - objc.registerName("sessionWithConfiguration:"); -late final _sel_sessionWithConfiguration_delegate_delegateQueue_ = - objc.registerName("sessionWithConfiguration:delegate:delegateQueue:"); -late final _sel_delegateQueue = objc.registerName("delegateQueue"); -late final _sel_configuration = objc.registerName("configuration"); -late final _sel_sessionDescription = objc.registerName("sessionDescription"); -late final _sel_setSessionDescription_ = - objc.registerName("setSessionDescription:"); -late final _sel_finishTasksAndInvalidate = - objc.registerName("finishTasksAndInvalidate"); -late final _sel_invalidateAndCancel = objc.registerName("invalidateAndCancel"); -late final _sel_resetWithCompletionHandler_ = - objc.registerName("resetWithCompletionHandler:"); -late final _sel_flushWithCompletionHandler_ = - objc.registerName("flushWithCompletionHandler:"); -void _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSArray_NSArray_NSArray { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSArray, objc.NSArray, - objc.NSArray)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSArray, objc.NSArray, objc.NSArray) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - objc.NSArray.castFromPointer(arg0, retain: true, release: true), - objc.NSArray.castFromPointer(arg1, retain: true, release: true), - objc.NSArray.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(objc.NSArray, objc.NSArray, objc.NSArray) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - objc.NSArray.castFromPointer(arg0, - retain: false, release: true), - objc.NSArray.castFromPointer(arg1, - retain: false, release: true), - objc.NSArray.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSArray, objc.NSArray, - objc.NSArray)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_CallExtension on objc - .ObjCBlock { - void call(objc.NSArray arg0, objc.NSArray arg1, objc.NSArray arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2.ref.pointer); -} - -late final _sel_getTasksWithCompletionHandler_ = - objc.registerName("getTasksWithCompletionHandler:"); -void _ObjCBlock_ffiVoid_NSArray1_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray1_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray1_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray1_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray1_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray1_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray1_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSArray1_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSArray1_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSArray1 { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSArray1_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSArray) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray1_closureCallable, - (ffi.Pointer arg0) => fn( - objc.NSArray.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSArray) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray1_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn( - objc.NSArray.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSArray1_CallExtension - on objc.ObjCBlock { - void call(objc.NSArray arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_getAllTasksWithCompletionHandler_ = - objc.registerName("getAllTasksWithCompletionHandler:"); -late final _sel_dataTaskWithRequest_ = - objc.registerName("dataTaskWithRequest:"); -late final _sel_dataTaskWithURL_ = objc.registerName("dataTaskWithURL:"); -late final _class_NSURLSessionUploadTask = - objc.getClass("NSURLSessionUploadTask"); -void _ObjCBlock_ffiVoid_NSData_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSData_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSData_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSData { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSData_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSData?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSData.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSData?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSData.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSData_CallExtension - on objc.ObjCBlock { - void call(objc.NSData? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_cancelByProducingResumeData_ = - objc.registerName("cancelByProducingResumeData:"); - -/// NSURLSessionUploadTask -class NSURLSessionUploadTask extends NSURLSessionDataTask { - NSURLSessionUploadTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionUploadTask] that points to the same underlying object as [other]. - NSURLSessionUploadTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionUploadTask] that wraps the given raw object pointer. - NSURLSessionUploadTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionUploadTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionUploadTask); - } - - /// init - NSURLSessionUploadTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionUploadTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionUploadTask, _sel_new); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelByProducingResumeData: - void cancelByProducingResumeData_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_cancelByProducingResumeData_, - completionHandler.ref.pointer); - } - - /// allocWithZone: - static NSURLSessionUploadTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionUploadTask, _sel_allocWithZone_, zone); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionUploadTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionUploadTask, _sel_alloc); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionUploadTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionUploadTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionUploadTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionUploadTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionUploadTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionUploadTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionUploadTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionUploadTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionUploadTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionUploadTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionUploadTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionUploadTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_uploadTaskWithRequest_fromFile_ = - objc.registerName("uploadTaskWithRequest:fromFile:"); -late final _sel_uploadTaskWithRequest_fromData_ = - objc.registerName("uploadTaskWithRequest:fromData:"); -late final _sel_uploadTaskWithResumeData_ = - objc.registerName("uploadTaskWithResumeData:"); -late final _sel_uploadTaskWithStreamedRequest_ = - objc.registerName("uploadTaskWithStreamedRequest:"); -late final _class_NSURLSessionDownloadTask = - objc.getClass("NSURLSessionDownloadTask"); - -/// NSURLSessionDownloadTask -class NSURLSessionDownloadTask extends NSURLSessionTask { - NSURLSessionDownloadTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionDownloadTask] that points to the same underlying object as [other]. - NSURLSessionDownloadTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionDownloadTask] that wraps the given raw object pointer. - NSURLSessionDownloadTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionDownloadTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionDownloadTask); - } - - /// cancelByProducingResumeData: - void cancelByProducingResumeData_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_cancelByProducingResumeData_, - completionHandler.ref.pointer); - } - - /// init - NSURLSessionDownloadTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionDownloadTask new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionDownloadTask, _sel_new); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionDownloadTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionDownloadTask, _sel_allocWithZone_, zone); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionDownloadTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionDownloadTask, _sel_alloc); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionDownloadTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionDownloadTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDownloadTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDownloadTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionDownloadTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionDownloadTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionDownloadTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDownloadTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDownloadTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionDownloadTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionDownloadTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionDownloadTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_downloadTaskWithRequest_ = - objc.registerName("downloadTaskWithRequest:"); -late final _sel_downloadTaskWithURL_ = - objc.registerName("downloadTaskWithURL:"); -late final _sel_downloadTaskWithResumeData_ = - objc.registerName("downloadTaskWithResumeData:"); -late final _class_NSURLSessionStreamTask = - objc.getClass("NSURLSessionStreamTask"); -void _ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Bool arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, bool, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_bool_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_bool_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_bool_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSData_bool_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSData, ffi.Bool, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Bool arg1, ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunction(void Function(objc.NSData, bool, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_bool_NSError_closureCallable, - (ffi.Pointer arg0, bool arg1, - ffi.Pointer arg2) => - fn( - objc.NSData.castFromPointer(arg0, retain: true, release: true), - arg1, - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock - listener(void Function(objc.NSData, bool, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, bool arg1, - ffi.Pointer arg2) => - fn( - objc.NSData.castFromPointer(arg0, retain: false, release: true), - arg1, - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_hfhq9m(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSData, ffi.Bool, objc.NSError?)>(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSData_bool_NSError_CallExtension - on objc.ObjCBlock { - void call(objc.NSData arg0, bool arg1, objc.NSError? arg2) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Bool arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1, arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_readDataOfMinLength_maxLength_timeout_completionHandler_ = objc - .registerName("readDataOfMinLength:maxLength:timeout:completionHandler:"); -final _objc_msgSend_15i4521 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - double, - ffi.Pointer)>(); -late final _sel_writeData_timeout_completionHandler_ = - objc.registerName("writeData:timeout:completionHandler:"); -final _objc_msgSend_5qmwfe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer)>(); -late final _sel_captureStreams = objc.registerName("captureStreams"); -late final _sel_closeWrite = objc.registerName("closeWrite"); -late final _sel_closeRead = objc.registerName("closeRead"); -late final _sel_startSecureConnection = - objc.registerName("startSecureConnection"); -late final _sel_stopSecureConnection = - objc.registerName("stopSecureConnection"); - -/// NSURLSessionStreamTask -class NSURLSessionStreamTask extends NSURLSessionTask { - NSURLSessionStreamTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionStreamTask] that points to the same underlying object as [other]. - NSURLSessionStreamTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionStreamTask] that wraps the given raw object pointer. - NSURLSessionStreamTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionStreamTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionStreamTask); - } - - /// readDataOfMinLength:maxLength:timeout:completionHandler: - void readDataOfMinLength_maxLength_timeout_completionHandler_( - int minBytes, - int maxBytes, - double timeout, - objc.ObjCBlock - completionHandler) { - _objc_msgSend_15i4521( - this.ref.pointer, - _sel_readDataOfMinLength_maxLength_timeout_completionHandler_, - minBytes, - maxBytes, - timeout, - completionHandler.ref.pointer); - } - - /// writeData:timeout:completionHandler: - void writeData_timeout_completionHandler_(objc.NSData data, double timeout, - objc.ObjCBlock completionHandler) { - _objc_msgSend_5qmwfe( - this.ref.pointer, - _sel_writeData_timeout_completionHandler_, - data.ref.pointer, - timeout, - completionHandler.ref.pointer); - } - - /// captureStreams - void captureStreams() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_captureStreams); - } - - /// closeWrite - void closeWrite() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_closeWrite); - } - - /// closeRead - void closeRead() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_closeRead); - } - - /// startSecureConnection - void startSecureConnection() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_startSecureConnection); - } - - /// stopSecureConnection - void stopSecureConnection() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stopSecureConnection); - } - - /// init - NSURLSessionStreamTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionStreamTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionStreamTask, _sel_new); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionStreamTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionStreamTask, _sel_allocWithZone_, zone); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionStreamTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionStreamTask, _sel_alloc); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionStreamTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionStreamTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionStreamTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionStreamTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionStreamTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionStreamTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionStreamTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionStreamTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionStreamTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionStreamTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionStreamTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionStreamTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_streamTaskWithHostName_port_ = - objc.registerName("streamTaskWithHostName:port:"); -final _objc_msgSend_spwp90 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _class_NSNetService = objc.getClass("NSNetService"); -late final _sel_initWithDomain_type_name_port_ = - objc.registerName("initWithDomain:type:name:port:"); -final _objc_msgSend_1vcjoth = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Int)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_initWithDomain_type_name_ = - objc.registerName("initWithDomain:type:name:"); -late final _sel_includesPeerToPeer = objc.registerName("includesPeerToPeer"); -late final _sel_setIncludesPeerToPeer_ = - objc.registerName("setIncludesPeerToPeer:"); -late final _sel_type = objc.registerName("type"); -late final _sel_addresses = objc.registerName("addresses"); - -enum NSNetServiceOptions { - NSNetServiceNoAutoRename(1), - NSNetServiceListenForConnections(2); - - final int value; - const NSNetServiceOptions(this.value); - - static NSNetServiceOptions fromValue(int value) => switch (value) { - 1 => NSNetServiceNoAutoRename, - 2 => NSNetServiceListenForConnections, - _ => - throw ArgumentError("Unknown value for NSNetServiceOptions: $value"), - }; -} - -late final _sel_publishWithOptions_ = objc.registerName("publishWithOptions:"); -final _objc_msgSend_hj2tkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_resolve = objc.registerName("resolve"); -late final _sel_stop = objc.registerName("stop"); -late final _sel_dictionaryFromTXTRecordData_ = - objc.registerName("dictionaryFromTXTRecordData:"); -late final _sel_dataFromTXTRecordDictionary_ = - objc.registerName("dataFromTXTRecordDictionary:"); -late final _sel_resolveWithTimeout_ = objc.registerName("resolveWithTimeout:"); -late final _sel_getInputStream_outputStream_ = - objc.registerName("getInputStream:outputStream:"); -final _objc_msgSend_1xn13sz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_setTXTRecordData_ = objc.registerName("setTXTRecordData:"); -late final _sel_TXTRecordData = objc.registerName("TXTRecordData"); -late final _sel_startMonitoring = objc.registerName("startMonitoring"); -late final _sel_stopMonitoring = objc.registerName("stopMonitoring"); - -/// NSNetService -class NSNetService extends objc.NSObject { - NSNetService._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSNetService] that points to the same underlying object as [other]. - NSNetService.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSNetService] that wraps the given raw object pointer. - NSNetService.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSNetService]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSNetService); - } - - /// initWithDomain:type:name:port: - NSNetService initWithDomain_type_name_port_( - objc.NSString domain, objc.NSString type, objc.NSString name, int port) { - final _ret = _objc_msgSend_1vcjoth( - this.ref.retainAndReturnPointer(), - _sel_initWithDomain_type_name_port_, - domain.ref.pointer, - type.ref.pointer, - name.ref.pointer, - port); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithDomain:type:name: - NSNetService initWithDomain_type_name_( - objc.NSString domain, objc.NSString type, objc.NSString name) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithDomain_type_name_, - domain.ref.pointer, - type.ref.pointer, - name.ref.pointer); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// scheduleInRunLoop:forMode: - void scheduleInRunLoop_forMode_(objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// removeFromRunLoop:forMode: - void removeFromRunLoop_forMode_(objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeFromRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// includesPeerToPeer - bool get includesPeerToPeer { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_includesPeerToPeer); - } - - /// setIncludesPeerToPeer: - set includesPeerToPeer(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setIncludesPeerToPeer_, value); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// type - objc.NSString get type { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_type); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// domain - objc.NSString get domain { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_domain); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// hostName - objc.NSString? get hostName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_hostName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addresses - objc.NSArray? get addresses { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_addresses); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// port - int get port { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_port); - } - - /// publish - void publish() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_publish); - } - - /// publishWithOptions: - void publishWithOptions_(NSNetServiceOptions options) { - _objc_msgSend_hj2tkj( - this.ref.pointer, _sel_publishWithOptions_, options.value); - } - - /// resolve - void resolve() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resolve); - } - - /// stop - void stop() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stop); - } - - /// dictionaryFromTXTRecordData: - static objc.NSDictionary dictionaryFromTXTRecordData_(objc.NSData txtData) { - final _ret = _objc_msgSend_juohf7(_class_NSNetService, - _sel_dictionaryFromTXTRecordData_, txtData.ref.pointer); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// dataFromTXTRecordDictionary: - static objc.NSData dataFromTXTRecordDictionary_( - objc.NSDictionary txtDictionary) { - final _ret = _objc_msgSend_juohf7(_class_NSNetService, - _sel_dataFromTXTRecordDictionary_, txtDictionary.ref.pointer); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// resolveWithTimeout: - void resolveWithTimeout_(double timeout) { - _objc_msgSend_suh039(this.ref.pointer, _sel_resolveWithTimeout_, timeout); - } - - /// getInputStream:outputStream: - bool getInputStream_outputStream_( - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - return _objc_msgSend_1xn13sz(this.ref.pointer, - _sel_getInputStream_outputStream_, inputStream, outputStream); - } - - /// setTXTRecordData: - bool setTXTRecordData_(objc.NSData? recordData) { - return _objc_msgSend_l8lotg(this.ref.pointer, _sel_setTXTRecordData_, - recordData?.ref.pointer ?? ffi.nullptr); - } - - /// TXTRecordData - objc.NSData? TXTRecordData() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_TXTRecordData); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// startMonitoring - void startMonitoring() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_startMonitoring); - } - - /// stopMonitoring - void stopMonitoring() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stopMonitoring); - } - - /// init - NSNetService init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSNetService new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNetService, _sel_new); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSNetService allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSNetService, _sel_allocWithZone_, zone); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSNetService alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNetService, _sel_alloc); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSNetService, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSNetService, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSNetService, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSNetService, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSNetService, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSNetService, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSNetService, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNetService, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNetService, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSNetService self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSNetService.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSNetService retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSNetService.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSNetService autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSNetService.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_streamTaskWithNetService_ = - objc.registerName("streamTaskWithNetService:"); -late final _class_NSURLSessionWebSocketTask = - objc.getClass("NSURLSessionWebSocketTask"); -late final _class_NSURLSessionWebSocketMessage = - objc.getClass("NSURLSessionWebSocketMessage"); - -enum NSURLSessionWebSocketMessageType { - NSURLSessionWebSocketMessageTypeData(0), - NSURLSessionWebSocketMessageTypeString(1); - - final int value; - const NSURLSessionWebSocketMessageType(this.value); - - static NSURLSessionWebSocketMessageType fromValue(int value) => - switch (value) { - 0 => NSURLSessionWebSocketMessageTypeData, - 1 => NSURLSessionWebSocketMessageTypeString, - _ => throw ArgumentError( - "Unknown value for NSURLSessionWebSocketMessageType: $value"), - }; -} - -final _objc_msgSend_1kew1r = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); - -/// NSURLSessionWebSocketMessage -class NSURLSessionWebSocketMessage extends objc.NSObject { - NSURLSessionWebSocketMessage._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionWebSocketMessage] that points to the same underlying object as [other]. - NSURLSessionWebSocketMessage.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionWebSocketMessage] that wraps the given raw object pointer. - NSURLSessionWebSocketMessage.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionWebSocketMessage]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_NSURLSessionWebSocketMessage); - } - - /// initWithData: - NSURLSessionWebSocketMessage initWithData_(objc.NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithData_, data.ref.pointer); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithString: - NSURLSessionWebSocketMessage initWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, string.ref.pointer); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// type - NSURLSessionWebSocketMessageType get type { - final _ret = _objc_msgSend_1kew1r(this.ref.pointer, _sel_type); - return NSURLSessionWebSocketMessageType.fromValue(_ret); - } - - /// data - objc.NSData? get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// string - objc.NSString? get string { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_string); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLSessionWebSocketMessage init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionWebSocketMessage new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketMessage, _sel_new); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionWebSocketMessage allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionWebSocketMessage, _sel_allocWithZone_, zone); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionWebSocketMessage alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketMessage, _sel_alloc); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionWebSocketMessage, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionWebSocketMessage, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_NSURLSessionWebSocketMessage, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionWebSocketMessage, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionWebSocketMessage, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionWebSocketMessage, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionWebSocketMessage, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketMessage, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionWebSocketMessage, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionWebSocketMessage self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionWebSocketMessage retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionWebSocketMessage autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_sendMessage_completionHandler_ = - objc.registerName("sendMessage:completionHandler:"); -void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerCallable = - ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSURLSessionWebSocketMessage?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0.address == 0 - ? null - : NSURLSessionWebSocketMessage.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> - listener(void Function(NSURLSessionWebSocketMessage?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - arg0.address == 0 - ? null - : NSURLSessionWebSocketMessage.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_CallExtension - on objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> { - void call(NSURLSessionWebSocketMessage? arg0, objc.NSError? arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, arg1?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_receiveMessageWithCompletionHandler_ = - objc.registerName("receiveMessageWithCompletionHandler:"); -late final _sel_sendPingWithPongReceiveHandler_ = - objc.registerName("sendPingWithPongReceiveHandler:"); - -enum NSURLSessionWebSocketCloseCode { - NSURLSessionWebSocketCloseCodeInvalid(0), - NSURLSessionWebSocketCloseCodeNormalClosure(1000), - NSURLSessionWebSocketCloseCodeGoingAway(1001), - NSURLSessionWebSocketCloseCodeProtocolError(1002), - NSURLSessionWebSocketCloseCodeUnsupportedData(1003), - NSURLSessionWebSocketCloseCodeNoStatusReceived(1005), - NSURLSessionWebSocketCloseCodeAbnormalClosure(1006), - NSURLSessionWebSocketCloseCodeInvalidFramePayloadData(1007), - NSURLSessionWebSocketCloseCodePolicyViolation(1008), - NSURLSessionWebSocketCloseCodeMessageTooBig(1009), - NSURLSessionWebSocketCloseCodeMandatoryExtensionMissing(1010), - NSURLSessionWebSocketCloseCodeInternalServerError(1011), - NSURLSessionWebSocketCloseCodeTLSHandshakeFailure(1015); - - final int value; - const NSURLSessionWebSocketCloseCode(this.value); - - static NSURLSessionWebSocketCloseCode fromValue(int value) => switch (value) { - 0 => NSURLSessionWebSocketCloseCodeInvalid, - 1000 => NSURLSessionWebSocketCloseCodeNormalClosure, - 1001 => NSURLSessionWebSocketCloseCodeGoingAway, - 1002 => NSURLSessionWebSocketCloseCodeProtocolError, - 1003 => NSURLSessionWebSocketCloseCodeUnsupportedData, - 1005 => NSURLSessionWebSocketCloseCodeNoStatusReceived, - 1006 => NSURLSessionWebSocketCloseCodeAbnormalClosure, - 1007 => NSURLSessionWebSocketCloseCodeInvalidFramePayloadData, - 1008 => NSURLSessionWebSocketCloseCodePolicyViolation, - 1009 => NSURLSessionWebSocketCloseCodeMessageTooBig, - 1010 => NSURLSessionWebSocketCloseCodeMandatoryExtensionMissing, - 1011 => NSURLSessionWebSocketCloseCodeInternalServerError, - 1015 => NSURLSessionWebSocketCloseCodeTLSHandshakeFailure, - _ => throw ArgumentError( - "Unknown value for NSURLSessionWebSocketCloseCode: $value"), - }; -} - -late final _sel_cancelWithCloseCode_reason_ = - objc.registerName("cancelWithCloseCode:reason:"); -final _objc_msgSend_18im7ej = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_maximumMessageSize = objc.registerName("maximumMessageSize"); -late final _sel_setMaximumMessageSize_ = - objc.registerName("setMaximumMessageSize:"); -late final _sel_closeCode = objc.registerName("closeCode"); -final _objc_msgSend_a13zbl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_closeReason = objc.registerName("closeReason"); - -/// NSURLSessionWebSocketTask -class NSURLSessionWebSocketTask extends NSURLSessionTask { - NSURLSessionWebSocketTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionWebSocketTask] that points to the same underlying object as [other]. - NSURLSessionWebSocketTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionWebSocketTask] that wraps the given raw object pointer. - NSURLSessionWebSocketTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionWebSocketTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionWebSocketTask); - } - - /// sendMessage:completionHandler: - void sendMessage_completionHandler_(NSURLSessionWebSocketMessage message, - objc.ObjCBlock completionHandler) { - _objc_msgSend_cmbt6k(this.ref.pointer, _sel_sendMessage_completionHandler_, - message.ref.pointer, completionHandler.ref.pointer); - } - - /// receiveMessageWithCompletionHandler: - void receiveMessageWithCompletionHandler_( - objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> - completionHandler) { - _objc_msgSend_4daxhl( - this.ref.pointer, - _sel_receiveMessageWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// sendPingWithPongReceiveHandler: - void sendPingWithPongReceiveHandler_( - objc.ObjCBlock pongReceiveHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_sendPingWithPongReceiveHandler_, - pongReceiveHandler.ref.pointer); - } - - /// cancelWithCloseCode:reason: - void cancelWithCloseCode_reason_( - NSURLSessionWebSocketCloseCode closeCode, objc.NSData? reason) { - _objc_msgSend_18im7ej(this.ref.pointer, _sel_cancelWithCloseCode_reason_, - closeCode.value, reason?.ref.pointer ?? ffi.nullptr); - } - - /// maximumMessageSize - int get maximumMessageSize { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_maximumMessageSize); - } - - /// setMaximumMessageSize: - set maximumMessageSize(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setMaximumMessageSize_, value); - } - - /// closeCode - NSURLSessionWebSocketCloseCode get closeCode { - final _ret = _objc_msgSend_a13zbl(this.ref.pointer, _sel_closeCode); - return NSURLSessionWebSocketCloseCode.fromValue(_ret); - } - - /// closeReason - objc.NSData? get closeReason { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_closeReason); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLSessionWebSocketTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionWebSocketTask new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketTask, _sel_new); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionWebSocketTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionWebSocketTask, _sel_allocWithZone_, zone); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionWebSocketTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketTask, _sel_alloc); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionWebSocketTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionWebSocketTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionWebSocketTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionWebSocketTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionWebSocketTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionWebSocketTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionWebSocketTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionWebSocketTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionWebSocketTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionWebSocketTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionWebSocketTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionWebSocketTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_webSocketTaskWithURL_ = - objc.registerName("webSocketTaskWithURL:"); -late final _sel_webSocketTaskWithURL_protocols_ = - objc.registerName("webSocketTaskWithURL:protocols:"); -late final _sel_webSocketTaskWithRequest_ = - objc.registerName("webSocketTaskWithRequest:"); -void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSData?, NSURLResponse?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 ? null : objc.NSData.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : NSURLResponse.castFromPointer(arg1, retain: true, release: true), - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(objc.NSData?, NSURLResponse?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.NSData.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : NSURLResponse.castFromPointer(arg1, - retain: false, release: true), - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_CallExtension on objc - .ObjCBlock { - void call(objc.NSData? arg0, NSURLResponse? arg1, objc.NSError? arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, - arg1?.ref.pointer ?? ffi.nullptr, - arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_dataTaskWithRequest_completionHandler_ = - objc.registerName("dataTaskWithRequest:completionHandler:"); -late final _sel_dataTaskWithURL_completionHandler_ = - objc.registerName("dataTaskWithURL:completionHandler:"); -late final _sel_uploadTaskWithRequest_fromFile_completionHandler_ = - objc.registerName("uploadTaskWithRequest:fromFile:completionHandler:"); -final _objc_msgSend_37obke = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_uploadTaskWithRequest_fromData_completionHandler_ = - objc.registerName("uploadTaskWithRequest:fromData:completionHandler:"); -late final _sel_uploadTaskWithResumeData_completionHandler_ = - objc.registerName("uploadTaskWithResumeData:completionHandler:"); -void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSURL?, NSURLResponse?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 ? null : objc.NSURL.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : NSURLResponse.castFromPointer(arg1, retain: true, release: true), - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(objc.NSURL?, NSURLResponse?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.NSURL - .castFromPointer(arg0, retain: false, release: true), - arg1.address == 0 - ? null - : NSURLResponse.castFromPointer(arg1, - retain: false, release: true), - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_CallExtension on objc - .ObjCBlock { - void call(objc.NSURL? arg0, NSURLResponse? arg1, objc.NSError? arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, - arg1?.ref.pointer ?? ffi.nullptr, - arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_downloadTaskWithRequest_completionHandler_ = - objc.registerName("downloadTaskWithRequest:completionHandler:"); -late final _sel_downloadTaskWithURL_completionHandler_ = - objc.registerName("downloadTaskWithURL:completionHandler:"); -late final _sel_downloadTaskWithResumeData_completionHandler_ = - objc.registerName("downloadTaskWithResumeData:completionHandler:"); - -/// NSURLSession -class NSURLSession extends objc.NSObject { - NSURLSession._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSession] that points to the same underlying object as [other]. - NSURLSession.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSession] that wraps the given raw object pointer. - NSURLSession.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSession]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSession); - } - - /// sharedSession - static NSURLSession getSharedSession() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSession, _sel_sharedSession); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// sessionWithConfiguration: - static NSURLSession sessionWithConfiguration_( - NSURLSessionConfiguration configuration) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSession, - _sel_sessionWithConfiguration_, configuration.ref.pointer); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// sessionWithConfiguration:delegate:delegateQueue: - static NSURLSession sessionWithConfiguration_delegate_delegateQueue_( - NSURLSessionConfiguration configuration, - objc.ObjCObjectBase? delegate, - NSOperationQueue? queue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSURLSession, - _sel_sessionWithConfiguration_delegate_delegateQueue_, - configuration.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr, - queue?.ref.pointer ?? ffi.nullptr); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// delegateQueue - NSOperationQueue get delegateQueue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegateQueue); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// configuration - NSURLSessionConfiguration get configuration { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_configuration); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// sessionDescription - objc.NSString? get sessionDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sessionDescription); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSessionDescription: - set sessionDescription(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setSessionDescription_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// finishTasksAndInvalidate - void finishTasksAndInvalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_finishTasksAndInvalidate); - } - - /// invalidateAndCancel - void invalidateAndCancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidateAndCancel); - } - - /// resetWithCompletionHandler: - void resetWithCompletionHandler_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_resetWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// flushWithCompletionHandler: - void flushWithCompletionHandler_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_flushWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// getTasksWithCompletionHandler: - void getTasksWithCompletionHandler_( - objc.ObjCBlock< - ffi.Void Function(objc.NSArray, objc.NSArray, objc.NSArray)> - completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_getTasksWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// getAllTasksWithCompletionHandler: - void getAllTasksWithCompletionHandler_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, - _sel_getAllTasksWithCompletionHandler_, completionHandler.ref.pointer); - } - - /// dataTaskWithRequest: - NSURLSessionDataTask dataTaskWithRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dataTaskWithRequest_, request.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// dataTaskWithURL: - NSURLSessionDataTask dataTaskWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dataTaskWithURL_, url.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromFile: - NSURLSessionUploadTask uploadTaskWithRequest_fromFile_( - NSURLRequest request, objc.NSURL fileURL) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromFile_, - request.ref.pointer, - fileURL.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromData: - NSURLSessionUploadTask uploadTaskWithRequest_fromData_( - NSURLRequest request, objc.NSData bodyData) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromData_, - request.ref.pointer, - bodyData.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithResumeData: - NSURLSessionUploadTask uploadTaskWithResumeData_(objc.NSData resumeData) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_uploadTaskWithResumeData_, resumeData.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithStreamedRequest: - NSURLSessionUploadTask uploadTaskWithStreamedRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_uploadTaskWithStreamedRequest_, request.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithRequest: - NSURLSessionDownloadTask downloadTaskWithRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_downloadTaskWithRequest_, request.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithURL: - NSURLSessionDownloadTask downloadTaskWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_downloadTaskWithURL_, url.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithResumeData: - NSURLSessionDownloadTask downloadTaskWithResumeData_(objc.NSData resumeData) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_downloadTaskWithResumeData_, resumeData.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// streamTaskWithHostName:port: - NSURLSessionStreamTask streamTaskWithHostName_port_( - objc.NSString hostname, int port) { - final _ret = _objc_msgSend_spwp90(this.ref.pointer, - _sel_streamTaskWithHostName_port_, hostname.ref.pointer, port); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// streamTaskWithNetService: - NSURLSessionStreamTask streamTaskWithNetService_(NSNetService service) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_streamTaskWithNetService_, service.ref.pointer); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// webSocketTaskWithURL: - NSURLSessionWebSocketTask webSocketTaskWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_webSocketTaskWithURL_, url.ref.pointer); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// webSocketTaskWithURL:protocols: - NSURLSessionWebSocketTask webSocketTaskWithURL_protocols_( - objc.NSURL url, objc.NSArray protocols) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_webSocketTaskWithURL_protocols_, - url.ref.pointer, - protocols.ref.pointer); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// webSocketTaskWithRequest: - NSURLSessionWebSocketTask webSocketTaskWithRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_webSocketTaskWithRequest_, request.ref.pointer); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSURLSession init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLSession new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSession, _sel_new); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// dataTaskWithRequest:completionHandler: - NSURLSessionDataTask dataTaskWithRequest_completionHandler_( - NSURLRequest request, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_dataTaskWithRequest_completionHandler_, - request.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// dataTaskWithURL:completionHandler: - NSURLSessionDataTask dataTaskWithURL_completionHandler_( - objc.NSURL url, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_dataTaskWithURL_completionHandler_, - url.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromFile:completionHandler: - NSURLSessionUploadTask uploadTaskWithRequest_fromFile_completionHandler_( - NSURLRequest request, - objc.NSURL fileURL, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_37obke( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromFile_completionHandler_, - request.ref.pointer, - fileURL.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromData:completionHandler: - NSURLSessionUploadTask uploadTaskWithRequest_fromData_completionHandler_( - NSURLRequest request, - objc.NSData? bodyData, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_37obke( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromData_completionHandler_, - request.ref.pointer, - bodyData?.ref.pointer ?? ffi.nullptr, - completionHandler.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithResumeData:completionHandler: - NSURLSessionUploadTask uploadTaskWithResumeData_completionHandler_( - objc.NSData resumeData, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_uploadTaskWithResumeData_completionHandler_, - resumeData.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithRequest:completionHandler: - NSURLSessionDownloadTask downloadTaskWithRequest_completionHandler_( - NSURLRequest request, - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_downloadTaskWithRequest_completionHandler_, - request.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithURL:completionHandler: - NSURLSessionDownloadTask downloadTaskWithURL_completionHandler_( - objc.NSURL url, - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_downloadTaskWithURL_completionHandler_, - url.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithResumeData:completionHandler: - NSURLSessionDownloadTask downloadTaskWithResumeData_completionHandler_( - objc.NSData resumeData, - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_downloadTaskWithResumeData_completionHandler_, - resumeData.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// allocWithZone: - static NSURLSession allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLSession, _sel_allocWithZone_, zone); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLSession alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSession, _sel_alloc); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSession, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSession, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSession, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLSession, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSession, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSession, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSession, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSession, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSession, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSession self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLSession retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLSession autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSProtocolChecker = objc.getClass("NSProtocolChecker"); -late final _sel_target = objc.registerName("target"); -late final _sel_protocolCheckerWithTarget_protocol_ = - objc.registerName("protocolCheckerWithTarget:protocol:"); -late final _sel_initWithTarget_protocol_ = - objc.registerName("initWithTarget:protocol:"); - -/// NSProtocolChecker -class NSProtocolChecker extends objc.NSProxy { - NSProtocolChecker._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSProtocolChecker] that points to the same underlying object as [other]. - NSProtocolChecker.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSProtocolChecker] that wraps the given raw object pointer. - NSProtocolChecker.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSProtocolChecker]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSProtocolChecker); - } - - /// protocol - objc.Protocol get protocol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_protocol); - return objc.Protocol.castFromPointer(_ret, retain: true, release: true); - } - - /// target - objc.NSObject? get target { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_target); - return _ret.address == 0 - ? null - : objc.NSObject.castFromPointer(_ret, retain: true, release: true); - } - - /// protocolCheckerWithTarget:protocol: - static NSProtocolChecker protocolCheckerWithTarget_protocol_( - objc.NSObject anObject, objc.Protocol aProtocol) { - final _ret = _objc_msgSend_iq11qg( - _class_NSProtocolChecker, - _sel_protocolCheckerWithTarget_protocol_, - anObject.ref.pointer, - aProtocol.ref.pointer); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithTarget:protocol: - NSProtocolChecker initWithTarget_protocol_( - objc.NSObject anObject, objc.Protocol aProtocol) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithTarget_protocol_, - anObject.ref.pointer, - aProtocol.ref.pointer); - return NSProtocolChecker.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static objc.ObjCObjectBase alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProtocolChecker, _sel_alloc); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// self - NSProtocolChecker self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSProtocolChecker retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSProtocolChecker autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSTask = objc.getClass("NSTask"); -late final _sel_setExecutableURL_ = objc.registerName("setExecutableURL:"); -late final _sel_setArguments_ = objc.registerName("setArguments:"); -late final _sel_setEnvironment_ = objc.registerName("setEnvironment:"); -late final _sel_currentDirectoryURL = objc.registerName("currentDirectoryURL"); -late final _sel_setCurrentDirectoryURL_ = - objc.registerName("setCurrentDirectoryURL:"); -late final _sel_standardInput = objc.registerName("standardInput"); -late final _sel_setStandardInput_ = objc.registerName("setStandardInput:"); -late final _sel_standardOutput = objc.registerName("standardOutput"); -late final _sel_setStandardOutput_ = objc.registerName("setStandardOutput:"); -late final _sel_standardError = objc.registerName("standardError"); -late final _sel_setStandardError_ = objc.registerName("setStandardError:"); -late final _sel_launchAndReturnError_ = - objc.registerName("launchAndReturnError:"); -late final _sel_interrupt = objc.registerName("interrupt"); -late final _sel_terminate = objc.registerName("terminate"); -late final _sel_isRunning = objc.registerName("isRunning"); -late final _sel_terminationStatus = objc.registerName("terminationStatus"); - -enum NSTaskTerminationReason { - NSTaskTerminationReasonExit(1), - NSTaskTerminationReasonUncaughtSignal(2); - - final int value; - const NSTaskTerminationReason(this.value); - - static NSTaskTerminationReason fromValue(int value) => switch (value) { - 1 => NSTaskTerminationReasonExit, - 2 => NSTaskTerminationReasonUncaughtSignal, - _ => throw ArgumentError( - "Unknown value for NSTaskTerminationReason: $value"), - }; -} - -late final _sel_terminationReason = objc.registerName("terminationReason"); -final _objc_msgSend_19wfngj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_NSTask_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTask_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTask_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTask_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTask_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTask_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTask_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSTask_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSTask_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSTask { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSTask_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSTask) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTask_closureCallable, - (ffi.Pointer arg0) => fn( - NSTask.castFromPointer(arg0, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSTask) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTask_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => - fn(NSTask.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSTask_CallExtension - on objc.ObjCBlock { - void call(NSTask arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_terminationHandler = objc.registerName("terminationHandler"); -late final _sel_setTerminationHandler_ = - objc.registerName("setTerminationHandler:"); -late final _sel_launchedTaskWithExecutableURL_arguments_error_terminationHandler_ = - objc.registerName( - "launchedTaskWithExecutableURL:arguments:error:terminationHandler:"); -final _objc_msgSend_1rgs79u = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>(); -late final _sel_waitUntilExit = objc.registerName("waitUntilExit"); -late final _sel_launchPath = objc.registerName("launchPath"); -late final _sel_setLaunchPath_ = objc.registerName("setLaunchPath:"); -late final _sel_setCurrentDirectoryPath_ = - objc.registerName("setCurrentDirectoryPath:"); -late final _sel_launch = objc.registerName("launch"); -late final _sel_launchedTaskWithLaunchPath_arguments_ = - objc.registerName("launchedTaskWithLaunchPath:arguments:"); - -/// NSTask -class NSTask extends objc.NSObject { - NSTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTask] that points to the same underlying object as [other]. - NSTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTask] that wraps the given raw object pointer. - NSTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTask); - } - - /// init - NSTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// executableURL - objc.NSURL? get executableURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executableURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setExecutableURL: - set executableURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setExecutableURL_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// arguments - objc.NSArray? get arguments { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_arguments); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setArguments: - set arguments(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setArguments_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// environment - objc.NSDictionary? get environment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_environment); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setEnvironment: - set environment(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setEnvironment_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// currentDirectoryURL - objc.NSURL? get currentDirectoryURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDirectoryURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrentDirectoryURL: - set currentDirectoryURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCurrentDirectoryURL_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// standardInput - objc.ObjCObjectBase? get standardInput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardInput); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setStandardInput: - set standardInput(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStandardInput_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// standardOutput - objc.ObjCObjectBase? get standardOutput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardOutput); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setStandardOutput: - set standardOutput(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStandardOutput_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// standardError - objc.ObjCObjectBase? get standardError { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardError); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setStandardError: - set standardError(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStandardError_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// launchAndReturnError: - bool launchAndReturnError_(ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_launchAndReturnError_, error); - } - - /// interrupt - void interrupt() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_interrupt); - } - - /// terminate - void terminate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_terminate); - } - - /// suspend - bool suspend() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_suspend); - } - - /// resume - bool resume() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_resume); - } - - /// processIdentifier - int get processIdentifier { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_processIdentifier); - } - - /// isRunning - bool get running { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isRunning); - } - - /// terminationStatus - int get terminationStatus { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_terminationStatus); - } - - /// terminationReason - NSTaskTerminationReason get terminationReason { - final _ret = - _objc_msgSend_19wfngj(this.ref.pointer, _sel_terminationReason); - return NSTaskTerminationReason.fromValue(_ret); - } - - /// terminationHandler - objc.ObjCBlock? get terminationHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_terminationHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid_NSTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// setTerminationHandler: - set terminationHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setTerminationHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// qualityOfService - NSQualityOfService get qualityOfService { - final _ret = _objc_msgSend_17dnyeh(this.ref.pointer, _sel_qualityOfService); - return NSQualityOfService.fromValue(_ret); - } - - /// setQualityOfService: - set qualityOfService(NSQualityOfService value) { - return _objc_msgSend_1fcr8u4( - this.ref.pointer, _sel_setQualityOfService_, value.value); - } - - /// launchedTaskWithExecutableURL:arguments:error:terminationHandler: - static NSTask? - launchedTaskWithExecutableURL_arguments_error_terminationHandler_( - objc.NSURL url, - objc.NSArray arguments, - ffi.Pointer> error, - objc.ObjCBlock? terminationHandler) { - final _ret = _objc_msgSend_1rgs79u( - _class_NSTask, - _sel_launchedTaskWithExecutableURL_arguments_error_terminationHandler_, - url.ref.pointer, - arguments.ref.pointer, - error, - terminationHandler?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// waitUntilExit - void waitUntilExit() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_waitUntilExit); - } - - /// launchPath - objc.NSString? get launchPath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_launchPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLaunchPath: - set launchPath(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setLaunchPath_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// currentDirectoryPath - objc.NSString get currentDirectoryPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDirectoryPath); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrentDirectoryPath: - set currentDirectoryPath(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrentDirectoryPath_, value.ref.pointer); - } - - /// launch - void launch() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_launch); - } - - /// launchedTaskWithLaunchPath:arguments: - static NSTask launchedTaskWithLaunchPath_arguments_( - objc.NSString path, objc.NSArray arguments) { - final _ret = _objc_msgSend_iq11qg( - _class_NSTask, - _sel_launchedTaskWithLaunchPath_arguments_, - path.ref.pointer, - arguments.ref.pointer); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTask, _sel_new); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSTask, _sel_allocWithZone_, zone); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSTask alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTask, _sel_alloc); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSXMLNode = objc.getClass("NSXMLNode"); - -enum NSXMLNodeKind { - NSXMLInvalidKind(0), - NSXMLDocumentKind(1), - NSXMLElementKind(2), - NSXMLAttributeKind(3), - NSXMLNamespaceKind(4), - NSXMLProcessingInstructionKind(5), - NSXMLCommentKind(6), - NSXMLTextKind(7), - NSXMLDTDKind(8), - NSXMLEntityDeclarationKind(9), - NSXMLAttributeDeclarationKind(10), - NSXMLElementDeclarationKind(11), - NSXMLNotationDeclarationKind(12); - - final int value; - const NSXMLNodeKind(this.value); - - static NSXMLNodeKind fromValue(int value) => switch (value) { - 0 => NSXMLInvalidKind, - 1 => NSXMLDocumentKind, - 2 => NSXMLElementKind, - 3 => NSXMLAttributeKind, - 4 => NSXMLNamespaceKind, - 5 => NSXMLProcessingInstructionKind, - 6 => NSXMLCommentKind, - 7 => NSXMLTextKind, - 8 => NSXMLDTDKind, - 9 => NSXMLEntityDeclarationKind, - 10 => NSXMLAttributeDeclarationKind, - 11 => NSXMLElementDeclarationKind, - 12 => NSXMLNotationDeclarationKind, - _ => throw ArgumentError("Unknown value for NSXMLNodeKind: $value"), - }; -} - -late final _sel_initWithKind_ = objc.registerName("initWithKind:"); -final _objc_msgSend_ayvqtd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSXMLNodeOptions { - NSXMLNodeOptionsNone(0), - NSXMLNodeIsCDATA(1), - NSXMLNodeExpandEmptyElement(2), - NSXMLNodeCompactEmptyElement(4), - NSXMLNodeUseSingleQuotes(8), - NSXMLNodeUseDoubleQuotes(16), - NSXMLNodeNeverEscapeContents(32), - NSXMLDocumentTidyHTML(512), - NSXMLDocumentTidyXML(1024), - NSXMLDocumentValidate(8192), - NSXMLNodeLoadExternalEntitiesAlways(16384), - NSXMLNodeLoadExternalEntitiesSameOriginOnly(32768), - NSXMLNodeLoadExternalEntitiesNever(524288), - NSXMLDocumentXInclude(65536), - NSXMLNodePrettyPrint(131072), - NSXMLDocumentIncludeContentTypeDeclaration(262144), - NSXMLNodePreserveNamespaceOrder(1048576), - NSXMLNodePreserveAttributeOrder(2097152), - NSXMLNodePreserveEntities(4194304), - NSXMLNodePreservePrefixes(8388608), - NSXMLNodePreserveCDATA(16777216), - NSXMLNodePreserveWhitespace(33554432), - NSXMLNodePreserveDTD(67108864), - NSXMLNodePreserveCharacterReferences(134217728), - NSXMLNodePromoteSignificantWhitespace(268435456), - NSXMLNodePreserveEmptyElements(6), - NSXMLNodePreserveQuotes(24), - NSXMLNodePreserveAll(4293918750); - - final int value; - const NSXMLNodeOptions(this.value); - - static NSXMLNodeOptions fromValue(int value) => switch (value) { - 0 => NSXMLNodeOptionsNone, - 1 => NSXMLNodeIsCDATA, - 2 => NSXMLNodeExpandEmptyElement, - 4 => NSXMLNodeCompactEmptyElement, - 8 => NSXMLNodeUseSingleQuotes, - 16 => NSXMLNodeUseDoubleQuotes, - 32 => NSXMLNodeNeverEscapeContents, - 512 => NSXMLDocumentTidyHTML, - 1024 => NSXMLDocumentTidyXML, - 8192 => NSXMLDocumentValidate, - 16384 => NSXMLNodeLoadExternalEntitiesAlways, - 32768 => NSXMLNodeLoadExternalEntitiesSameOriginOnly, - 524288 => NSXMLNodeLoadExternalEntitiesNever, - 65536 => NSXMLDocumentXInclude, - 131072 => NSXMLNodePrettyPrint, - 262144 => NSXMLDocumentIncludeContentTypeDeclaration, - 1048576 => NSXMLNodePreserveNamespaceOrder, - 2097152 => NSXMLNodePreserveAttributeOrder, - 4194304 => NSXMLNodePreserveEntities, - 8388608 => NSXMLNodePreservePrefixes, - 16777216 => NSXMLNodePreserveCDATA, - 33554432 => NSXMLNodePreserveWhitespace, - 67108864 => NSXMLNodePreserveDTD, - 134217728 => NSXMLNodePreserveCharacterReferences, - 268435456 => NSXMLNodePromoteSignificantWhitespace, - 6 => NSXMLNodePreserveEmptyElements, - 24 => NSXMLNodePreserveQuotes, - 4293918750 => NSXMLNodePreserveAll, - _ => throw ArgumentError("Unknown value for NSXMLNodeOptions: $value"), - }; -} - -late final _sel_initWithKind_options_ = - objc.registerName("initWithKind:options:"); -final _objc_msgSend_hddv7u = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -late final _sel_document = objc.registerName("document"); -late final _sel_documentWithRootElement_ = - objc.registerName("documentWithRootElement:"); -late final _sel_elementWithName_ = objc.registerName("elementWithName:"); -late final _sel_elementWithName_URI_ = - objc.registerName("elementWithName:URI:"); -late final _sel_elementWithName_stringValue_ = - objc.registerName("elementWithName:stringValue:"); -late final _sel_elementWithName_children_attributes_ = - objc.registerName("elementWithName:children:attributes:"); -late final _sel_attributeWithName_stringValue_ = - objc.registerName("attributeWithName:stringValue:"); -late final _sel_attributeWithName_URI_stringValue_ = - objc.registerName("attributeWithName:URI:stringValue:"); -late final _sel_namespaceWithName_stringValue_ = - objc.registerName("namespaceWithName:stringValue:"); -late final _sel_processingInstructionWithName_stringValue_ = - objc.registerName("processingInstructionWithName:stringValue:"); -late final _sel_commentWithStringValue_ = - objc.registerName("commentWithStringValue:"); -late final _sel_textWithStringValue_ = - objc.registerName("textWithStringValue:"); -late final _sel_DTDNodeWithXMLString_ = - objc.registerName("DTDNodeWithXMLString:"); -final _objc_msgSend_1edk5dx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_objectValue = objc.registerName("objectValue"); -late final _sel_setObjectValue_ = objc.registerName("setObjectValue:"); -late final _sel_stringValue = objc.registerName("stringValue"); -late final _sel_setStringValue_ = objc.registerName("setStringValue:"); -late final _sel_setStringValue_resolvingEntities_ = - objc.registerName("setStringValue:resolvingEntities:"); -late final _sel_index = objc.registerName("index"); -late final _sel_level = objc.registerName("level"); -late final _class_NSXMLDocument = objc.getClass("NSXMLDocument"); -late final _sel_initWithXMLString_options_error_ = - objc.registerName("initWithXMLString:options:error:"); -final _objc_msgSend_1go5rz8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_initWithContentsOfURL_options_error_ = - objc.registerName("initWithContentsOfURL:options:error:"); -late final _sel_initWithData_options_error_ = - objc.registerName("initWithData:options:error:"); -late final _sel_initWithRootElement_ = - objc.registerName("initWithRootElement:"); -late final _sel_replacementClassForClass_ = - objc.registerName("replacementClassForClass:"); -late final _sel_characterEncoding = objc.registerName("characterEncoding"); -late final _sel_setCharacterEncoding_ = - objc.registerName("setCharacterEncoding:"); -late final _sel_setVersion_ = objc.registerName("setVersion:"); -late final _sel_isStandalone = objc.registerName("isStandalone"); -late final _sel_setStandalone_ = objc.registerName("setStandalone:"); - -enum NSXMLDocumentContentKind { - NSXMLDocumentXMLKind(0), - NSXMLDocumentXHTMLKind(1), - NSXMLDocumentHTMLKind(2), - NSXMLDocumentTextKind(3); - - final int value; - const NSXMLDocumentContentKind(this.value); - - static NSXMLDocumentContentKind fromValue(int value) => switch (value) { - 0 => NSXMLDocumentXMLKind, - 1 => NSXMLDocumentXHTMLKind, - 2 => NSXMLDocumentHTMLKind, - 3 => NSXMLDocumentTextKind, - _ => throw ArgumentError( - "Unknown value for NSXMLDocumentContentKind: $value"), - }; -} - -late final _sel_documentContentKind = objc.registerName("documentContentKind"); -final _objc_msgSend_vx3pa9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDocumentContentKind_ = - objc.registerName("setDocumentContentKind:"); -final _objc_msgSend_zmck60 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setMIMEType_ = objc.registerName("setMIMEType:"); -late final _class_NSXMLDTD = objc.getClass("NSXMLDTD"); -late final _sel_setPublicID_ = objc.registerName("setPublicID:"); -late final _sel_setSystemID_ = objc.registerName("setSystemID:"); -late final _sel_insertChild_atIndex_ = - objc.registerName("insertChild:atIndex:"); -late final _sel_insertChildren_atIndex_ = - objc.registerName("insertChildren:atIndex:"); -late final _sel_removeChildAtIndex_ = objc.registerName("removeChildAtIndex:"); -late final _sel_setChildren_ = objc.registerName("setChildren:"); -late final _sel_addChild_ = objc.registerName("addChild:"); -late final _sel_replaceChildAtIndex_withNode_ = - objc.registerName("replaceChildAtIndex:withNode:"); -final _objc_msgSend_1a4j45m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _class_NSXMLDTDNode = objc.getClass("NSXMLDTDNode"); -late final _sel_initWithXMLString_ = objc.registerName("initWithXMLString:"); - -enum NSXMLDTDNodeKind { - NSXMLEntityGeneralKind(1), - NSXMLEntityParsedKind(2), - NSXMLEntityUnparsedKind(3), - NSXMLEntityParameterKind(4), - NSXMLEntityPredefined(5), - NSXMLAttributeCDATAKind(6), - NSXMLAttributeIDKind(7), - NSXMLAttributeIDRefKind(8), - NSXMLAttributeIDRefsKind(9), - NSXMLAttributeEntityKind(10), - NSXMLAttributeEntitiesKind(11), - NSXMLAttributeNMTokenKind(12), - NSXMLAttributeNMTokensKind(13), - NSXMLAttributeEnumerationKind(14), - NSXMLAttributeNotationKind(15), - NSXMLElementDeclarationUndefinedKind(16), - NSXMLElementDeclarationEmptyKind(17), - NSXMLElementDeclarationAnyKind(18), - NSXMLElementDeclarationMixedKind(19), - NSXMLElementDeclarationElementKind(20); - - final int value; - const NSXMLDTDNodeKind(this.value); - - static NSXMLDTDNodeKind fromValue(int value) => switch (value) { - 1 => NSXMLEntityGeneralKind, - 2 => NSXMLEntityParsedKind, - 3 => NSXMLEntityUnparsedKind, - 4 => NSXMLEntityParameterKind, - 5 => NSXMLEntityPredefined, - 6 => NSXMLAttributeCDATAKind, - 7 => NSXMLAttributeIDKind, - 8 => NSXMLAttributeIDRefKind, - 9 => NSXMLAttributeIDRefsKind, - 10 => NSXMLAttributeEntityKind, - 11 => NSXMLAttributeEntitiesKind, - 12 => NSXMLAttributeNMTokenKind, - 13 => NSXMLAttributeNMTokensKind, - 14 => NSXMLAttributeEnumerationKind, - 15 => NSXMLAttributeNotationKind, - 16 => NSXMLElementDeclarationUndefinedKind, - 17 => NSXMLElementDeclarationEmptyKind, - 18 => NSXMLElementDeclarationAnyKind, - 19 => NSXMLElementDeclarationMixedKind, - 20 => NSXMLElementDeclarationElementKind, - _ => throw ArgumentError("Unknown value for NSXMLDTDNodeKind: $value"), - }; -} - -late final _sel_DTDKind = objc.registerName("DTDKind"); -final _objc_msgSend_q8besf = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDTDKind_ = objc.registerName("setDTDKind:"); -final _objc_msgSend_g68b2i = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_isExternal = objc.registerName("isExternal"); -late final _sel_notationName = objc.registerName("notationName"); -late final _sel_setNotationName_ = objc.registerName("setNotationName:"); -late final _sel_localNameForName_ = objc.registerName("localNameForName:"); -late final _sel_prefixForName_ = objc.registerName("prefixForName:"); -late final _sel_predefinedNamespaceForPrefix_ = - objc.registerName("predefinedNamespaceForPrefix:"); - -/// NSXMLDTDNode -class NSXMLDTDNode extends NSXMLNode { - NSXMLDTDNode._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLDTDNode] that points to the same underlying object as [other]. - NSXMLDTDNode.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLDTDNode] that wraps the given raw object pointer. - NSXMLDTDNode.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLDTDNode]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLDTDNode); - } - - /// initWithXMLString: - NSXMLDTDNode? initWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLDTDNode initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// init - NSXMLDTDNode init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// DTDKind - NSXMLDTDNodeKind get DTDKind { - final _ret = _objc_msgSend_q8besf(this.ref.pointer, _sel_DTDKind); - return NSXMLDTDNodeKind.fromValue(_ret); - } - - /// setDTDKind: - set DTDKind(NSXMLDTDNodeKind value) { - return _objc_msgSend_g68b2i( - this.ref.pointer, _sel_setDTDKind_, value.value); - } - - /// isExternal - bool get external1 { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isExternal); - } - - /// publicID - objc.NSString? get publicID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_publicID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPublicID: - set publicID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPublicID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// systemID - objc.NSString? get systemID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_systemID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSystemID: - set systemID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setSystemID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// notationName - objc.NSString? get notationName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_notationName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNotationName: - set notationName(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setNotationName_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// initWithKind: - NSXMLDTDNode initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLDTDNode, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLDTDNode, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTDNode, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTDNode, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_entityDeclarationForName_ = - objc.registerName("entityDeclarationForName:"); -late final _sel_notationDeclarationForName_ = - objc.registerName("notationDeclarationForName:"); -late final _sel_elementDeclarationForName_ = - objc.registerName("elementDeclarationForName:"); -late final _sel_attributeDeclarationForName_elementName_ = - objc.registerName("attributeDeclarationForName:elementName:"); -late final _sel_predefinedEntityDeclarationForName_ = - objc.registerName("predefinedEntityDeclarationForName:"); - -/// NSXMLDTD -class NSXMLDTD extends NSXMLNode { - NSXMLDTD._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLDTD] that points to the same underlying object as [other]. - NSXMLDTD.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLDTD] that wraps the given raw object pointer. - NSXMLDTD.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLDTD]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLDTD); - } - - /// init - NSXMLDTD init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLDTD initWithKind_options_(NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL:options:error: - NSXMLDTD? initWithContentsOfURL_options_error_(objc.NSURL url, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_options_error_, - url.ref.pointer, - mask.value, - error); - return _ret.address == 0 - ? null - : NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithData:options:error: - NSXMLDTD? initWithData_options_error_(objc.NSData data, NSXMLNodeOptions mask, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8(this.ref.retainAndReturnPointer(), - _sel_initWithData_options_error_, data.ref.pointer, mask.value, error); - return _ret.address == 0 - ? null - : NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// publicID - objc.NSString? get publicID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_publicID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPublicID: - set publicID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPublicID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// systemID - objc.NSString? get systemID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_systemID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSystemID: - set systemID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setSystemID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// insertChild:atIndex: - void insertChild_atIndex_(NSXMLNode child, int index) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertChild_atIndex_, child.ref.pointer, index); - } - - /// insertChildren:atIndex: - void insertChildren_atIndex_(objc.NSArray children, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertChildren_atIndex_, - children.ref.pointer, index); - } - - /// removeChildAtIndex: - void removeChildAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeChildAtIndex_, index); - } - - /// setChildren: - void setChildren_(objc.NSArray? children) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildren_, - children?.ref.pointer ?? ffi.nullptr); - } - - /// addChild: - void addChild_(NSXMLNode child) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addChild_, child.ref.pointer); - } - - /// replaceChildAtIndex:withNode: - void replaceChildAtIndex_withNode_(int index, NSXMLNode node) { - _objc_msgSend_1a4j45m(this.ref.pointer, _sel_replaceChildAtIndex_withNode_, - index, node.ref.pointer); - } - - /// entityDeclarationForName: - NSXMLDTDNode? entityDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_entityDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// notationDeclarationForName: - NSXMLDTDNode? notationDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_notationDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// elementDeclarationForName: - NSXMLDTDNode? elementDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_elementDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// attributeDeclarationForName:elementName: - NSXMLDTDNode? attributeDeclarationForName_elementName_( - objc.NSString name, objc.NSString elementName) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_attributeDeclarationForName_elementName_, - name.ref.pointer, - elementName.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedEntityDeclarationForName: - static NSXMLDTDNode? predefinedEntityDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTD, - _sel_predefinedEntityDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithKind: - NSXMLDTD initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLDTD, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLDTD, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTD, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTD, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_DTD = objc.registerName("DTD"); -late final _sel_setDTD_ = objc.registerName("setDTD:"); -late final _sel_setRootElement_ = objc.registerName("setRootElement:"); -late final _sel_rootElement = objc.registerName("rootElement"); -late final _sel_XMLData = objc.registerName("XMLData"); -late final _sel_XMLDataWithOptions_ = objc.registerName("XMLDataWithOptions:"); -final _objc_msgSend_uvkejp = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_objectByApplyingXSLT_arguments_error_ = - objc.registerName("objectByApplyingXSLT:arguments:error:"); -final _objc_msgSend_1lpsn5w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_objectByApplyingXSLTString_arguments_error_ = - objc.registerName("objectByApplyingXSLTString:arguments:error:"); -late final _sel_objectByApplyingXSLTAtURL_arguments_error_ = - objc.registerName("objectByApplyingXSLTAtURL:arguments:error:"); -late final _sel_validateAndReturnError_ = - objc.registerName("validateAndReturnError:"); - -/// NSXMLDocument -class NSXMLDocument extends NSXMLNode { - NSXMLDocument._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLDocument] that points to the same underlying object as [other]. - NSXMLDocument.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLDocument] that wraps the given raw object pointer. - NSXMLDocument.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLDocument]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLDocument); - } - - /// init - NSXMLDocument init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithXMLString:options:error: - NSXMLDocument? initWithXMLString_options_error_(objc.NSString string, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8( - this.ref.retainAndReturnPointer(), - _sel_initWithXMLString_options_error_, - string.ref.pointer, - mask.value, - error); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL:options:error: - NSXMLDocument? initWithContentsOfURL_options_error_(objc.NSURL url, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_options_error_, - url.ref.pointer, - mask.value, - error); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithData:options:error: - NSXMLDocument? initWithData_options_error_(objc.NSData data, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8(this.ref.retainAndReturnPointer(), - _sel_initWithData_options_error_, data.ref.pointer, mask.value, error); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithRootElement: - NSXMLDocument initWithRootElement_(NSXMLElement? element) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithRootElement_, element?.ref.pointer ?? ffi.nullptr); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// replacementClassForClass: - static objc.ObjCObjectBase replacementClassForClass_( - objc.ObjCObjectBase cls) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_replacementClassForClass_, cls.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// characterEncoding - objc.NSString? get characterEncoding { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_characterEncoding); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCharacterEncoding: - set characterEncoding(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCharacterEncoding_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// version - objc.NSString? get version { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_version); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setVersion: - set version(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setVersion_, value?.ref.pointer ?? ffi.nullptr); - } - - /// isStandalone - bool get standalone { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isStandalone); - } - - /// setStandalone: - set standalone(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setStandalone_, value); - } - - /// documentContentKind - NSXMLDocumentContentKind get documentContentKind { - final _ret = - _objc_msgSend_vx3pa9(this.ref.pointer, _sel_documentContentKind); - return NSXMLDocumentContentKind.fromValue(_ret); - } - - /// setDocumentContentKind: - set documentContentKind(NSXMLDocumentContentKind value) { - return _objc_msgSend_zmck60( - this.ref.pointer, _sel_setDocumentContentKind_, value.value); - } - - /// MIMEType - objc.NSString? get MIMEType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_MIMEType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setMIMEType: - set MIMEType(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMIMEType_, value?.ref.pointer ?? ffi.nullptr); - } - - /// DTD - NSXMLDTD? get DTD { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_DTD); - return _ret.address == 0 - ? null - : NSXMLDTD.castFromPointer(_ret, retain: true, release: true); - } - - /// setDTD: - set DTD(NSXMLDTD? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDTD_, value?.ref.pointer ?? ffi.nullptr); - } - - /// setRootElement: - void setRootElement_(NSXMLElement root) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setRootElement_, root.ref.pointer); - } - - /// rootElement - NSXMLElement? rootElement() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootElement); - return _ret.address == 0 - ? null - : NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } - - /// insertChild:atIndex: - void insertChild_atIndex_(NSXMLNode child, int index) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertChild_atIndex_, child.ref.pointer, index); - } - - /// insertChildren:atIndex: - void insertChildren_atIndex_(objc.NSArray children, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertChildren_atIndex_, - children.ref.pointer, index); - } - - /// removeChildAtIndex: - void removeChildAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeChildAtIndex_, index); - } - - /// setChildren: - void setChildren_(objc.NSArray? children) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildren_, - children?.ref.pointer ?? ffi.nullptr); - } - - /// addChild: - void addChild_(NSXMLNode child) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addChild_, child.ref.pointer); - } - - /// replaceChildAtIndex:withNode: - void replaceChildAtIndex_withNode_(int index, NSXMLNode node) { - _objc_msgSend_1a4j45m(this.ref.pointer, _sel_replaceChildAtIndex_withNode_, - index, node.ref.pointer); - } - - /// XMLData - objc.NSData get XMLData { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_XMLData); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// XMLDataWithOptions: - objc.NSData XMLDataWithOptions_(NSXMLNodeOptions options) { - final _ret = _objc_msgSend_uvkejp( - this.ref.pointer, _sel_XMLDataWithOptions_, options.value); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// objectByApplyingXSLT:arguments:error: - objc.ObjCObjectBase? objectByApplyingXSLT_arguments_error_( - objc.NSData xslt, - objc.NSDictionary? arguments, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectByApplyingXSLT_arguments_error_, - xslt.ref.pointer, - arguments?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectByApplyingXSLTString:arguments:error: - objc.ObjCObjectBase? objectByApplyingXSLTString_arguments_error_( - objc.NSString xslt, - objc.NSDictionary? arguments, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectByApplyingXSLTString_arguments_error_, - xslt.ref.pointer, - arguments?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectByApplyingXSLTAtURL:arguments:error: - objc.ObjCObjectBase? objectByApplyingXSLTAtURL_arguments_error_( - objc.NSURL xsltURL, - objc.NSDictionary? argument, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectByApplyingXSLTAtURL_arguments_error_, - xsltURL.ref.pointer, - argument?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// validateAndReturnError: - bool validateAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_validateAndReturnError_, error); - } - - /// initWithKind: - NSXMLDocument initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLDocument initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLDocument, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLDocument, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDocument, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDocument, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_rootDocument = objc.registerName("rootDocument"); -late final _sel_parent = objc.registerName("parent"); -late final _sel_childCount = objc.registerName("childCount"); -late final _sel_children = objc.registerName("children"); -late final _sel_childAtIndex_ = objc.registerName("childAtIndex:"); -late final _sel_previousSibling = objc.registerName("previousSibling"); -late final _sel_nextSibling = objc.registerName("nextSibling"); -late final _sel_previousNode = objc.registerName("previousNode"); -late final _sel_nextNode = objc.registerName("nextNode"); -late final _sel_detach = objc.registerName("detach"); -late final _sel_XPath = objc.registerName("XPath"); -late final _sel_localName = objc.registerName("localName"); -late final _sel_prefix = objc.registerName("prefix"); -late final _sel_URI = objc.registerName("URI"); -late final _sel_setURI_ = objc.registerName("setURI:"); -late final _sel_XMLString = objc.registerName("XMLString"); -late final _sel_XMLStringWithOptions_ = - objc.registerName("XMLStringWithOptions:"); -late final _sel_canonicalXMLStringPreservingComments_ = - objc.registerName("canonicalXMLStringPreservingComments:"); -late final _sel_nodesForXPath_error_ = - objc.registerName("nodesForXPath:error:"); -late final _sel_objectsForXQuery_constants_error_ = - objc.registerName("objectsForXQuery:constants:error:"); -late final _sel_objectsForXQuery_error_ = - objc.registerName("objectsForXQuery:error:"); - -/// NSXMLNode -class NSXMLNode extends objc.NSObject { - NSXMLNode._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLNode] that points to the same underlying object as [other]. - NSXMLNode.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLNode] that wraps the given raw object pointer. - NSXMLNode.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLNode]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLNode); - } - - /// init - NSXMLNode init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind: - NSXMLNode initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLNode initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLNode, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLNode, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLNode, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLNode, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// kind - NSXMLNodeKind get kind { - final _ret = _objc_msgSend_1edk5dx(this.ref.pointer, _sel_kind); - return NSXMLNodeKind.fromValue(_ret); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setName: - set name(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); - } - - /// objectValue - objc.ObjCObjectBase? get objectValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectValue); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setObjectValue: - set objectValue(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setObjectValue_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// stringValue - objc.NSString? get stringValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_stringValue); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setStringValue: - set stringValue(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStringValue_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setStringValue:resolvingEntities: - void setStringValue_resolvingEntities_(objc.NSString string, bool resolve) { - _objc_msgSend_1n1qwdd(this.ref.pointer, - _sel_setStringValue_resolvingEntities_, string.ref.pointer, resolve); - } - - /// index - int get index { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_index); - } - - /// level - int get level { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_level); - } - - /// rootDocument - NSXMLDocument? get rootDocument { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootDocument); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: true, release: true); - } - - /// parent - NSXMLNode? get parent { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_parent); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// childCount - int get childCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_childCount); - } - - /// children - objc.NSArray? get children { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_children); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// childAtIndex: - NSXMLNode? childAtIndex_(int index) { - final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_childAtIndex_, index); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// previousSibling - NSXMLNode? get previousSibling { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_previousSibling); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// nextSibling - NSXMLNode? get nextSibling { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nextSibling); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// previousNode - NSXMLNode? get previousNode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_previousNode); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// nextNode - NSXMLNode? get nextNode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nextNode); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// detach - void detach() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_detach); - } - - /// XPath - objc.NSString? get XPath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_XPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// localName - objc.NSString? get localName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefix - objc.NSString? get prefix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_prefix); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// URI - objc.NSString? get URI { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URI); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setURI: - set URI(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setURI_, value?.ref.pointer ?? ffi.nullptr); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// description - objc.NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// XMLString - objc.NSString get XMLString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_XMLString); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// XMLStringWithOptions: - objc.NSString XMLStringWithOptions_(NSXMLNodeOptions options) { - final _ret = _objc_msgSend_uvkejp( - this.ref.pointer, _sel_XMLStringWithOptions_, options.value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// canonicalXMLStringPreservingComments: - objc.NSString canonicalXMLStringPreservingComments_(bool comments) { - final _ret = _objc_msgSend_1upz917( - this.ref.pointer, _sel_canonicalXMLStringPreservingComments_, comments); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// nodesForXPath:error: - objc.NSArray? nodesForXPath_error_( - objc.NSString xpath, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh( - this.ref.pointer, _sel_nodesForXPath_error_, xpath.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// objectsForXQuery:constants:error: - objc.NSArray? objectsForXQuery_constants_error_( - objc.NSString xquery, - objc.NSDictionary? constants, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectsForXQuery_constants_error_, - xquery.ref.pointer, - constants?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// objectsForXQuery:error: - objc.NSArray? objectsForXQuery_error_( - objc.NSString xquery, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_objectsForXQuery_error_, xquery.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSXMLNode new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_new); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSXMLNode allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSXMLNode, _sel_allocWithZone_, zone); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSXMLNode alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_alloc); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSXMLNode, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSXMLNode, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSXMLNode, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSXMLNode, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLNode, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSXMLNode, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSXMLNode, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLNode, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSXMLNode self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSXMLNode retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSXMLNode autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSXMLElement = objc.getClass("NSXMLElement"); -late final _sel_initWithName_URI_ = objc.registerName("initWithName:URI:"); -late final _sel_initWithName_stringValue_ = - objc.registerName("initWithName:stringValue:"); -late final _sel_initWithXMLString_error_ = - objc.registerName("initWithXMLString:error:"); -late final _sel_elementsForName_ = objc.registerName("elementsForName:"); -late final _sel_elementsForLocalName_URI_ = - objc.registerName("elementsForLocalName:URI:"); -late final _sel_addAttribute_ = objc.registerName("addAttribute:"); -late final _sel_removeAttributeForName_ = - objc.registerName("removeAttributeForName:"); -late final _sel_attributes = objc.registerName("attributes"); -late final _sel_setAttributes_ = objc.registerName("setAttributes:"); -late final _sel_setAttributesWithDictionary_ = - objc.registerName("setAttributesWithDictionary:"); -late final _sel_attributeForName_ = objc.registerName("attributeForName:"); -late final _sel_attributeForLocalName_URI_ = - objc.registerName("attributeForLocalName:URI:"); -late final _sel_addNamespace_ = objc.registerName("addNamespace:"); -late final _sel_removeNamespaceForPrefix_ = - objc.registerName("removeNamespaceForPrefix:"); -late final _sel_namespaces = objc.registerName("namespaces"); -late final _sel_setNamespaces_ = objc.registerName("setNamespaces:"); -late final _sel_namespaceForPrefix_ = objc.registerName("namespaceForPrefix:"); -late final _sel_resolveNamespaceForName_ = - objc.registerName("resolveNamespaceForName:"); -late final _sel_resolvePrefixForNamespaceURI_ = - objc.registerName("resolvePrefixForNamespaceURI:"); -late final _sel_normalizeAdjacentTextNodesPreservingCDATA_ = - objc.registerName("normalizeAdjacentTextNodesPreservingCDATA:"); -late final _sel_setAttributesAsDictionary_ = - objc.registerName("setAttributesAsDictionary:"); - -/// NSXMLElement -class NSXMLElement extends NSXMLNode { - NSXMLElement._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLElement] that points to the same underlying object as [other]. - NSXMLElement.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLElement] that wraps the given raw object pointer. - NSXMLElement.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLElement]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLElement); - } - - /// initWithName: - NSXMLElement initWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithName_, name.ref.pointer); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithName:URI: - NSXMLElement initWithName_URI_(objc.NSString name, objc.NSString? URI) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithName_URI_, - name.ref.pointer, - URI?.ref.pointer ?? ffi.nullptr); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithName:stringValue: - NSXMLElement initWithName_stringValue_( - objc.NSString name, objc.NSString? string) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithName_stringValue_, - name.ref.pointer, - string?.ref.pointer ?? ffi.nullptr); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithXMLString:error: - NSXMLElement? initWithXMLString_error_( - objc.NSString string, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.retainAndReturnPointer(), - _sel_initWithXMLString_error_, string.ref.pointer, error); - return _ret.address == 0 - ? null - : NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLElement initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// elementsForName: - objc.NSArray elementsForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_elementsForName_, name.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// elementsForLocalName:URI: - objc.NSArray elementsForLocalName_URI_( - objc.NSString localName, objc.NSString? URI) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_elementsForLocalName_URI_, - localName.ref.pointer, - URI?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// addAttribute: - void addAttribute_(NSXMLNode attribute) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addAttribute_, attribute.ref.pointer); - } - - /// removeAttributeForName: - void removeAttributeForName_(objc.NSString name) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeAttributeForName_, name.ref.pointer); - } - - /// attributes - objc.NSArray? get attributes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributes); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setAttributes: - set attributes(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAttributes_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setAttributesWithDictionary: - void setAttributesWithDictionary_(objc.NSDictionary attributes) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAttributesWithDictionary_, - attributes.ref.pointer); - } - - /// attributeForName: - NSXMLNode? attributeForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_attributeForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// attributeForLocalName:URI: - NSXMLNode? attributeForLocalName_URI_( - objc.NSString localName, objc.NSString? URI) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_attributeForLocalName_URI_, - localName.ref.pointer, - URI?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// addNamespace: - void addNamespace_(NSXMLNode aNamespace) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addNamespace_, aNamespace.ref.pointer); - } - - /// removeNamespaceForPrefix: - void removeNamespaceForPrefix_(objc.NSString name) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeNamespaceForPrefix_, name.ref.pointer); - } - - /// namespaces - objc.NSArray? get namespaces { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_namespaces); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setNamespaces: - set namespaces(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setNamespaces_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// namespaceForPrefix: - NSXMLNode? namespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_namespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// resolveNamespaceForName: - NSXMLNode? resolveNamespaceForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_resolveNamespaceForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// resolvePrefixForNamespaceURI: - objc.NSString? resolvePrefixForNamespaceURI_(objc.NSString namespaceURI) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_resolvePrefixForNamespaceURI_, namespaceURI.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// insertChild:atIndex: - void insertChild_atIndex_(NSXMLNode child, int index) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertChild_atIndex_, child.ref.pointer, index); - } - - /// insertChildren:atIndex: - void insertChildren_atIndex_(objc.NSArray children, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertChildren_atIndex_, - children.ref.pointer, index); - } - - /// removeChildAtIndex: - void removeChildAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeChildAtIndex_, index); - } - - /// setChildren: - void setChildren_(objc.NSArray? children) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildren_, - children?.ref.pointer ?? ffi.nullptr); - } - - /// addChild: - void addChild_(NSXMLNode child) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addChild_, child.ref.pointer); - } - - /// replaceChildAtIndex:withNode: - void replaceChildAtIndex_withNode_(int index, NSXMLNode node) { - _objc_msgSend_1a4j45m(this.ref.pointer, _sel_replaceChildAtIndex_withNode_, - index, node.ref.pointer); - } - - /// normalizeAdjacentTextNodesPreservingCDATA: - void normalizeAdjacentTextNodesPreservingCDATA_(bool preserve) { - _objc_msgSend_117qins(this.ref.pointer, - _sel_normalizeAdjacentTextNodesPreservingCDATA_, preserve); - } - - /// setAttributesAsDictionary: - void setAttributesAsDictionary_(objc.NSDictionary attributes) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAttributesAsDictionary_, - attributes.ref.pointer); - } - - /// init - NSXMLElement init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind: - NSXMLElement initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLElement, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLElement, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLElement, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLElement, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSXMLElement new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLElement, _sel_new); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSXMLElement allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSXMLElement, _sel_allocWithZone_, zone); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSXMLElement alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLElement, _sel_alloc); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSXMLElement, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSXMLElement, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSXMLElement, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSXMLElement, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSXMLElement, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSXMLElement, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLElement, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLElement, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSXMLElement self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSXMLElement retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSXMLElement autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSHost = objc.getClass("NSHost"); -late final _sel_currentHost = objc.registerName("currentHost"); -late final _sel_hostWithName_ = objc.registerName("hostWithName:"); -late final _sel_hostWithAddress_ = objc.registerName("hostWithAddress:"); -late final _sel_isEqualToHost_ = objc.registerName("isEqualToHost:"); -late final _sel_names = objc.registerName("names"); -late final _sel_address = objc.registerName("address"); -late final _sel_localizedName = objc.registerName("localizedName"); -late final _sel_setHostCacheEnabled_ = - objc.registerName("setHostCacheEnabled:"); -late final _sel_isHostCacheEnabled = objc.registerName("isHostCacheEnabled"); -late final _sel_flushHostCache = objc.registerName("flushHostCache"); - -/// NSHost -class NSHost extends objc.NSObject { - NSHost._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSHost] that points to the same underlying object as [other]. - NSHost.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSHost] that wraps the given raw object pointer. - NSHost.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSHost]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSHost); - } - - /// currentHost - static NSHost currentHost() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHost, _sel_currentHost); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// hostWithName: - static NSHost hostWithName_(objc.NSString? name) { - final _ret = _objc_msgSend_juohf7( - _class_NSHost, _sel_hostWithName_, name?.ref.pointer ?? ffi.nullptr); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// hostWithAddress: - static NSHost hostWithAddress_(objc.NSString address) { - final _ret = _objc_msgSend_juohf7( - _class_NSHost, _sel_hostWithAddress_, address.ref.pointer); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// isEqualToHost: - bool isEqualToHost_(NSHost aHost) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToHost_, aHost.ref.pointer); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// names - objc.NSArray get names { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_names); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// address - objc.NSString? get address { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_address); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addresses - objc.NSArray get addresses { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_addresses); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedName - objc.NSString? get localizedName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setHostCacheEnabled: - static void setHostCacheEnabled_(bool flag) { - _objc_msgSend_117qins(_class_NSHost, _sel_setHostCacheEnabled_, flag); - } - - /// isHostCacheEnabled - static bool isHostCacheEnabled() { - return _objc_msgSend_olxnu1(_class_NSHost, _sel_isHostCacheEnabled); - } - - /// flushHostCache - static void flushHostCache() { - _objc_msgSend_ksby9f(_class_NSHost, _sel_flushHostCache); - } - - /// init - NSHost init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSHost new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHost, _sel_new); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSHost allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSHost, _sel_allocWithZone_, zone); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSHost alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHost, _sel_alloc); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSHost, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSHost, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSHost, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSHost, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSHost, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSHost, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSHost, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHost, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSHost, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSHost self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSHost retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSHost autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSClassDescription = objc.getClass("NSClassDescription"); -late final _sel_registerClassDescription_forClass_ = - objc.registerName("registerClassDescription:forClass:"); -late final _sel_invalidateClassDescriptionCache = - objc.registerName("invalidateClassDescriptionCache"); -late final _sel_classDescriptionForClass_ = - objc.registerName("classDescriptionForClass:"); -late final _sel_attributeKeys = objc.registerName("attributeKeys"); -late final _sel_toOneRelationshipKeys = - objc.registerName("toOneRelationshipKeys"); -late final _sel_toManyRelationshipKeys = - objc.registerName("toManyRelationshipKeys"); -late final _sel_inverseForRelationshipKey_ = - objc.registerName("inverseForRelationshipKey:"); - -/// NSClassDescription -class NSClassDescription extends objc.NSObject { - NSClassDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSClassDescription] that points to the same underlying object as [other]. - NSClassDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSClassDescription] that wraps the given raw object pointer. - NSClassDescription.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSClassDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSClassDescription); - } - - /// registerClassDescription:forClass: - static void registerClassDescription_forClass_( - NSClassDescription description, objc.ObjCObjectBase aClass) { - _objc_msgSend_1tjlcwl( - _class_NSClassDescription, - _sel_registerClassDescription_forClass_, - description.ref.pointer, - aClass.ref.pointer); - } - - /// invalidateClassDescriptionCache - static void invalidateClassDescriptionCache() { - _objc_msgSend_ksby9f( - _class_NSClassDescription, _sel_invalidateClassDescriptionCache); - } - - /// classDescriptionForClass: - static NSClassDescription? classDescriptionForClass_( - objc.ObjCObjectBase aClass) { - final _ret = _objc_msgSend_juohf7(_class_NSClassDescription, - _sel_classDescriptionForClass_, aClass.ref.pointer); - return _ret.address == 0 - ? null - : NSClassDescription.castFromPointer(_ret, retain: true, release: true); - } - - /// attributeKeys - objc.NSArray get attributeKeys { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributeKeys); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// toOneRelationshipKeys - objc.NSArray get toOneRelationshipKeys { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_toOneRelationshipKeys); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// toManyRelationshipKeys - objc.NSArray get toManyRelationshipKeys { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_toManyRelationshipKeys); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// inverseForRelationshipKey: - objc.NSString? inverseForRelationshipKey_(objc.NSString relationshipKey) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_inverseForRelationshipKey_, relationshipKey.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSClassDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSClassDescription new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSClassDescription, _sel_new); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSClassDescription allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSClassDescription, _sel_allocWithZone_, zone); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSClassDescription alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSClassDescription, _sel_alloc); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSClassDescription, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSClassDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSClassDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSClassDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSClassDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSClassDescription, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSClassDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSScriptClassDescription = - objc.getClass("NSScriptClassDescription"); -late final _sel_initWithSuiteName_className_dictionary_ = - objc.registerName("initWithSuiteName:className:dictionary:"); -late final _sel_suiteName = objc.registerName("suiteName"); -late final _sel_className = objc.registerName("className"); -late final _sel_implementationClassName = - objc.registerName("implementationClassName"); -late final _sel_superclassDescription = - objc.registerName("superclassDescription"); -late final _sel_appleEventCode = objc.registerName("appleEventCode"); -final _objc_msgSend_dzloj4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_matchesAppleEventCode_ = - objc.registerName("matchesAppleEventCode:"); -final _objc_msgSend_1n8vqu1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _class_NSScriptCommandDescription = - objc.getClass("NSScriptCommandDescription"); -late final _sel_initWithSuiteName_commandName_dictionary_ = - objc.registerName("initWithSuiteName:commandName:dictionary:"); -late final _sel_commandName = objc.registerName("commandName"); -late final _sel_appleEventClassCode = objc.registerName("appleEventClassCode"); -late final _sel_commandClassName = objc.registerName("commandClassName"); -late final _sel_returnType = objc.registerName("returnType"); -late final _sel_appleEventCodeForReturnType = - objc.registerName("appleEventCodeForReturnType"); -late final _sel_argumentNames = objc.registerName("argumentNames"); -late final _sel_typeForArgumentWithName_ = - objc.registerName("typeForArgumentWithName:"); -late final _sel_appleEventCodeForArgumentWithName_ = - objc.registerName("appleEventCodeForArgumentWithName:"); -final _objc_msgSend_t2sarz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isOptionalArgumentWithName_ = - objc.registerName("isOptionalArgumentWithName:"); -late final _class_NSScriptCommand = objc.getClass("NSScriptCommand"); -late final _sel_initWithCommandDescription_ = - objc.registerName("initWithCommandDescription:"); -late final _sel_commandDescription = objc.registerName("commandDescription"); -late final _sel_directParameter = objc.registerName("directParameter"); -late final _sel_setDirectParameter_ = objc.registerName("setDirectParameter:"); -late final _class_NSScriptObjectSpecifier = - objc.getClass("NSScriptObjectSpecifier"); -late final _class_NSAppleEventDescriptor = - objc.getClass("NSAppleEventDescriptor"); -late final _sel_nullDescriptor = objc.registerName("nullDescriptor"); -late final _sel_descriptorWithDescriptorType_bytes_length_ = - objc.registerName("descriptorWithDescriptorType:bytes:length:"); -final _objc_msgSend_unctjf = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, ffi.Pointer, int)>(); -late final _sel_descriptorWithDescriptorType_data_ = - objc.registerName("descriptorWithDescriptorType:data:"); -final _objc_msgSend_1k5vjgv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_descriptorWithBoolean_ = - objc.registerName("descriptorWithBoolean:"); -late final _sel_descriptorWithEnumCode_ = - objc.registerName("descriptorWithEnumCode:"); -late final _sel_descriptorWithInt32_ = - objc.registerName("descriptorWithInt32:"); -late final _sel_descriptorWithDouble_ = - objc.registerName("descriptorWithDouble:"); -late final _sel_descriptorWithTypeCode_ = - objc.registerName("descriptorWithTypeCode:"); -late final _sel_descriptorWithString_ = - objc.registerName("descriptorWithString:"); -late final _sel_descriptorWithDate_ = objc.registerName("descriptorWithDate:"); -late final _sel_descriptorWithFileURL_ = - objc.registerName("descriptorWithFileURL:"); -late final _sel_appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID_ = - objc.registerName( - "appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:"); -final _objc_msgSend_1iwlq4o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.UnsignedInt, - ffi.Pointer, - ffi.Short, - ffi.Int)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - int, - int)>(); -late final _sel_listDescriptor = objc.registerName("listDescriptor"); -late final _sel_recordDescriptor = objc.registerName("recordDescriptor"); -late final _sel_currentProcessDescriptor = - objc.registerName("currentProcessDescriptor"); -late final _sel_descriptorWithProcessIdentifier_ = - objc.registerName("descriptorWithProcessIdentifier:"); -late final _sel_descriptorWithBundleIdentifier_ = - objc.registerName("descriptorWithBundleIdentifier:"); -late final _sel_descriptorWithApplicationURL_ = - objc.registerName("descriptorWithApplicationURL:"); - -final class OpaqueAEDataStorageType extends ffi.Opaque {} - -@ffi.Packed(2) -final class AEDesc extends ffi.Struct { - @ffi.UnsignedInt() - external int descriptorType; - - external ffi.Pointer> dataHandle; -} - -late final _sel_initWithAEDescNoCopy_ = - objc.registerName("initWithAEDescNoCopy:"); -final _objc_msgSend_10xxpbh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_initWithDescriptorType_bytes_length_ = - objc.registerName("initWithDescriptorType:bytes:length:"); -late final _sel_initWithDescriptorType_data_ = - objc.registerName("initWithDescriptorType:data:"); -late final _sel_initWithEventClass_eventID_targetDescriptor_returnID_transactionID_ = - objc.registerName( - "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:"); -late final _sel_initListDescriptor = objc.registerName("initListDescriptor"); -late final _sel_initRecordDescriptor = - objc.registerName("initRecordDescriptor"); -late final _sel_aeDesc = objc.registerName("aeDesc"); -final _objc_msgSend_jg6irx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_descriptorType = objc.registerName("descriptorType"); -late final _sel_booleanValue = objc.registerName("booleanValue"); -final _objc_msgSend_1cswds = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedChar Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_enumCodeValue = objc.registerName("enumCodeValue"); -late final _sel_int32Value = objc.registerName("int32Value"); -late final _sel_typeCodeValue = objc.registerName("typeCodeValue"); -late final _sel_dateValue = objc.registerName("dateValue"); -late final _sel_fileURLValue = objc.registerName("fileURLValue"); -late final _sel_eventClass = objc.registerName("eventClass"); -late final _sel_eventID = objc.registerName("eventID"); -late final _sel_returnID = objc.registerName("returnID"); -late final _sel_transactionID = objc.registerName("transactionID"); -late final _sel_setParamDescriptor_forKeyword_ = - objc.registerName("setParamDescriptor:forKeyword:"); -final _objc_msgSend_1dzwu6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_paramDescriptorForKeyword_ = - objc.registerName("paramDescriptorForKeyword:"); -late final _sel_removeParamDescriptorWithKeyword_ = - objc.registerName("removeParamDescriptorWithKeyword:"); -final _objc_msgSend_l6g8fv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setAttributeDescriptor_forKeyword_ = - objc.registerName("setAttributeDescriptor:forKeyword:"); -late final _sel_attributeDescriptorForKeyword_ = - objc.registerName("attributeDescriptorForKeyword:"); - -enum NSAppleEventSendOptions { - NSAppleEventSendNoReply(1), - NSAppleEventSendQueueReply(2), - NSAppleEventSendWaitForReply(3), - NSAppleEventSendNeverInteract(16), - NSAppleEventSendCanInteract(32), - NSAppleEventSendAlwaysInteract(48), - NSAppleEventSendCanSwitchLayer(64), - NSAppleEventSendDontRecord(4096), - NSAppleEventSendDontExecute(8192), - NSAppleEventSendDontAnnotate(65536), - NSAppleEventSendDefaultOptions(35); - - final int value; - const NSAppleEventSendOptions(this.value); - - static NSAppleEventSendOptions fromValue(int value) => switch (value) { - 1 => NSAppleEventSendNoReply, - 2 => NSAppleEventSendQueueReply, - 3 => NSAppleEventSendWaitForReply, - 16 => NSAppleEventSendNeverInteract, - 32 => NSAppleEventSendCanInteract, - 48 => NSAppleEventSendAlwaysInteract, - 64 => NSAppleEventSendCanSwitchLayer, - 4096 => NSAppleEventSendDontRecord, - 8192 => NSAppleEventSendDontExecute, - 65536 => NSAppleEventSendDontAnnotate, - 35 => NSAppleEventSendDefaultOptions, - _ => throw ArgumentError( - "Unknown value for NSAppleEventSendOptions: $value"), - }; -} - -late final _sel_sendEventWithOptions_timeout_error_ = - objc.registerName("sendEventWithOptions:timeout:error:"); -final _objc_msgSend_19xj9w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Double, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - double, - ffi.Pointer>)>(); -late final _sel_isRecordDescriptor = objc.registerName("isRecordDescriptor"); -late final _sel_numberOfItems = objc.registerName("numberOfItems"); -late final _sel_insertDescriptor_atIndex_ = - objc.registerName("insertDescriptor:atIndex:"); -final _objc_msgSend_da94db = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_descriptorAtIndex_ = objc.registerName("descriptorAtIndex:"); -late final _sel_removeDescriptorAtIndex_ = - objc.registerName("removeDescriptorAtIndex:"); -late final _sel_setDescriptor_forKeyword_ = - objc.registerName("setDescriptor:forKeyword:"); -late final _sel_descriptorForKeyword_ = - objc.registerName("descriptorForKeyword:"); -late final _sel_removeDescriptorWithKeyword_ = - objc.registerName("removeDescriptorWithKeyword:"); -late final _sel_keywordForDescriptorAtIndex_ = - objc.registerName("keywordForDescriptorAtIndex:"); -final _objc_msgSend_hkgvph = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_coerceToDescriptorType_ = - objc.registerName("coerceToDescriptorType:"); - -/// NSAppleEventDescriptor -class NSAppleEventDescriptor extends objc.NSObject { - NSAppleEventDescriptor._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSAppleEventDescriptor] that points to the same underlying object as [other]. - NSAppleEventDescriptor.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSAppleEventDescriptor] that wraps the given raw object pointer. - NSAppleEventDescriptor.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSAppleEventDescriptor]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSAppleEventDescriptor); - } - - /// nullDescriptor - static NSAppleEventDescriptor nullDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_nullDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDescriptorType:bytes:length: - static NSAppleEventDescriptor? descriptorWithDescriptorType_bytes_length_( - int descriptorType, ffi.Pointer bytes, int byteCount) { - final _ret = _objc_msgSend_unctjf( - _class_NSAppleEventDescriptor, - _sel_descriptorWithDescriptorType_bytes_length_, - descriptorType, - bytes, - byteCount); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDescriptorType:data: - static NSAppleEventDescriptor? descriptorWithDescriptorType_data_( - int descriptorType, objc.NSData? data) { - final _ret = _objc_msgSend_1k5vjgv( - _class_NSAppleEventDescriptor, - _sel_descriptorWithDescriptorType_data_, - descriptorType, - data?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithBoolean: - static NSAppleEventDescriptor descriptorWithBoolean_(int boolean) { - final _ret = _objc_msgSend_1ar9f5m( - _class_NSAppleEventDescriptor, _sel_descriptorWithBoolean_, boolean); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithEnumCode: - static NSAppleEventDescriptor descriptorWithEnumCode_(int enumerator) { - final _ret = _objc_msgSend_pxgym4(_class_NSAppleEventDescriptor, - _sel_descriptorWithEnumCode_, enumerator); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithInt32: - static NSAppleEventDescriptor descriptorWithInt32_(int signedInt) { - final _ret = _objc_msgSend_105o5we( - _class_NSAppleEventDescriptor, _sel_descriptorWithInt32_, signedInt); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDouble: - static NSAppleEventDescriptor descriptorWithDouble_(double doubleValue) { - final _ret = _objc_msgSend_m7jc8y( - _class_NSAppleEventDescriptor, _sel_descriptorWithDouble_, doubleValue); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithTypeCode: - static NSAppleEventDescriptor descriptorWithTypeCode_(int typeCode) { - final _ret = _objc_msgSend_pxgym4( - _class_NSAppleEventDescriptor, _sel_descriptorWithTypeCode_, typeCode); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithString: - static NSAppleEventDescriptor descriptorWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithString_, string.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDate: - static NSAppleEventDescriptor descriptorWithDate_(objc.NSDate date) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithDate_, date.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithFileURL: - static NSAppleEventDescriptor descriptorWithFileURL_(objc.NSURL fileURL) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithFileURL_, fileURL.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID: - static NSAppleEventDescriptor - appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID_( - int eventClass, - int eventID, - NSAppleEventDescriptor? targetDescriptor, - int returnID, - int transactionID) { - final _ret = _objc_msgSend_1iwlq4o( - _class_NSAppleEventDescriptor, - _sel_appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID_, - eventClass, - eventID, - targetDescriptor?.ref.pointer ?? ffi.nullptr, - returnID, - transactionID); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// listDescriptor - static NSAppleEventDescriptor listDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_listDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// recordDescriptor - static NSAppleEventDescriptor recordDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_recordDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// currentProcessDescriptor - static NSAppleEventDescriptor currentProcessDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_currentProcessDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithProcessIdentifier: - static NSAppleEventDescriptor descriptorWithProcessIdentifier_( - int processIdentifier) { - final _ret = _objc_msgSend_105o5we(_class_NSAppleEventDescriptor, - _sel_descriptorWithProcessIdentifier_, processIdentifier); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithBundleIdentifier: - static NSAppleEventDescriptor descriptorWithBundleIdentifier_( - objc.NSString bundleIdentifier) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithBundleIdentifier_, bundleIdentifier.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithApplicationURL: - static NSAppleEventDescriptor descriptorWithApplicationURL_( - objc.NSURL applicationURL) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithApplicationURL_, applicationURL.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithAEDescNoCopy: - NSAppleEventDescriptor initWithAEDescNoCopy_(ffi.Pointer aeDesc) { - final _ret = _objc_msgSend_10xxpbh( - this.ref.retainAndReturnPointer(), _sel_initWithAEDescNoCopy_, aeDesc); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithDescriptorType:bytes:length: - NSAppleEventDescriptor? initWithDescriptorType_bytes_length_( - int descriptorType, ffi.Pointer bytes, int byteCount) { - final _ret = _objc_msgSend_unctjf( - this.ref.retainAndReturnPointer(), - _sel_initWithDescriptorType_bytes_length_, - descriptorType, - bytes, - byteCount); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithDescriptorType:data: - NSAppleEventDescriptor? initWithDescriptorType_data_( - int descriptorType, objc.NSData? data) { - final _ret = _objc_msgSend_1k5vjgv( - this.ref.retainAndReturnPointer(), - _sel_initWithDescriptorType_data_, - descriptorType, - data?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithEventClass:eventID:targetDescriptor:returnID:transactionID: - NSAppleEventDescriptor - initWithEventClass_eventID_targetDescriptor_returnID_transactionID_( - int eventClass, - int eventID, - NSAppleEventDescriptor? targetDescriptor, - int returnID, - int transactionID) { - final _ret = _objc_msgSend_1iwlq4o( - this.ref.retainAndReturnPointer(), - _sel_initWithEventClass_eventID_targetDescriptor_returnID_transactionID_, - eventClass, - eventID, - targetDescriptor?.ref.pointer ?? ffi.nullptr, - returnID, - transactionID); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initListDescriptor - NSAppleEventDescriptor initListDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.retainAndReturnPointer(), _sel_initListDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initRecordDescriptor - NSAppleEventDescriptor initRecordDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.retainAndReturnPointer(), _sel_initRecordDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// aeDesc - ffi.Pointer get aeDesc { - return _objc_msgSend_jg6irx(this.ref.pointer, _sel_aeDesc); - } - - /// descriptorType - int get descriptorType { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_descriptorType); - } - - /// data - objc.NSData get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// booleanValue - int get booleanValue { - return _objc_msgSend_1cswds(this.ref.pointer, _sel_booleanValue); - } - - /// enumCodeValue - int get enumCodeValue { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_enumCodeValue); - } - - /// int32Value - int get int32Value { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_int32Value); - } - - /// doubleValue - double get doubleValue { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_doubleValue) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_doubleValue); - } - - /// typeCodeValue - int get typeCodeValue { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_typeCodeValue); - } - - /// stringValue - objc.NSString? get stringValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_stringValue); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dateValue - objc.NSDate? get dateValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dateValue); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// fileURLValue - objc.NSURL? get fileURLValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileURLValue); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// eventClass - int get eventClass { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_eventClass); - } - - /// eventID - int get eventID { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_eventID); - } - - /// returnID - int get returnID { - return _objc_msgSend_157j54x(this.ref.pointer, _sel_returnID); - } - - /// transactionID - int get transactionID { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_transactionID); - } - - /// setParamDescriptor:forKeyword: - void setParamDescriptor_forKeyword_( - NSAppleEventDescriptor descriptor, int keyword) { - _objc_msgSend_1dzwu6(this.ref.pointer, _sel_setParamDescriptor_forKeyword_, - descriptor.ref.pointer, keyword); - } - - /// paramDescriptorForKeyword: - NSAppleEventDescriptor? paramDescriptorForKeyword_(int keyword) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_paramDescriptorForKeyword_, keyword); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeParamDescriptorWithKeyword: - void removeParamDescriptorWithKeyword_(int keyword) { - _objc_msgSend_l6g8fv( - this.ref.pointer, _sel_removeParamDescriptorWithKeyword_, keyword); - } - - /// setAttributeDescriptor:forKeyword: - void setAttributeDescriptor_forKeyword_( - NSAppleEventDescriptor descriptor, int keyword) { - _objc_msgSend_1dzwu6( - this.ref.pointer, - _sel_setAttributeDescriptor_forKeyword_, - descriptor.ref.pointer, - keyword); - } - - /// attributeDescriptorForKeyword: - NSAppleEventDescriptor? attributeDescriptorForKeyword_(int keyword) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_attributeDescriptorForKeyword_, keyword); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// sendEventWithOptions:timeout:error: - NSAppleEventDescriptor? sendEventWithOptions_timeout_error_( - NSAppleEventSendOptions sendOptions, - double timeoutInSeconds, - ffi.Pointer> error) { - final _ret = _objc_msgSend_19xj9w( - this.ref.pointer, - _sel_sendEventWithOptions_timeout_error_, - sendOptions.value, - timeoutInSeconds, - error); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// isRecordDescriptor - bool get isRecordDescriptor { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isRecordDescriptor); - } - - /// numberOfItems - int get numberOfItems { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_numberOfItems); - } - - /// insertDescriptor:atIndex: - void insertDescriptor_atIndex_(NSAppleEventDescriptor descriptor, int index) { - _objc_msgSend_da94db(this.ref.pointer, _sel_insertDescriptor_atIndex_, - descriptor.ref.pointer, index); - } - - /// descriptorAtIndex: - NSAppleEventDescriptor? descriptorAtIndex_(int index) { - final _ret = - _objc_msgSend_crtxa9(this.ref.pointer, _sel_descriptorAtIndex_, index); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeDescriptorAtIndex: - void removeDescriptorAtIndex_(int index) { - _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_removeDescriptorAtIndex_, index); - } - - /// setDescriptor:forKeyword: - void setDescriptor_forKeyword_( - NSAppleEventDescriptor descriptor, int keyword) { - _objc_msgSend_1dzwu6(this.ref.pointer, _sel_setDescriptor_forKeyword_, - descriptor.ref.pointer, keyword); - } - - /// descriptorForKeyword: - NSAppleEventDescriptor? descriptorForKeyword_(int keyword) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_descriptorForKeyword_, keyword); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeDescriptorWithKeyword: - void removeDescriptorWithKeyword_(int keyword) { - _objc_msgSend_l6g8fv( - this.ref.pointer, _sel_removeDescriptorWithKeyword_, keyword); - } - - /// keywordForDescriptorAtIndex: - int keywordForDescriptorAtIndex_(int index) { - return _objc_msgSend_hkgvph( - this.ref.pointer, _sel_keywordForDescriptorAtIndex_, index); - } - - /// coerceToDescriptorType: - NSAppleEventDescriptor? coerceToDescriptorType_(int descriptorType) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_coerceToDescriptorType_, descriptorType); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSAppleEventDescriptor init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSAppleEventDescriptor new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSAppleEventDescriptor, _sel_new); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSAppleEventDescriptor allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSAppleEventDescriptor, _sel_allocWithZone_, zone); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSAppleEventDescriptor alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSAppleEventDescriptor, _sel_alloc); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSAppleEventDescriptor, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSAppleEventDescriptor, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSAppleEventDescriptor, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSAppleEventDescriptor, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSAppleEventDescriptor, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSAppleEventDescriptor, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSAppleEventDescriptor, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSAppleEventDescriptor? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_objectSpecifierWithDescriptor_ = - objc.registerName("objectSpecifierWithDescriptor:"); -late final _sel_initWithContainerSpecifier_key_ = - objc.registerName("initWithContainerSpecifier:key:"); -late final _sel_initWithContainerClassDescription_containerSpecifier_key_ = objc - .registerName("initWithContainerClassDescription:containerSpecifier:key:"); -late final _sel_childSpecifier = objc.registerName("childSpecifier"); -late final _sel_setChildSpecifier_ = objc.registerName("setChildSpecifier:"); -late final _sel_containerSpecifier = objc.registerName("containerSpecifier"); -late final _sel_setContainerSpecifier_ = - objc.registerName("setContainerSpecifier:"); -late final _sel_containerIsObjectBeingTested = - objc.registerName("containerIsObjectBeingTested"); -late final _sel_setContainerIsObjectBeingTested_ = - objc.registerName("setContainerIsObjectBeingTested:"); -late final _sel_containerIsRangeContainerObject = - objc.registerName("containerIsRangeContainerObject"); -late final _sel_setContainerIsRangeContainerObject_ = - objc.registerName("setContainerIsRangeContainerObject:"); -late final _sel_key = objc.registerName("key"); -late final _sel_setKey_ = objc.registerName("setKey:"); -late final _sel_containerClassDescription = - objc.registerName("containerClassDescription"); -late final _sel_setContainerClassDescription_ = - objc.registerName("setContainerClassDescription:"); -late final _sel_keyClassDescription = objc.registerName("keyClassDescription"); -late final _sel_indicesOfObjectsByEvaluatingWithContainer_count_ = - objc.registerName("indicesOfObjectsByEvaluatingWithContainer:count:"); -final _objc_msgSend_1e2yezv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_objectsByEvaluatingWithContainers_ = - objc.registerName("objectsByEvaluatingWithContainers:"); -late final _sel_objectsByEvaluatingSpecifier = - objc.registerName("objectsByEvaluatingSpecifier"); -late final _sel_evaluationErrorNumber = - objc.registerName("evaluationErrorNumber"); -late final _sel_setEvaluationErrorNumber_ = - objc.registerName("setEvaluationErrorNumber:"); -late final _sel_evaluationErrorSpecifier = - objc.registerName("evaluationErrorSpecifier"); -late final _sel_descriptor = objc.registerName("descriptor"); - -/// NSScriptObjectSpecifier -class NSScriptObjectSpecifier extends objc.NSObject { - NSScriptObjectSpecifier._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptObjectSpecifier] that points to the same underlying object as [other]. - NSScriptObjectSpecifier.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptObjectSpecifier] that wraps the given raw object pointer. - NSScriptObjectSpecifier.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptObjectSpecifier]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScriptObjectSpecifier); - } - - /// objectSpecifierWithDescriptor: - static NSScriptObjectSpecifier? objectSpecifierWithDescriptor_( - NSAppleEventDescriptor descriptor) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptObjectSpecifier, - _sel_objectSpecifierWithDescriptor_, descriptor.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithContainerSpecifier:key: - NSScriptObjectSpecifier initWithContainerSpecifier_key_( - NSScriptObjectSpecifier container, objc.NSString property) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithContainerSpecifier_key_, - container.ref.pointer, - property.ref.pointer); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithContainerClassDescription:containerSpecifier:key: - NSScriptObjectSpecifier - initWithContainerClassDescription_containerSpecifier_key_( - NSScriptClassDescription classDesc, - NSScriptObjectSpecifier? container, - objc.NSString property) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithContainerClassDescription_containerSpecifier_key_, - classDesc.ref.pointer, - container?.ref.pointer ?? ffi.nullptr, - property.ref.pointer); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithCoder: - NSScriptObjectSpecifier? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// childSpecifier - NSScriptObjectSpecifier? get childSpecifier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_childSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// setChildSpecifier: - set childSpecifier(NSScriptObjectSpecifier? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildSpecifier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// containerSpecifier - NSScriptObjectSpecifier? get containerSpecifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_containerSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// setContainerSpecifier: - set containerSpecifier(NSScriptObjectSpecifier? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setContainerSpecifier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// containerIsObjectBeingTested - bool get containerIsObjectBeingTested { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_containerIsObjectBeingTested); - } - - /// setContainerIsObjectBeingTested: - set containerIsObjectBeingTested(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setContainerIsObjectBeingTested_, value); - } - - /// containerIsRangeContainerObject - bool get containerIsRangeContainerObject { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_containerIsRangeContainerObject); - } - - /// setContainerIsRangeContainerObject: - set containerIsRangeContainerObject(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setContainerIsRangeContainerObject_, value); - } - - /// key - objc.NSString get key { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_key); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setKey: - set key(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setKey_, value.ref.pointer); - } - - /// containerClassDescription - NSScriptClassDescription? get containerClassDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_containerClassDescription); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setContainerClassDescription: - set containerClassDescription(NSScriptClassDescription? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setContainerClassDescription_, value?.ref.pointer ?? ffi.nullptr); - } - - /// keyClassDescription - NSScriptClassDescription? get keyClassDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_keyClassDescription); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// indicesOfObjectsByEvaluatingWithContainer:count: - ffi.Pointer indicesOfObjectsByEvaluatingWithContainer_count_( - objc.ObjCObjectBase container, ffi.Pointer count) { - return _objc_msgSend_1e2yezv( - this.ref.pointer, - _sel_indicesOfObjectsByEvaluatingWithContainer_count_, - container.ref.pointer, - count); - } - - /// objectsByEvaluatingWithContainers: - objc.ObjCObjectBase? objectsByEvaluatingWithContainers_( - objc.ObjCObjectBase containers) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_objectsByEvaluatingWithContainers_, containers.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectsByEvaluatingSpecifier - objc.ObjCObjectBase? get objectsByEvaluatingSpecifier { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_objectsByEvaluatingSpecifier); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// evaluationErrorNumber - int get evaluationErrorNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_evaluationErrorNumber); - } - - /// setEvaluationErrorNumber: - set evaluationErrorNumber(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setEvaluationErrorNumber_, value); - } - - /// evaluationErrorSpecifier - NSScriptObjectSpecifier? get evaluationErrorSpecifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_evaluationErrorSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptor - NSAppleEventDescriptor? get descriptor { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_descriptor); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSScriptObjectSpecifier init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSScriptObjectSpecifier new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptObjectSpecifier, _sel_new); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSScriptObjectSpecifier allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptObjectSpecifier, _sel_allocWithZone_, zone); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSScriptObjectSpecifier alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptObjectSpecifier, _sel_alloc); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptObjectSpecifier, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptObjectSpecifier, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScriptObjectSpecifier, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSScriptObjectSpecifier, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptObjectSpecifier, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptObjectSpecifier, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptObjectSpecifier, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptObjectSpecifier, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptObjectSpecifier, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_receiversSpecifier = objc.registerName("receiversSpecifier"); -late final _sel_setReceiversSpecifier_ = - objc.registerName("setReceiversSpecifier:"); -late final _sel_evaluatedReceivers = objc.registerName("evaluatedReceivers"); -late final _sel_evaluatedArguments = objc.registerName("evaluatedArguments"); -late final _sel_isWellFormed = objc.registerName("isWellFormed"); -late final _sel_performDefaultImplementation = - objc.registerName("performDefaultImplementation"); -late final _sel_executeCommand = objc.registerName("executeCommand"); -late final _sel_scriptErrorNumber = objc.registerName("scriptErrorNumber"); -late final _sel_setScriptErrorNumber_ = - objc.registerName("setScriptErrorNumber:"); -late final _sel_scriptErrorOffendingObjectDescriptor = - objc.registerName("scriptErrorOffendingObjectDescriptor"); -late final _sel_setScriptErrorOffendingObjectDescriptor_ = - objc.registerName("setScriptErrorOffendingObjectDescriptor:"); -late final _sel_scriptErrorExpectedTypeDescriptor = - objc.registerName("scriptErrorExpectedTypeDescriptor"); -late final _sel_setScriptErrorExpectedTypeDescriptor_ = - objc.registerName("setScriptErrorExpectedTypeDescriptor:"); -late final _sel_scriptErrorString = objc.registerName("scriptErrorString"); -late final _sel_setScriptErrorString_ = - objc.registerName("setScriptErrorString:"); -late final _sel_currentCommand = objc.registerName("currentCommand"); -late final _sel_appleEvent = objc.registerName("appleEvent"); -late final _sel_suspendExecution = objc.registerName("suspendExecution"); -late final _sel_resumeExecutionWithResult_ = - objc.registerName("resumeExecutionWithResult:"); - -/// NSScriptCommand -class NSScriptCommand extends objc.NSObject { - NSScriptCommand._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptCommand] that points to the same underlying object as [other]. - NSScriptCommand.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptCommand] that wraps the given raw object pointer. - NSScriptCommand.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptCommand]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScriptCommand); - } - - /// initWithCommandDescription: - NSScriptCommand initWithCommandDescription_( - NSScriptCommandDescription commandDef) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCommandDescription_, commandDef.ref.pointer); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSScriptCommand? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// commandDescription - NSScriptCommandDescription get commandDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commandDescription); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// directParameter - objc.ObjCObjectBase? get directParameter { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_directParameter); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDirectParameter: - set directParameter(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDirectParameter_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// receiversSpecifier - NSScriptObjectSpecifier? get receiversSpecifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_receiversSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// setReceiversSpecifier: - set receiversSpecifier(NSScriptObjectSpecifier? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setReceiversSpecifier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// evaluatedReceivers - objc.ObjCObjectBase? get evaluatedReceivers { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_evaluatedReceivers); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// arguments - objc.NSDictionary? get arguments { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_arguments); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setArguments: - set arguments(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setArguments_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// evaluatedArguments - objc.NSDictionary? get evaluatedArguments { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_evaluatedArguments); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// isWellFormed - bool get wellFormed { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isWellFormed); - } - - /// performDefaultImplementation - objc.ObjCObjectBase? performDefaultImplementation() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_performDefaultImplementation); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// executeCommand - objc.ObjCObjectBase? executeCommand() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executeCommand); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// scriptErrorNumber - int get scriptErrorNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_scriptErrorNumber); - } - - /// setScriptErrorNumber: - set scriptErrorNumber(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setScriptErrorNumber_, value); - } - - /// scriptErrorOffendingObjectDescriptor - NSAppleEventDescriptor? get scriptErrorOffendingObjectDescriptor { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_scriptErrorOffendingObjectDescriptor); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// setScriptErrorOffendingObjectDescriptor: - set scriptErrorOffendingObjectDescriptor(NSAppleEventDescriptor? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setScriptErrorOffendingObjectDescriptor_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// scriptErrorExpectedTypeDescriptor - NSAppleEventDescriptor? get scriptErrorExpectedTypeDescriptor { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_scriptErrorExpectedTypeDescriptor); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// setScriptErrorExpectedTypeDescriptor: - set scriptErrorExpectedTypeDescriptor(NSAppleEventDescriptor? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setScriptErrorExpectedTypeDescriptor_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// scriptErrorString - objc.NSString? get scriptErrorString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_scriptErrorString); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setScriptErrorString: - set scriptErrorString(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setScriptErrorString_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// currentCommand - static NSScriptCommand? currentCommand() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptCommand, _sel_currentCommand); - return _ret.address == 0 - ? null - : NSScriptCommand.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEvent - NSAppleEventDescriptor? get appleEvent { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_appleEvent); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// suspendExecution - void suspendExecution() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_suspendExecution); - } - - /// resumeExecutionWithResult: - void resumeExecutionWithResult_(objc.ObjCObjectBase? result) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_resumeExecutionWithResult_, - result?.ref.pointer ?? ffi.nullptr); - } - - /// init - NSScriptCommand init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSScriptCommand new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScriptCommand, _sel_new); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSScriptCommand allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptCommand, _sel_allocWithZone_, zone); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSScriptCommand alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScriptCommand, _sel_alloc); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptCommand, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptCommand, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScriptCommand, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSScriptCommand, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptCommand, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptCommand, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptCommand, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommand, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommand, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_createCommandInstance = - objc.registerName("createCommandInstance"); -late final _sel_createCommandInstanceWithZone_ = - objc.registerName("createCommandInstanceWithZone:"); - -/// NSScriptCommandDescription -class NSScriptCommandDescription extends objc.NSObject { - NSScriptCommandDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptCommandDescription] that points to the same underlying object as [other]. - NSScriptCommandDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptCommandDescription] that wraps the given raw object pointer. - NSScriptCommandDescription.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptCommandDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_NSScriptCommandDescription); - } - - /// init - NSScriptCommandDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithSuiteName:commandName:dictionary: - NSScriptCommandDescription? initWithSuiteName_commandName_dictionary_( - objc.NSString suiteName, - objc.NSString commandName, - objc.NSDictionary? commandDeclaration) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithSuiteName_commandName_dictionary_, - suiteName.ref.pointer, - commandName.ref.pointer, - commandDeclaration?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithCoder: - NSScriptCommandDescription? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// suiteName - objc.NSString get suiteName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suiteName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// commandName - objc.NSString get commandName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commandName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEventClassCode - int get appleEventClassCode { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_appleEventClassCode); - } - - /// appleEventCode - int get appleEventCode { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_appleEventCode); - } - - /// commandClassName - objc.NSString get commandClassName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commandClassName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// returnType - objc.NSString? get returnType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_returnType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEventCodeForReturnType - int get appleEventCodeForReturnType { - return _objc_msgSend_dzloj4( - this.ref.pointer, _sel_appleEventCodeForReturnType); - } - - /// argumentNames - objc.NSArray get argumentNames { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_argumentNames); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// typeForArgumentWithName: - objc.NSString? typeForArgumentWithName_(objc.NSString argumentName) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_typeForArgumentWithName_, argumentName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEventCodeForArgumentWithName: - int appleEventCodeForArgumentWithName_(objc.NSString argumentName) { - return _objc_msgSend_t2sarz(this.ref.pointer, - _sel_appleEventCodeForArgumentWithName_, argumentName.ref.pointer); - } - - /// isOptionalArgumentWithName: - bool isOptionalArgumentWithName_(objc.NSString argumentName) { - return _objc_msgSend_l8lotg(this.ref.pointer, - _sel_isOptionalArgumentWithName_, argumentName.ref.pointer); - } - - /// createCommandInstance - NSScriptCommand createCommandInstance() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_createCommandInstance); - return NSScriptCommand.castFromPointer(_ret, retain: true, release: true); - } - - /// createCommandInstanceWithZone: - NSScriptCommand createCommandInstanceWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - this.ref.pointer, _sel_createCommandInstanceWithZone_, zone); - return NSScriptCommand.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSScriptCommandDescription new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptCommandDescription, _sel_new); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSScriptCommandDescription allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptCommandDescription, _sel_allocWithZone_, zone); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSScriptCommandDescription alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptCommandDescription, _sel_alloc); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptCommandDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptCommandDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_NSScriptCommandDescription, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSScriptCommandDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptCommandDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptCommandDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptCommandDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommandDescription, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommandDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_supportsCommand_ = objc.registerName("supportsCommand:"); -late final _sel_selectorForCommand_ = objc.registerName("selectorForCommand:"); -final _objc_msgSend_1fdwx8i = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_typeForKey_ = objc.registerName("typeForKey:"); -late final _sel_classDescriptionForKey_ = - objc.registerName("classDescriptionForKey:"); -late final _sel_appleEventCodeForKey_ = - objc.registerName("appleEventCodeForKey:"); -late final _sel_keyWithAppleEventCode_ = - objc.registerName("keyWithAppleEventCode:"); -late final _sel_defaultSubcontainerAttributeKey = - objc.registerName("defaultSubcontainerAttributeKey"); -late final _sel_isLocationRequiredToCreateForKey_ = - objc.registerName("isLocationRequiredToCreateForKey:"); -late final _sel_hasPropertyForKey_ = objc.registerName("hasPropertyForKey:"); -late final _sel_hasOrderedToManyRelationshipForKey_ = - objc.registerName("hasOrderedToManyRelationshipForKey:"); -late final _sel_hasReadablePropertyForKey_ = - objc.registerName("hasReadablePropertyForKey:"); -late final _sel_hasWritablePropertyForKey_ = - objc.registerName("hasWritablePropertyForKey:"); -late final _sel_isReadOnlyKey_ = objc.registerName("isReadOnlyKey:"); - -/// NSScriptClassDescription -class NSScriptClassDescription extends NSClassDescription { - NSScriptClassDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptClassDescription] that points to the same underlying object as [other]. - NSScriptClassDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptClassDescription] that wraps the given raw object pointer. - NSScriptClassDescription.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptClassDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScriptClassDescription); - } - - /// classDescriptionForClass: - static NSClassDescription? classDescriptionForClass_( - objc.ObjCObjectBase aClass) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptClassDescription, - _sel_classDescriptionForClass_, aClass.ref.pointer); - return _ret.address == 0 - ? null - : NSClassDescription.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithSuiteName:className:dictionary: - NSScriptClassDescription? initWithSuiteName_className_dictionary_( - objc.NSString suiteName, - objc.NSString className, - objc.NSDictionary? classDeclaration) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithSuiteName_className_dictionary_, - suiteName.ref.pointer, - className.ref.pointer, - classDeclaration?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// suiteName - objc.NSString? get suiteName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suiteName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// className - objc.NSString? get className { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_className); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// implementationClassName - objc.NSString? get implementationClassName { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_implementationClassName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// superclassDescription - NSScriptClassDescription? get superclassDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_superclassDescription); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// appleEventCode - int get appleEventCode { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_appleEventCode); - } - - /// matchesAppleEventCode: - bool matchesAppleEventCode_(int appleEventCode) { - return _objc_msgSend_1n8vqu1( - this.ref.pointer, _sel_matchesAppleEventCode_, appleEventCode); - } - - /// supportsCommand: - bool supportsCommand_(NSScriptCommandDescription commandDescription) { - return _objc_msgSend_l8lotg(this.ref.pointer, _sel_supportsCommand_, - commandDescription.ref.pointer); - } - - /// selectorForCommand: - ffi.Pointer selectorForCommand_( - NSScriptCommandDescription commandDescription) { - return _objc_msgSend_1fdwx8i(this.ref.pointer, _sel_selectorForCommand_, - commandDescription.ref.pointer); - } - - /// typeForKey: - objc.NSString? typeForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_typeForKey_, key.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// classDescriptionForKey: - NSScriptClassDescription? classDescriptionForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_classDescriptionForKey_, key.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// appleEventCodeForKey: - int appleEventCodeForKey_(objc.NSString key) { - return _objc_msgSend_t2sarz( - this.ref.pointer, _sel_appleEventCodeForKey_, key.ref.pointer); - } - - /// keyWithAppleEventCode: - objc.NSString? keyWithAppleEventCode_(int appleEventCode) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_keyWithAppleEventCode_, appleEventCode); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultSubcontainerAttributeKey - objc.NSString? get defaultSubcontainerAttributeKey { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_defaultSubcontainerAttributeKey); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isLocationRequiredToCreateForKey: - bool isLocationRequiredToCreateForKey_(objc.NSString toManyRelationshipKey) { - return _objc_msgSend_l8lotg( - this.ref.pointer, - _sel_isLocationRequiredToCreateForKey_, - toManyRelationshipKey.ref.pointer); - } - - /// hasPropertyForKey: - bool hasPropertyForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasPropertyForKey_, key.ref.pointer); - } - - /// hasOrderedToManyRelationshipForKey: - bool hasOrderedToManyRelationshipForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(this.ref.pointer, - _sel_hasOrderedToManyRelationshipForKey_, key.ref.pointer); - } - - /// hasReadablePropertyForKey: - bool hasReadablePropertyForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasReadablePropertyForKey_, key.ref.pointer); - } - - /// hasWritablePropertyForKey: - bool hasWritablePropertyForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasWritablePropertyForKey_, key.ref.pointer); - } - - /// isReadOnlyKey: - bool isReadOnlyKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isReadOnlyKey_, key.ref.pointer); - } - - /// registerClassDescription:forClass: - static void registerClassDescription_forClass_( - NSClassDescription description, objc.ObjCObjectBase aClass) { - _objc_msgSend_1tjlcwl( - _class_NSScriptClassDescription, - _sel_registerClassDescription_forClass_, - description.ref.pointer, - aClass.ref.pointer); - } - - /// invalidateClassDescriptionCache - static void invalidateClassDescriptionCache() { - _objc_msgSend_ksby9f( - _class_NSScriptClassDescription, _sel_invalidateClassDescriptionCache); - } - - /// init - NSScriptClassDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSScriptClassDescription new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptClassDescription, _sel_new); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSScriptClassDescription allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptClassDescription, _sel_allocWithZone_, zone); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSScriptClassDescription alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptClassDescription, _sel_alloc); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScriptClassDescription, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSScriptClassDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptClassDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptClassDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptClassDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptClassDescription, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptClassDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_AVAudioSession = objc.getClass("AVAudioSession"); -late final _sel_sharedInstance = objc.registerName("sharedInstance"); -late final _sel_availableCategories = objc.registerName("availableCategories"); -late final _sel_setCategory_error_ = objc.registerName("setCategory:error:"); - -enum AVAudioSessionCategoryOptions { - AVAudioSessionCategoryOptionMixWithOthers(1), - AVAudioSessionCategoryOptionDuckOthers(2), - AVAudioSessionCategoryOptionAllowBluetooth(4), - AVAudioSessionCategoryOptionDefaultToSpeaker(8), - AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers(17), - AVAudioSessionCategoryOptionAllowBluetoothA2DP(32), - AVAudioSessionCategoryOptionAllowAirPlay(64), - AVAudioSessionCategoryOptionOverrideMutedMicrophoneInterruption(128); - - final int value; - const AVAudioSessionCategoryOptions(this.value); - - static AVAudioSessionCategoryOptions fromValue(int value) => switch (value) { - 1 => AVAudioSessionCategoryOptionMixWithOthers, - 2 => AVAudioSessionCategoryOptionDuckOthers, - 4 => AVAudioSessionCategoryOptionAllowBluetooth, - 8 => AVAudioSessionCategoryOptionDefaultToSpeaker, - 17 => AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers, - 32 => AVAudioSessionCategoryOptionAllowBluetoothA2DP, - 64 => AVAudioSessionCategoryOptionAllowAirPlay, - 128 => AVAudioSessionCategoryOptionOverrideMutedMicrophoneInterruption, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionCategoryOptions: $value"), - }; -} - -late final _sel_setCategory_withOptions_error_ = - objc.registerName("setCategory:withOptions:error:"); -final _objc_msgSend_1qqeo92 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_setCategory_mode_options_error_ = - objc.registerName("setCategory:mode:options:error:"); -final _objc_msgSend_1w2nczj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); - -enum AVAudioSessionRouteSharingPolicy { - AVAudioSessionRouteSharingPolicyDefault(0), - AVAudioSessionRouteSharingPolicyLongFormAudio(1), - AVAudioSessionRouteSharingPolicyIndependent(2), - AVAudioSessionRouteSharingPolicyLongFormVideo(3); - - static const AVAudioSessionRouteSharingPolicyLongForm = - AVAudioSessionRouteSharingPolicyLongFormAudio; - - final int value; - const AVAudioSessionRouteSharingPolicy(this.value); - - static AVAudioSessionRouteSharingPolicy fromValue(int value) => - switch (value) { - 0 => AVAudioSessionRouteSharingPolicyDefault, - 1 => AVAudioSessionRouteSharingPolicyLongFormAudio, - 2 => AVAudioSessionRouteSharingPolicyIndependent, - 3 => AVAudioSessionRouteSharingPolicyLongFormVideo, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionRouteSharingPolicy: $value"), - }; - - @override - String toString() { - if (this == AVAudioSessionRouteSharingPolicyLongFormAudio) - return "AVAudioSessionRouteSharingPolicy.AVAudioSessionRouteSharingPolicyLongFormAudio, AVAudioSessionRouteSharingPolicy.AVAudioSessionRouteSharingPolicyLongForm"; - return super.toString(); - } -} - -late final _sel_setCategory_mode_routeSharingPolicy_options_error_ = - objc.registerName("setCategory:mode:routeSharingPolicy:options:error:"); -final _objc_msgSend_3ejcy4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer>)>(); -late final _sel_category = objc.registerName("category"); -late final _sel_categoryOptions = objc.registerName("categoryOptions"); -final _objc_msgSend_ulkd0k = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_routeSharingPolicy = objc.registerName("routeSharingPolicy"); -final _objc_msgSend_11368np = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_availableModes = objc.registerName("availableModes"); -late final _sel_setMode_error_ = objc.registerName("setMode:error:"); -late final _sel_mode = objc.registerName("mode"); -late final _sel_setAllowHapticsAndSystemSoundsDuringRecording_error_ = - objc.registerName("setAllowHapticsAndSystemSoundsDuringRecording:error:"); -final _objc_msgSend_1867uf2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer>)>(); -late final _sel_allowHapticsAndSystemSoundsDuringRecording = - objc.registerName("allowHapticsAndSystemSoundsDuringRecording"); - -enum AVAudioSessionRecordPermission { - AVAudioSessionRecordPermissionUndetermined(1970168948), - AVAudioSessionRecordPermissionDenied(1684369017), - AVAudioSessionRecordPermissionGranted(1735552628); - - final int value; - const AVAudioSessionRecordPermission(this.value); - - static AVAudioSessionRecordPermission fromValue(int value) => switch (value) { - 1970168948 => AVAudioSessionRecordPermissionUndetermined, - 1684369017 => AVAudioSessionRecordPermissionDenied, - 1735552628 => AVAudioSessionRecordPermissionGranted, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionRecordPermission: $value"), - }; -} - -late final _sel_recordPermission = objc.registerName("recordPermission"); -final _objc_msgSend_qybqeg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_requestRecordPermission_ = - objc.registerName("requestRecordPermission:"); - -enum AVAudioSessionPortOverride { - AVAudioSessionPortOverrideNone(0), - AVAudioSessionPortOverrideSpeaker(1936747378); - - final int value; - const AVAudioSessionPortOverride(this.value); - - static AVAudioSessionPortOverride fromValue(int value) => switch (value) { - 0 => AVAudioSessionPortOverrideNone, - 1936747378 => AVAudioSessionPortOverrideSpeaker, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionPortOverride: $value"), - }; -} - -late final _sel_overrideOutputAudioPort_error_ = - objc.registerName("overrideOutputAudioPort:error:"); -final _objc_msgSend_pcgmhk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _class_AVAudioSessionPortDescription = - objc.getClass("AVAudioSessionPortDescription"); -late final _sel_portType = objc.registerName("portType"); -late final _sel_portName = objc.registerName("portName"); -late final _sel_UID = objc.registerName("UID"); -late final _sel_hasHardwareVoiceCallProcessing = - objc.registerName("hasHardwareVoiceCallProcessing"); -late final _sel_isSpatialAudioEnabled = - objc.registerName("isSpatialAudioEnabled"); -late final _sel_channels = objc.registerName("channels"); -late final _sel_dataSources = objc.registerName("dataSources"); -late final _class_AVAudioSessionDataSourceDescription = - objc.getClass("AVAudioSessionDataSourceDescription"); -late final _sel_dataSourceID = objc.registerName("dataSourceID"); -late final _sel_dataSourceName = objc.registerName("dataSourceName"); -late final _sel_location = objc.registerName("location"); -late final _sel_orientation = objc.registerName("orientation"); -late final _sel_supportedPolarPatterns = - objc.registerName("supportedPolarPatterns"); -late final _sel_selectedPolarPattern = - objc.registerName("selectedPolarPattern"); -late final _sel_preferredPolarPattern = - objc.registerName("preferredPolarPattern"); -late final _sel_setPreferredPolarPattern_error_ = - objc.registerName("setPreferredPolarPattern:error:"); - -/// AVAudioSessionDataSourceDescription -class AVAudioSessionDataSourceDescription extends objc.NSObject { - AVAudioSessionDataSourceDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [AVAudioSessionDataSourceDescription] that points to the same underlying object as [other]. - AVAudioSessionDataSourceDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [AVAudioSessionDataSourceDescription] that wraps the given raw object pointer. - AVAudioSessionDataSourceDescription.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [AVAudioSessionDataSourceDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_AVAudioSessionDataSourceDescription); - } - - /// dataSourceID - objc.NSNumber get dataSourceID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dataSourceID); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// dataSourceName - objc.NSString get dataSourceName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dataSourceName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// location - objc.NSString? get location { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_location); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// orientation - objc.NSString? get orientation { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_orientation); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// supportedPolarPatterns - objc.NSArray? get supportedPolarPatterns { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_supportedPolarPatterns); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// selectedPolarPattern - objc.NSString? get selectedPolarPattern { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_selectedPolarPattern); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// preferredPolarPattern - objc.NSString? get preferredPolarPattern { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredPolarPattern); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPreferredPolarPattern:error: - bool setPreferredPolarPattern_error_(objc.NSString? pattern, - ffi.Pointer> outError) { - return _objc_msgSend_p02k6o( - this.ref.pointer, - _sel_setPreferredPolarPattern_error_, - pattern?.ref.pointer ?? ffi.nullptr, - outError); - } - - /// init - AVAudioSessionDataSourceDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static AVAudioSessionDataSourceDescription new1() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionDataSourceDescription, _sel_new); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static AVAudioSessionDataSourceDescription allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_AVAudioSessionDataSourceDescription, _sel_allocWithZone_, zone); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static AVAudioSessionDataSourceDescription alloc() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionDataSourceDescription, _sel_alloc); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioSessionDataSourceDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioSessionDataSourceDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_AVAudioSessionDataSourceDescription, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_AVAudioSessionDataSourceDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - _class_AVAudioSessionDataSourceDescription, - _sel_keyPathsForValuesAffectingValueForKey_, - key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioSessionDataSourceDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioSessionDataSourceDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionDataSourceDescription, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionDataSourceDescription, - _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - AVAudioSessionDataSourceDescription self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - AVAudioSessionDataSourceDescription retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - AVAudioSessionDataSourceDescription autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_selectedDataSource = objc.registerName("selectedDataSource"); -late final _sel_preferredDataSource = objc.registerName("preferredDataSource"); -late final _sel_setPreferredDataSource_error_ = - objc.registerName("setPreferredDataSource:error:"); - -/// AVAudioSessionPortDescription -class AVAudioSessionPortDescription extends objc.NSObject { - AVAudioSessionPortDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [AVAudioSessionPortDescription] that points to the same underlying object as [other]. - AVAudioSessionPortDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [AVAudioSessionPortDescription] that wraps the given raw object pointer. - AVAudioSessionPortDescription.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [AVAudioSessionPortDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_AVAudioSessionPortDescription); - } - - /// portType - objc.NSString get portType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_portType); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// portName - objc.NSString get portName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_portName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// UID - objc.NSString get UID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_UID); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// hasHardwareVoiceCallProcessing - bool get hasHardwareVoiceCallProcessing { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_hasHardwareVoiceCallProcessing); - } - - /// isSpatialAudioEnabled - bool get spatialAudioEnabled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSpatialAudioEnabled); - } - - /// channels - objc.NSArray? get channels { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_channels); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// dataSources - objc.NSArray? get dataSources { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dataSources); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// selectedDataSource - AVAudioSessionDataSourceDescription? get selectedDataSource { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_selectedDataSource); - return _ret.address == 0 - ? null - : AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// preferredDataSource - AVAudioSessionDataSourceDescription? get preferredDataSource { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredDataSource); - return _ret.address == 0 - ? null - : AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setPreferredDataSource:error: - bool setPreferredDataSource_error_( - AVAudioSessionDataSourceDescription? dataSource, - ffi.Pointer> outError) { - return _objc_msgSend_p02k6o( - this.ref.pointer, - _sel_setPreferredDataSource_error_, - dataSource?.ref.pointer ?? ffi.nullptr, - outError); - } - - /// init - AVAudioSessionPortDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static AVAudioSessionPortDescription new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_AVAudioSessionPortDescription, _sel_new); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static AVAudioSessionPortDescription allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_AVAudioSessionPortDescription, _sel_allocWithZone_, zone); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static AVAudioSessionPortDescription alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_AVAudioSessionPortDescription, _sel_alloc); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioSessionPortDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioSessionPortDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_AVAudioSessionPortDescription, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_AVAudioSessionPortDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_AVAudioSessionPortDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioSessionPortDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioSessionPortDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioSessionPortDescription, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionPortDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - AVAudioSessionPortDescription self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - AVAudioSessionPortDescription retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - AVAudioSessionPortDescription autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return AVAudioSessionPortDescription.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_setPreferredInput_error_ = - objc.registerName("setPreferredInput:error:"); -late final _sel_preferredInput = objc.registerName("preferredInput"); -late final _sel_setPrefersNoInterruptionsFromSystemAlerts_error_ = - objc.registerName("setPrefersNoInterruptionsFromSystemAlerts:error:"); -late final _sel_prefersNoInterruptionsFromSystemAlerts = - objc.registerName("prefersNoInterruptionsFromSystemAlerts"); -late final _sel_setActive_error_ = objc.registerName("setActive:error:"); - -enum AVAudioSessionSetActiveOptions { - AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation(1); - - final int value; - const AVAudioSessionSetActiveOptions(this.value); - - static AVAudioSessionSetActiveOptions fromValue(int value) => switch (value) { - 1 => AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionSetActiveOptions: $value"), - }; -} - -late final _sel_setActive_withOptions_error_ = - objc.registerName("setActive:withOptions:error:"); -final _objc_msgSend_ydjcyk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - bool, - int, - ffi.Pointer>)>(); - -enum AVAudioSessionActivationOptions { - AVAudioSessionActivationOptionNone(0); - - final int value; - const AVAudioSessionActivationOptions(this.value); - - static AVAudioSessionActivationOptions fromValue(int value) => - switch (value) { - 0 => AVAudioSessionActivationOptionNone, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionActivationOptions: $value"), - }; -} - -void _ObjCBlock_ffiVoid_bool_NSError_fnPtrTrampoline( - ffi.Pointer block, - bool arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Bool arg0, ffi.Pointer arg1)>>() - .asFunction)>()( - arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_bool_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_bool_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_bool_NSError_closureTrampoline( - ffi.Pointer block, - bool arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function( - bool, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_bool_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_bool_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_bool_NSError_listenerTrampoline( - ffi.Pointer block, - bool arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - bool, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, ffi.Bool, - ffi.Pointer)> - _ObjCBlock_ffiVoid_bool_NSError_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, ffi.Bool, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_bool_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_bool_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Bool arg0, ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_bool_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(bool, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_bool_NSError_closureCallable, - (bool arg0, ffi.Pointer arg1) => fn( - arg0, - arg1.address == 0 - ? null - : objc.NSError.castFromPointer(arg1, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(bool, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_bool_NSError_listenerCallable.nativeFunction.cast(), - (bool arg0, ffi.Pointer arg1) => fn( - arg0, - arg1.address == 0 - ? null - : objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1ej8563(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_bool_NSError_CallExtension - on objc.ObjCBlock { - void call(bool arg0, objc.NSError? arg1) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Bool arg0, ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, bool, - ffi.Pointer)>()( - ref.pointer, arg0, arg1?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_activateWithOptions_completionHandler_ = - objc.registerName("activateWithOptions:completionHandler:"); -final _objc_msgSend_1igkhc3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_setPreferredSampleRate_error_ = - objc.registerName("setPreferredSampleRate:error:"); -final _objc_msgSend_1kh8jgt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer>)>(); -late final _sel_preferredSampleRate = objc.registerName("preferredSampleRate"); -late final _sel_setPreferredIOBufferDuration_error_ = - objc.registerName("setPreferredIOBufferDuration:error:"); -late final _sel_preferredIOBufferDuration = - objc.registerName("preferredIOBufferDuration"); -late final _sel_setPreferredInputNumberOfChannels_error_ = - objc.registerName("setPreferredInputNumberOfChannels:error:"); -final _objc_msgSend_1395fec = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_preferredInputNumberOfChannels = - objc.registerName("preferredInputNumberOfChannels"); -late final _sel_setPreferredOutputNumberOfChannels_error_ = - objc.registerName("setPreferredOutputNumberOfChannels:error:"); -late final _sel_preferredOutputNumberOfChannels = - objc.registerName("preferredOutputNumberOfChannels"); - -enum AVAudioStereoOrientation { - AVAudioStereoOrientationNone(0), - AVAudioStereoOrientationPortrait(1), - AVAudioStereoOrientationPortraitUpsideDown(2), - AVAudioStereoOrientationLandscapeRight(3), - AVAudioStereoOrientationLandscapeLeft(4); - - final int value; - const AVAudioStereoOrientation(this.value); - - static AVAudioStereoOrientation fromValue(int value) => switch (value) { - 0 => AVAudioStereoOrientationNone, - 1 => AVAudioStereoOrientationPortrait, - 2 => AVAudioStereoOrientationPortraitUpsideDown, - 3 => AVAudioStereoOrientationLandscapeRight, - 4 => AVAudioStereoOrientationLandscapeLeft, - _ => throw ArgumentError( - "Unknown value for AVAudioStereoOrientation: $value"), - }; -} - -late final _sel_setPreferredInputOrientation_error_ = - objc.registerName("setPreferredInputOrientation:error:"); -final _objc_msgSend_1ehfmir = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_preferredInputOrientation = - objc.registerName("preferredInputOrientation"); -final _objc_msgSend_16ckc9k = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_inputOrientation = objc.registerName("inputOrientation"); -late final _sel_maximumInputNumberOfChannels = - objc.registerName("maximumInputNumberOfChannels"); -late final _sel_maximumOutputNumberOfChannels = - objc.registerName("maximumOutputNumberOfChannels"); -late final _sel_setInputGain_error_ = objc.registerName("setInputGain:error:"); -final _objc_msgSend_yujz92 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Float, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer>)>(); -late final _sel_inputGain = objc.registerName("inputGain"); -late final _sel_isInputGainSettable = objc.registerName("isInputGainSettable"); -late final _sel_isInputAvailable = objc.registerName("isInputAvailable"); -late final _sel_inputDataSources = objc.registerName("inputDataSources"); -late final _sel_inputDataSource = objc.registerName("inputDataSource"); -late final _sel_setInputDataSource_error_ = - objc.registerName("setInputDataSource:error:"); -late final _sel_outputDataSources = objc.registerName("outputDataSources"); -late final _sel_outputDataSource = objc.registerName("outputDataSource"); -late final _sel_setOutputDataSource_error_ = - objc.registerName("setOutputDataSource:error:"); -late final _sel_sampleRate = objc.registerName("sampleRate"); -late final _sel_inputNumberOfChannels = - objc.registerName("inputNumberOfChannels"); -late final _sel_outputNumberOfChannels = - objc.registerName("outputNumberOfChannels"); -late final _sel_inputLatency = objc.registerName("inputLatency"); -late final _sel_outputLatency = objc.registerName("outputLatency"); -late final _sel_IOBufferDuration = objc.registerName("IOBufferDuration"); -late final _sel_isOtherAudioPlaying = objc.registerName("isOtherAudioPlaying"); -late final _sel_secondaryAudioShouldBeSilencedHint = - objc.registerName("secondaryAudioShouldBeSilencedHint"); -late final _sel_outputVolume = objc.registerName("outputVolume"); - -enum AVAudioSessionPromptStyle { - AVAudioSessionPromptStyleNone(1852796517), - AVAudioSessionPromptStyleShort(1936224884), - AVAudioSessionPromptStyleNormal(1852992876); - - final int value; - const AVAudioSessionPromptStyle(this.value); - - static AVAudioSessionPromptStyle fromValue(int value) => switch (value) { - 1852796517 => AVAudioSessionPromptStyleNone, - 1936224884 => AVAudioSessionPromptStyleShort, - 1852992876 => AVAudioSessionPromptStyleNormal, - _ => throw ArgumentError( - "Unknown value for AVAudioSessionPromptStyle: $value"), - }; -} - -late final _sel_promptStyle = objc.registerName("promptStyle"); -final _objc_msgSend_xgzkcr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_availableInputs = objc.registerName("availableInputs"); -late final _class_AVAudioSessionRouteDescription = - objc.getClass("AVAudioSessionRouteDescription"); -late final _sel_inputs = objc.registerName("inputs"); -late final _sel_outputs = objc.registerName("outputs"); - -/// AVAudioSessionRouteDescription -class AVAudioSessionRouteDescription extends objc.NSObject { - AVAudioSessionRouteDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [AVAudioSessionRouteDescription] that points to the same underlying object as [other]. - AVAudioSessionRouteDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [AVAudioSessionRouteDescription] that wraps the given raw object pointer. - AVAudioSessionRouteDescription.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [AVAudioSessionRouteDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_AVAudioSessionRouteDescription); - } - - /// inputs - objc.NSArray get inputs { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_inputs); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// outputs - objc.NSArray get outputs { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_outputs); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// init - AVAudioSessionRouteDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static AVAudioSessionRouteDescription new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_AVAudioSessionRouteDescription, _sel_new); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static AVAudioSessionRouteDescription allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_AVAudioSessionRouteDescription, _sel_allocWithZone_, zone); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static AVAudioSessionRouteDescription alloc() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionRouteDescription, _sel_alloc); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioSessionRouteDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioSessionRouteDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_AVAudioSessionRouteDescription, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_AVAudioSessionRouteDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_AVAudioSessionRouteDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioSessionRouteDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioSessionRouteDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioSessionRouteDescription, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSessionRouteDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - AVAudioSessionRouteDescription self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - AVAudioSessionRouteDescription retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - AVAudioSessionRouteDescription autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_currentRoute = objc.registerName("currentRoute"); - -enum AVAudioSessionIOType { - AVAudioSessionIOTypeNotSpecified(0), - AVAudioSessionIOTypeAggregated(1); - - final int value; - const AVAudioSessionIOType(this.value); - - static AVAudioSessionIOType fromValue(int value) => switch (value) { - 0 => AVAudioSessionIOTypeNotSpecified, - 1 => AVAudioSessionIOTypeAggregated, - _ => - throw ArgumentError("Unknown value for AVAudioSessionIOType: $value"), - }; -} - -late final _sel_setAggregatedIOPreference_error_ = - objc.registerName("setAggregatedIOPreference:error:"); -final _objc_msgSend_vsrn59 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_setSupportsMultichannelContent_error_ = - objc.registerName("setSupportsMultichannelContent:error:"); -late final _sel_supportsMultichannelContent = - objc.registerName("supportsMultichannelContent"); -late final _sel_setPrefersInterruptionOnRouteDisconnect_error_ = - objc.registerName("setPrefersInterruptionOnRouteDisconnect:error:"); -late final _sel_prefersInterruptionOnRouteDisconnect = - objc.registerName("prefersInterruptionOnRouteDisconnect"); -late final _sel_setActive_withFlags_error_ = - objc.registerName("setActive:withFlags:error:"); -final _objc_msgSend_11f9fnx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Long, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - bool, - int, - ffi.Pointer>)>(); -late final _sel_inputIsAvailable = objc.registerName("inputIsAvailable"); -late final _sel_currentHardwareSampleRate = - objc.registerName("currentHardwareSampleRate"); -late final _sel_currentHardwareInputNumberOfChannels = - objc.registerName("currentHardwareInputNumberOfChannels"); -late final _sel_currentHardwareOutputNumberOfChannels = - objc.registerName("currentHardwareOutputNumberOfChannels"); -late final _sel_setPreferredHardwareSampleRate_error_ = - objc.registerName("setPreferredHardwareSampleRate:error:"); -late final _sel_preferredHardwareSampleRate = - objc.registerName("preferredHardwareSampleRate"); - -/// AVAudioSession -class AVAudioSession extends objc.NSObject { - AVAudioSession._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [AVAudioSession] that points to the same underlying object as [other]. - AVAudioSession.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [AVAudioSession] that wraps the given raw object pointer. - AVAudioSession.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [AVAudioSession]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_AVAudioSession); - } - - /// sharedInstance - static AVAudioSession sharedInstance() { - final _ret = - _objc_msgSend_1unuoxw(_class_AVAudioSession, _sel_sharedInstance); - return AVAudioSession.castFromPointer(_ret, retain: true, release: true); - } - - /// availableCategories - objc.NSArray get availableCategories { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_availableCategories); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setCategory:error: - bool setCategory_error_(objc.NSString category, - ffi.Pointer> outError) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_setCategory_error_, - category.ref.pointer, outError); - } - - /// setCategory:withOptions:error: - bool setCategory_withOptions_error_( - objc.NSString category, - AVAudioSessionCategoryOptions options, - ffi.Pointer> outError) { - return _objc_msgSend_1qqeo92( - this.ref.pointer, - _sel_setCategory_withOptions_error_, - category.ref.pointer, - options.value, - outError); - } - - /// setCategory:mode:options:error: - bool setCategory_mode_options_error_( - objc.NSString category, - objc.NSString mode, - AVAudioSessionCategoryOptions options, - ffi.Pointer> outError) { - return _objc_msgSend_1w2nczj( - this.ref.pointer, - _sel_setCategory_mode_options_error_, - category.ref.pointer, - mode.ref.pointer, - options.value, - outError); - } - - /// setCategory:mode:routeSharingPolicy:options:error: - bool setCategory_mode_routeSharingPolicy_options_error_( - objc.NSString category, - objc.NSString mode, - AVAudioSessionRouteSharingPolicy policy, - AVAudioSessionCategoryOptions options, - ffi.Pointer> outError) { - return _objc_msgSend_3ejcy4( - this.ref.pointer, - _sel_setCategory_mode_routeSharingPolicy_options_error_, - category.ref.pointer, - mode.ref.pointer, - policy.value, - options.value, - outError); - } - - /// category - objc.NSString get category { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_category); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// categoryOptions - AVAudioSessionCategoryOptions get categoryOptions { - final _ret = _objc_msgSend_ulkd0k(this.ref.pointer, _sel_categoryOptions); - return AVAudioSessionCategoryOptions.fromValue(_ret); - } - - /// routeSharingPolicy - AVAudioSessionRouteSharingPolicy get routeSharingPolicy { - final _ret = - _objc_msgSend_11368np(this.ref.pointer, _sel_routeSharingPolicy); - return AVAudioSessionRouteSharingPolicy.fromValue(_ret); - } - - /// availableModes - objc.NSArray get availableModes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_availableModes); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setMode:error: - bool setMode_error_( - objc.NSString mode, ffi.Pointer> outError) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_setMode_error_, mode.ref.pointer, outError); - } - - /// mode - objc.NSString get mode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mode); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setAllowHapticsAndSystemSoundsDuringRecording:error: - bool setAllowHapticsAndSystemSoundsDuringRecording_error_( - bool inValue, ffi.Pointer> outError) { - return _objc_msgSend_1867uf2( - this.ref.pointer, - _sel_setAllowHapticsAndSystemSoundsDuringRecording_error_, - inValue, - outError); - } - - /// allowHapticsAndSystemSoundsDuringRecording - bool get allowHapticsAndSystemSoundsDuringRecording { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowHapticsAndSystemSoundsDuringRecording); - } - - /// recordPermission - AVAudioSessionRecordPermission get recordPermission { - final _ret = _objc_msgSend_qybqeg(this.ref.pointer, _sel_recordPermission); - return AVAudioSessionRecordPermission.fromValue(_ret); - } - - /// requestRecordPermission: - void requestRecordPermission_( - objc.ObjCBlock response) { - _objc_msgSend_4daxhl( - this.ref.pointer, _sel_requestRecordPermission_, response.ref.pointer); - } - - /// overrideOutputAudioPort:error: - bool overrideOutputAudioPort_error_(AVAudioSessionPortOverride portOverride, - ffi.Pointer> outError) { - return _objc_msgSend_pcgmhk(this.ref.pointer, - _sel_overrideOutputAudioPort_error_, portOverride.value, outError); - } - - /// setPreferredInput:error: - bool setPreferredInput_error_(AVAudioSessionPortDescription? inPort, - ffi.Pointer> outError) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_setPreferredInput_error_, - inPort?.ref.pointer ?? ffi.nullptr, outError); - } - - /// preferredInput - AVAudioSessionPortDescription? get preferredInput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredInput); - return _ret.address == 0 - ? null - : AVAudioSessionPortDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setPrefersNoInterruptionsFromSystemAlerts:error: - bool setPrefersNoInterruptionsFromSystemAlerts_error_( - bool inValue, ffi.Pointer> outError) { - return _objc_msgSend_1867uf2( - this.ref.pointer, - _sel_setPrefersNoInterruptionsFromSystemAlerts_error_, - inValue, - outError); - } - - /// prefersNoInterruptionsFromSystemAlerts - bool get prefersNoInterruptionsFromSystemAlerts { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_prefersNoInterruptionsFromSystemAlerts); - } - - /// setActive:error: - bool setActive_error_( - bool active, ffi.Pointer> outError) { - return _objc_msgSend_1867uf2( - this.ref.pointer, _sel_setActive_error_, active, outError); - } - - /// setActive:withOptions:error: - bool setActive_withOptions_error_( - bool active, - AVAudioSessionSetActiveOptions options, - ffi.Pointer> outError) { - return _objc_msgSend_ydjcyk(this.ref.pointer, - _sel_setActive_withOptions_error_, active, options.value, outError); - } - - /// activateWithOptions:completionHandler: - void activateWithOptions_completionHandler_( - AVAudioSessionActivationOptions options, - objc.ObjCBlock handler) { - _objc_msgSend_1igkhc3( - this.ref.pointer, - _sel_activateWithOptions_completionHandler_, - options.value, - handler.ref.pointer); - } - - /// setPreferredSampleRate:error: - bool setPreferredSampleRate_error_( - double sampleRate, ffi.Pointer> outError) { - return _objc_msgSend_1kh8jgt(this.ref.pointer, - _sel_setPreferredSampleRate_error_, sampleRate, outError); - } - - /// preferredSampleRate - double get preferredSampleRate { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_preferredSampleRate) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_preferredSampleRate); - } - - /// setPreferredIOBufferDuration:error: - bool setPreferredIOBufferDuration_error_( - double duration, ffi.Pointer> outError) { - return _objc_msgSend_1kh8jgt(this.ref.pointer, - _sel_setPreferredIOBufferDuration_error_, duration, outError); - } - - /// preferredIOBufferDuration - double get preferredIOBufferDuration { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_preferredIOBufferDuration) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_preferredIOBufferDuration); - } - - /// setPreferredInputNumberOfChannels:error: - bool setPreferredInputNumberOfChannels_error_( - int count, ffi.Pointer> outError) { - return _objc_msgSend_1395fec(this.ref.pointer, - _sel_setPreferredInputNumberOfChannels_error_, count, outError); - } - - /// preferredInputNumberOfChannels - int get preferredInputNumberOfChannels { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_preferredInputNumberOfChannels); - } - - /// setPreferredOutputNumberOfChannels:error: - bool setPreferredOutputNumberOfChannels_error_( - int count, ffi.Pointer> outError) { - return _objc_msgSend_1395fec(this.ref.pointer, - _sel_setPreferredOutputNumberOfChannels_error_, count, outError); - } - - /// preferredOutputNumberOfChannels - int get preferredOutputNumberOfChannels { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_preferredOutputNumberOfChannels); - } - - /// setPreferredInputOrientation:error: - bool setPreferredInputOrientation_error_(AVAudioStereoOrientation orientation, - ffi.Pointer> outError) { - return _objc_msgSend_1ehfmir(this.ref.pointer, - _sel_setPreferredInputOrientation_error_, orientation.value, outError); - } - - /// preferredInputOrientation - AVAudioStereoOrientation get preferredInputOrientation { - final _ret = - _objc_msgSend_16ckc9k(this.ref.pointer, _sel_preferredInputOrientation); - return AVAudioStereoOrientation.fromValue(_ret); - } - - /// inputOrientation - AVAudioStereoOrientation get inputOrientation { - final _ret = _objc_msgSend_16ckc9k(this.ref.pointer, _sel_inputOrientation); - return AVAudioStereoOrientation.fromValue(_ret); - } - - /// maximumInputNumberOfChannels - int get maximumInputNumberOfChannels { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_maximumInputNumberOfChannels); - } - - /// maximumOutputNumberOfChannels - int get maximumOutputNumberOfChannels { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_maximumOutputNumberOfChannels); - } - - /// setInputGain:error: - bool setInputGain_error_( - double gain, ffi.Pointer> outError) { - return _objc_msgSend_yujz92( - this.ref.pointer, _sel_setInputGain_error_, gain, outError); - } - - /// inputGain - double get inputGain { - return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_inputGain) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_inputGain); - } - - /// isInputGainSettable - bool get inputGainSettable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isInputGainSettable); - } - - /// isInputAvailable - bool get inputAvailable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isInputAvailable); - } - - /// inputDataSources - objc.NSArray? get inputDataSources { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_inputDataSources); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// inputDataSource - AVAudioSessionDataSourceDescription? get inputDataSource { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_inputDataSource); - return _ret.address == 0 - ? null - : AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setInputDataSource:error: - bool setInputDataSource_error_( - AVAudioSessionDataSourceDescription? dataSource, - ffi.Pointer> outError) { - return _objc_msgSend_p02k6o( - this.ref.pointer, - _sel_setInputDataSource_error_, - dataSource?.ref.pointer ?? ffi.nullptr, - outError); - } - - /// outputDataSources - objc.NSArray? get outputDataSources { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_outputDataSources); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// outputDataSource - AVAudioSessionDataSourceDescription? get outputDataSource { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_outputDataSource); - return _ret.address == 0 - ? null - : AVAudioSessionDataSourceDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setOutputDataSource:error: - bool setOutputDataSource_error_( - AVAudioSessionDataSourceDescription? dataSource, - ffi.Pointer> outError) { - return _objc_msgSend_p02k6o( - this.ref.pointer, - _sel_setOutputDataSource_error_, - dataSource?.ref.pointer ?? ffi.nullptr, - outError); - } - - /// sampleRate - double get sampleRate { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_sampleRate) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_sampleRate); - } - - /// inputNumberOfChannels - int get inputNumberOfChannels { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_inputNumberOfChannels); - } - - /// outputNumberOfChannels - int get outputNumberOfChannels { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_outputNumberOfChannels); - } - - /// inputLatency - double get inputLatency { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_inputLatency) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_inputLatency); - } - - /// outputLatency - double get outputLatency { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_outputLatency) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_outputLatency); - } - - /// IOBufferDuration - double get IOBufferDuration { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_IOBufferDuration) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_IOBufferDuration); - } - - /// isOtherAudioPlaying - bool get otherAudioPlaying { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isOtherAudioPlaying); - } - - /// secondaryAudioShouldBeSilencedHint - bool get secondaryAudioShouldBeSilencedHint { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_secondaryAudioShouldBeSilencedHint); - } - - /// outputVolume - double get outputVolume { - return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_outputVolume) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_outputVolume); - } - - /// promptStyle - AVAudioSessionPromptStyle get promptStyle { - final _ret = _objc_msgSend_xgzkcr(this.ref.pointer, _sel_promptStyle); - return AVAudioSessionPromptStyle.fromValue(_ret); - } - - /// availableInputs - objc.NSArray? get availableInputs { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_availableInputs); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// currentRoute - AVAudioSessionRouteDescription get currentRoute { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentRoute); - return AVAudioSessionRouteDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAggregatedIOPreference:error: - bool setAggregatedIOPreference_error_(AVAudioSessionIOType inIOType, - ffi.Pointer> outError) { - return _objc_msgSend_vsrn59(this.ref.pointer, - _sel_setAggregatedIOPreference_error_, inIOType.value, outError); - } - - /// setSupportsMultichannelContent:error: - bool setSupportsMultichannelContent_error_( - bool inValue, ffi.Pointer> outError) { - return _objc_msgSend_1867uf2(this.ref.pointer, - _sel_setSupportsMultichannelContent_error_, inValue, outError); - } - - /// supportsMultichannelContent - bool get supportsMultichannelContent { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_supportsMultichannelContent); - } - - /// setPrefersInterruptionOnRouteDisconnect:error: - bool setPrefersInterruptionOnRouteDisconnect_error_( - bool inValue, ffi.Pointer> outError) { - return _objc_msgSend_1867uf2(this.ref.pointer, - _sel_setPrefersInterruptionOnRouteDisconnect_error_, inValue, outError); - } - - /// prefersInterruptionOnRouteDisconnect - bool get prefersInterruptionOnRouteDisconnect { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_prefersInterruptionOnRouteDisconnect); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// init - AVAudioSession init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return AVAudioSession.castFromPointer(_ret, retain: false, release: true); - } - - /// setActive:withFlags:error: - bool setActive_withFlags_error_(bool active, int flags, - ffi.Pointer> outError) { - return _objc_msgSend_11f9fnx(this.ref.pointer, - _sel_setActive_withFlags_error_, active, flags, outError); - } - - /// inputIsAvailable - bool get inputIsAvailable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_inputIsAvailable); - } - - /// currentHardwareSampleRate - double get currentHardwareSampleRate { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_currentHardwareSampleRate) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_currentHardwareSampleRate); - } - - /// currentHardwareInputNumberOfChannels - int get currentHardwareInputNumberOfChannels { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_currentHardwareInputNumberOfChannels); - } - - /// currentHardwareOutputNumberOfChannels - int get currentHardwareOutputNumberOfChannels { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_currentHardwareOutputNumberOfChannels); - } - - /// setPreferredHardwareSampleRate:error: - bool setPreferredHardwareSampleRate_error_( - double sampleRate, ffi.Pointer> outError) { - return _objc_msgSend_1kh8jgt(this.ref.pointer, - _sel_setPreferredHardwareSampleRate_error_, sampleRate, outError); - } - - /// preferredHardwareSampleRate - double get preferredHardwareSampleRate { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_preferredHardwareSampleRate) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_preferredHardwareSampleRate); - } - - /// new - static AVAudioSession new1() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioSession, _sel_new); - return AVAudioSession.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static AVAudioSession allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_AVAudioSession, _sel_allocWithZone_, zone); - return AVAudioSession.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static AVAudioSession alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioSession, _sel_alloc); - return AVAudioSession.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioSession, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioSession, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_AVAudioSession, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_AVAudioSession, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_AVAudioSession, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioSession, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioSession, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSession, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioSession, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - AVAudioSession self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return AVAudioSession.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - AVAudioSession retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return AVAudioSession.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - AVAudioSession autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return AVAudioSession.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_AVAudioPlayer = objc.getClass("AVAudioPlayer"); -late final _sel_initWithContentsOfURL_error_ = - objc.registerName("initWithContentsOfURL:error:"); -late final _sel_initWithData_error_ = objc.registerName("initWithData:error:"); -late final _sel_initWithContentsOfURL_fileTypeHint_error_ = - objc.registerName("initWithContentsOfURL:fileTypeHint:error:"); -late final _sel_initWithData_fileTypeHint_error_ = - objc.registerName("initWithData:fileTypeHint:error:"); -late final _sel_prepareToPlay = objc.registerName("prepareToPlay"); -late final _sel_play = objc.registerName("play"); -late final _sel_playAtTime_ = objc.registerName("playAtTime:"); -final _objc_msgSend_1hnh3lf = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Double)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_isPlaying = objc.registerName("isPlaying"); -late final _sel_numberOfChannels = objc.registerName("numberOfChannels"); -late final _sel_currentDevice = objc.registerName("currentDevice"); -late final _sel_setCurrentDevice_ = objc.registerName("setCurrentDevice:"); -late final _sel_url = objc.registerName("url"); -late final _sel_pan = objc.registerName("pan"); -late final _sel_setPan_ = objc.registerName("setPan:"); -late final _sel_volume = objc.registerName("volume"); -late final _sel_setVolume_ = objc.registerName("setVolume:"); -late final _sel_setVolume_fadeDuration_ = - objc.registerName("setVolume:fadeDuration:"); -final _objc_msgSend_1kev0m2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Float, ffi.Double)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, double, double)>(); -late final _sel_enableRate = objc.registerName("enableRate"); -late final _sel_setEnableRate_ = objc.registerName("setEnableRate:"); -late final _sel_rate = objc.registerName("rate"); -late final _sel_setRate_ = objc.registerName("setRate:"); -late final _sel_currentTime = objc.registerName("currentTime"); -late final _sel_setCurrentTime_ = objc.registerName("setCurrentTime:"); -late final _sel_deviceCurrentTime = objc.registerName("deviceCurrentTime"); -late final _sel_numberOfLoops = objc.registerName("numberOfLoops"); -late final _sel_setNumberOfLoops_ = objc.registerName("setNumberOfLoops:"); -late final _sel_settings = objc.registerName("settings"); -late final _class_AVAudioFormat = objc.getClass("AVAudioFormat"); +final class _NSZone extends ffi.Opaque {} final class AudioStreamBasicDescription extends ffi.Struct { @ffi.Double() @@ -41029,23 +42,6 @@ final class AudioStreamBasicDescription extends ffi.Struct { external int mReserved; } -late final _sel_initWithStreamDescription_ = - objc.registerName("initWithStreamDescription:"); -final _objc_msgSend_1ndg23i = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _class_AVAudioChannelLayout = objc.getClass("AVAudioChannelLayout"); -late final _sel_initWithLayoutTag_ = objc.registerName("initWithLayoutTag:"); - enum AudioChannelBitmap { kAudioChannelBit_Left(1), kAudioChannelBit_Right(2), @@ -41145,332 +141,36 @@ enum AudioChannelFlags { final class AudioChannelDescription extends ffi.Struct { @ffi.UnsignedInt() - external int mChannelLabel; - - @ffi.UnsignedInt() - external int mChannelFlagsAsInt; - - AudioChannelFlags get mChannelFlags => - AudioChannelFlags.fromValue(mChannelFlagsAsInt); - - @ffi.Array.multi([3]) - external ffi.Array mCoordinates; -} - -final class AudioChannelLayout extends ffi.Struct { - @ffi.UnsignedInt() - external int mChannelLayoutTag; - - @ffi.UnsignedInt() - external int mChannelBitmapAsInt; - - AudioChannelBitmap get mChannelBitmap => - AudioChannelBitmap.fromValue(mChannelBitmapAsInt); - - @ffi.UnsignedInt() - external int mNumberChannelDescriptions; - - @ffi.Array.multi([1]) - external ffi.Array mChannelDescriptions; -} - -late final _sel_initWithLayout_ = objc.registerName("initWithLayout:"); -final _objc_msgSend_tk4ypl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_layoutWithLayoutTag_ = - objc.registerName("layoutWithLayoutTag:"); -late final _sel_layoutWithLayout_ = objc.registerName("layoutWithLayout:"); -late final _sel_layoutTag = objc.registerName("layoutTag"); -late final _sel_layout = objc.registerName("layout"); -final _objc_msgSend_1ice9o9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_channelCount = objc.registerName("channelCount"); -final _objc_msgSend_tfd317 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); - -/// AVAudioChannelLayout -class AVAudioChannelLayout extends objc.NSObject { - AVAudioChannelLayout._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [AVAudioChannelLayout] that points to the same underlying object as [other]. - AVAudioChannelLayout.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [AVAudioChannelLayout] that wraps the given raw object pointer. - AVAudioChannelLayout.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [AVAudioChannelLayout]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_AVAudioChannelLayout); - } - - /// init - AVAudioChannelLayout init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithLayoutTag: - AVAudioChannelLayout? initWithLayoutTag_(int layoutTag) { - final _ret = _objc_msgSend_pxgym4( - this.ref.retainAndReturnPointer(), _sel_initWithLayoutTag_, layoutTag); - return _ret.address == 0 - ? null - : AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithLayout: - AVAudioChannelLayout initWithLayout_(ffi.Pointer layout) { - final _ret = _objc_msgSend_tk4ypl( - this.ref.retainAndReturnPointer(), _sel_initWithLayout_, layout); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } - - /// isEqual: - bool isEqual_(objc.ObjCObjectBase object) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqual_, object.ref.pointer); - } - - /// layoutWithLayoutTag: - static AVAudioChannelLayout layoutWithLayoutTag_(int layoutTag) { - final _ret = _objc_msgSend_pxgym4( - _class_AVAudioChannelLayout, _sel_layoutWithLayoutTag_, layoutTag); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: true, release: true); - } - - /// layoutWithLayout: - static AVAudioChannelLayout layoutWithLayout_( - ffi.Pointer layout) { - final _ret = _objc_msgSend_tk4ypl( - _class_AVAudioChannelLayout, _sel_layoutWithLayout_, layout); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: true, release: true); - } - - /// layoutTag - int get layoutTag { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_layoutTag); - } - - /// layout - ffi.Pointer get layout { - return _objc_msgSend_1ice9o9(this.ref.pointer, _sel_layout); - } - - /// channelCount - int get channelCount { - return _objc_msgSend_tfd317(this.ref.pointer, _sel_channelCount); - } - - /// new - static AVAudioChannelLayout new1() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioChannelLayout, _sel_new); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static AVAudioChannelLayout allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_AVAudioChannelLayout, _sel_allocWithZone_, zone); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static AVAudioChannelLayout alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioChannelLayout, _sel_alloc); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioChannelLayout, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioChannelLayout, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_AVAudioChannelLayout, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_AVAudioChannelLayout, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_AVAudioChannelLayout, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioChannelLayout, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioChannelLayout, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } + external int mChannelLabel; - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioChannelLayout, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } + @ffi.UnsignedInt() + external int mChannelFlagsAsInt; - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioChannelLayout, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } + AudioChannelFlags get mChannelFlags => + AudioChannelFlags.fromValue(mChannelFlagsAsInt); - /// self - AVAudioChannelLayout self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: true, release: true); - } + @ffi.Array.multi([3]) + external ffi.Array mCoordinates; +} - /// retain - AVAudioChannelLayout retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: true, release: true); - } +final class AudioChannelLayout extends ffi.Struct { + @ffi.UnsignedInt() + external int mChannelLayoutTag; - /// autorelease - AVAudioChannelLayout autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return AVAudioChannelLayout.castFromPointer(_ret, - retain: true, release: true); - } + @ffi.UnsignedInt() + external int mChannelBitmapAsInt; - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_AVAudioChannelLayout, _sel_supportsSecureCoding); - } + AudioChannelBitmap get mChannelBitmap => + AudioChannelBitmap.fromValue(mChannelBitmapAsInt); - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } + @ffi.UnsignedInt() + external int mNumberChannelDescriptions; - /// initWithCoder: - AVAudioChannelLayout? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : AVAudioChannelLayout.castFromPointer(_ret, - retain: false, release: true); - } + @ffi.Array.multi([1]) + external ffi.Array mChannelDescriptions; } -late final _sel_initWithStreamDescription_channelLayout_ = - objc.registerName("initWithStreamDescription:channelLayout:"); -final _objc_msgSend_18zr4wd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_initStandardFormatWithSampleRate_channels_ = - objc.registerName("initStandardFormatWithSampleRate:channels:"); -final _objc_msgSend_17dsvlf = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Double, ffi.Uint32)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, double, int)>(); -late final _sel_initStandardFormatWithSampleRate_channelLayout_ = - objc.registerName("initStandardFormatWithSampleRate:channelLayout:"); -final _objc_msgSend_m6z6pt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer)>(); +final class opaqueCMFormatDescription extends ffi.Opaque {} enum AVAudioCommonFormat { AVAudioOtherFormat(0), @@ -41493,425 +193,243 @@ enum AVAudioCommonFormat { }; } -late final _sel_initWithCommonFormat_sampleRate_channels_interleaved_ = - objc.registerName("initWithCommonFormat:sampleRate:channels:interleaved:"); -final _objc_msgSend_mosbvw = objc.msgSendPointer +/// WARNING: AVAudioFormat is a stub. To generate bindings for this class, include +/// AVAudioFormat in your config's objc-interfaces list. +/// +/// AVAudioFormat +class AVAudioFormat extends objc.NSObject { + AVAudioFormat._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [AVAudioFormat] that points to the same underlying object as [other]. + AVAudioFormat.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [AVAudioFormat] that wraps the given raw object pointer. + AVAudioFormat.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _class_AVAudioPlayer = objc.getClass("AVAudioPlayer"); +late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); +final _objc_msgSend_69e0x1 = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Bool Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - ffi.Double, - ffi.Uint32, - ffi.Bool)>>() + ffi.Pointer)>>() .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, double, int, bool)>(); -late final _sel_initWithCommonFormat_sampleRate_interleaved_channelLayout_ = - objc.registerName( - "initWithCommonFormat:sampleRate:interleaved:channelLayout:"); -final _objc_msgSend_1kvbzfo = objc.msgSendPointer + bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +typedef instancetype = ffi.Pointer; +typedef Dartinstancetype = objc.ObjCObjectBase; +late final _sel_initWithContentsOfURL_error_ = + objc.registerName("initWithContentsOfURL:error:"); +final _objc_msgSend_1705co6 = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - ffi.Double, - ffi.Bool, - ffi.Pointer)>>() + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - int, - double, - bool, - ffi.Pointer)>(); -late final _sel_initWithSettings_ = objc.registerName("initWithSettings:"); - -final class opaqueCMFormatDescription extends ffi.Opaque {} - -late final _sel_initWithCMAudioFormatDescription_ = - objc.registerName("initWithCMAudioFormatDescription:"); -final _objc_msgSend_nbwfhi = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_initWithData_error_ = objc.registerName("initWithData:error:"); +late final _sel_initWithContentsOfURL_fileTypeHint_error_ = + objc.registerName("initWithContentsOfURL:fileTypeHint:error:"); +final _objc_msgSend_bo6ep4 = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isStandard = objc.registerName("isStandard"); -late final _sel_commonFormat = objc.registerName("commonFormat"); -final _objc_msgSend_115fnjc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isInterleaved = objc.registerName("isInterleaved"); -late final _sel_streamDescription = objc.registerName("streamDescription"); -final _objc_msgSend_irgetq = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_initWithData_fileTypeHint_error_ = + objc.registerName("initWithData:fileTypeHint:error:"); +late final _sel_prepareToPlay = objc.registerName("prepareToPlay"); +final _objc_msgSend_91o635 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, + ffi.Bool Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - ffi.Pointer Function( + bool Function( ffi.Pointer, ffi.Pointer)>(); -late final _sel_channelLayout = objc.registerName("channelLayout"); -late final _sel_magicCookie = objc.registerName("magicCookie"); -late final _sel_setMagicCookie_ = objc.registerName("setMagicCookie:"); -late final _sel_formatDescription = objc.registerName("formatDescription"); -final _objc_msgSend_1ot92k6 = objc.msgSendPointer +late final _sel_play = objc.registerName("play"); +late final _sel_playAtTime_ = objc.registerName("playAtTime:"); +final _objc_msgSend_18chyc = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>>() + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Double)>>() .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); - -/// AVAudioFormat -class AVAudioFormat extends objc.NSObject { - AVAudioFormat._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [AVAudioFormat] that points to the same underlying object as [other]. - AVAudioFormat.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [AVAudioFormat] that wraps the given raw object pointer. - AVAudioFormat.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [AVAudioFormat]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_AVAudioFormat); - } - - /// initWithStreamDescription: - AVAudioFormat? initWithStreamDescription_( - ffi.Pointer asbd) { - final _ret = _objc_msgSend_1ndg23i(this.ref.retainAndReturnPointer(), - _sel_initWithStreamDescription_, asbd); - return _ret.address == 0 - ? null - : AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithStreamDescription:channelLayout: - AVAudioFormat? initWithStreamDescription_channelLayout_( - ffi.Pointer asbd, - AVAudioChannelLayout? layout) { - final _ret = _objc_msgSend_18zr4wd( - this.ref.retainAndReturnPointer(), - _sel_initWithStreamDescription_channelLayout_, - asbd, - layout?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initStandardFormatWithSampleRate:channels: - AVAudioFormat? initStandardFormatWithSampleRate_channels_( - double sampleRate, int channels) { - final _ret = _objc_msgSend_17dsvlf(this.ref.retainAndReturnPointer(), - _sel_initStandardFormatWithSampleRate_channels_, sampleRate, channels); - return _ret.address == 0 - ? null - : AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initStandardFormatWithSampleRate:channelLayout: - AVAudioFormat initStandardFormatWithSampleRate_channelLayout_( - double sampleRate, AVAudioChannelLayout layout) { - final _ret = _objc_msgSend_m6z6pt( - this.ref.retainAndReturnPointer(), - _sel_initStandardFormatWithSampleRate_channelLayout_, - sampleRate, - layout.ref.pointer); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCommonFormat:sampleRate:channels:interleaved: - AVAudioFormat? initWithCommonFormat_sampleRate_channels_interleaved_( - AVAudioCommonFormat format, - double sampleRate, - int channels, - bool interleaved) { - final _ret = _objc_msgSend_mosbvw( - this.ref.retainAndReturnPointer(), - _sel_initWithCommonFormat_sampleRate_channels_interleaved_, - format.value, - sampleRate, - channels, - interleaved); - return _ret.address == 0 - ? null - : AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCommonFormat:sampleRate:interleaved:channelLayout: - AVAudioFormat initWithCommonFormat_sampleRate_interleaved_channelLayout_( - AVAudioCommonFormat format, - double sampleRate, - bool interleaved, - AVAudioChannelLayout layout) { - final _ret = _objc_msgSend_1kvbzfo( - this.ref.retainAndReturnPointer(), - _sel_initWithCommonFormat_sampleRate_interleaved_channelLayout_, - format.value, - sampleRate, - interleaved, - layout.ref.pointer); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithSettings: - AVAudioFormat? initWithSettings_(objc.NSDictionary settings) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithSettings_, settings.ref.pointer); - return _ret.address == 0 - ? null - : AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCMAudioFormatDescription: - AVAudioFormat initWithCMAudioFormatDescription_( - ffi.Pointer formatDescription) { - final _ret = _objc_msgSend_nbwfhi(this.ref.retainAndReturnPointer(), - _sel_initWithCMAudioFormatDescription_, formatDescription); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// isEqual: - bool isEqual_(objc.ObjCObjectBase object) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqual_, object.ref.pointer); - } - - /// isStandard - bool get standard { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isStandard); - } - - /// commonFormat - AVAudioCommonFormat get commonFormat { - final _ret = _objc_msgSend_115fnjc(this.ref.pointer, _sel_commonFormat); - return AVAudioCommonFormat.fromValue(_ret); - } - - /// channelCount - int get channelCount { - return _objc_msgSend_tfd317(this.ref.pointer, _sel_channelCount); - } - - /// sampleRate - double get sampleRate { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_sampleRate) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_sampleRate); - } - - /// isInterleaved - bool get interleaved { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isInterleaved); - } - - /// streamDescription - ffi.Pointer get streamDescription { - return _objc_msgSend_irgetq(this.ref.pointer, _sel_streamDescription); - } - - /// channelLayout - AVAudioChannelLayout? get channelLayout { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_channelLayout); - return _ret.address == 0 - ? null - : AVAudioChannelLayout.castFromPointer(_ret, - retain: true, release: true); - } - - /// magicCookie - objc.NSData? get magicCookie { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_magicCookie); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// setMagicCookie: - set magicCookie(objc.NSData? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setMagicCookie_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// settings - objc.NSDictionary get settings { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_settings); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// formatDescription - ffi.Pointer get formatDescription { - return _objc_msgSend_1ot92k6(this.ref.pointer, _sel_formatDescription); - } - - /// init - AVAudioFormat init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static AVAudioFormat new1() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioFormat, _sel_new); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static AVAudioFormat allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_AVAudioFormat, _sel_allocWithZone_, zone); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static AVAudioFormat alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioFormat, _sel_alloc); - return AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioFormat, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioFormat, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_AVAudioFormat, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_AVAudioFormat, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_AVAudioFormat, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioFormat, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioFormat, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioFormat, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioFormat, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - AVAudioFormat self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return AVAudioFormat.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - AVAudioFormat retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return AVAudioFormat.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - AVAudioFormat autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return AVAudioFormat.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_AVAudioFormat, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - AVAudioFormat? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : AVAudioFormat.castFromPointer(_ret, retain: false, release: true); - } -} - + bool Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_pause = objc.registerName("pause"); +final _objc_msgSend_1pl9qdv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_stop = objc.registerName("stop"); +late final _sel_isPlaying = objc.registerName("isPlaying"); +late final _sel_numberOfChannels = objc.registerName("numberOfChannels"); +final _objc_msgSend_xw2lbc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_duration = objc.registerName("duration"); +final _objc_msgSend_1ukqyt8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1ukqyt8Fpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_currentDevice = objc.registerName("currentDevice"); +final _objc_msgSend_1x359cv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setCurrentDevice_ = objc.registerName("setCurrentDevice:"); +final _objc_msgSend_1jdvcbf = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_delegate = objc.registerName("delegate"); +late final _sel_setDelegate_ = objc.registerName("setDelegate:"); +late final _sel_url = objc.registerName("url"); +late final _sel_data = objc.registerName("data"); +late final _sel_pan = objc.registerName("pan"); +final _objc_msgSend_2cgrxl = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_2cgrxlFpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setPan_ = objc.registerName("setPan:"); +final _objc_msgSend_v5hmet = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Float)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_volume = objc.registerName("volume"); +late final _sel_setVolume_ = objc.registerName("setVolume:"); +late final _sel_setVolume_fadeDuration_ = + objc.registerName("setVolume:fadeDuration:"); +final _objc_msgSend_1p4uk9e = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Float, ffi.Double)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, double, double)>(); +late final _sel_enableRate = objc.registerName("enableRate"); +late final _sel_setEnableRate_ = objc.registerName("setEnableRate:"); +final _objc_msgSend_1s56lr9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Bool)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, bool)>(); +late final _sel_rate = objc.registerName("rate"); +late final _sel_setRate_ = objc.registerName("setRate:"); +late final _sel_currentTime = objc.registerName("currentTime"); +late final _sel_setCurrentTime_ = objc.registerName("setCurrentTime:"); +final _objc_msgSend_hwm8nu = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Double)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_deviceCurrentTime = objc.registerName("deviceCurrentTime"); +late final _sel_numberOfLoops = objc.registerName("numberOfLoops"); +final _objc_msgSend_1hz7y9r = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setNumberOfLoops_ = objc.registerName("setNumberOfLoops:"); +final _objc_msgSend_4sp4xj = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Long)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_settings = objc.registerName("settings"); +late final _sel_format = objc.registerName("format"); late final _sel_isMeteringEnabled = objc.registerName("isMeteringEnabled"); late final _sel_setMeteringEnabled_ = objc.registerName("setMeteringEnabled:"); late final _sel_updateMeters = objc.registerName("updateMeters"); late final _sel_peakPowerForChannel_ = objc.registerName("peakPowerForChannel:"); -final _objc_msgSend_imxjxz = objc.msgSendPointer +final _objc_msgSend_65s5yw = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Float Function(ffi.Pointer, @@ -41919,7 +437,7 @@ final _objc_msgSend_imxjxz = objc.msgSendPointer .asFunction< double Function(ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_imxjxzFpret = objc.msgSendFpretPointer +final _objc_msgSend_65s5ywFpret = objc.msgSendFpretPointer .cast< ffi.NativeFunction< ffi.Float Function(ffi.Pointer, @@ -41932,6 +450,116 @@ late final _sel_averagePowerForChannel_ = late final _sel_channelAssignments = objc.registerName("channelAssignments"); late final _sel_setChannelAssignments_ = objc.registerName("setChannelAssignments:"); +late final _sel_init = objc.registerName("init"); +late final _sel_new = objc.registerName("new"); +late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); +final _objc_msgSend_hzlb60 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>(); +late final _sel_alloc = objc.registerName("alloc"); +late final _sel_self = objc.registerName("self"); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer)>()(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer + _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as ffi.Pointer Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. +abstract final class ObjCBlock_objcObjCObject_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock Function(ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock Function(ffi.Pointer)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock Function(ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock Function(ffi.Pointer)> + fromFunction(objc.ObjCObjectBase Function(ffi.Pointer) fn) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, + (ffi.Pointer arg0) => + fn(arg0).ref.retainAndAutorelease()), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. +extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension on objc + .ObjCBlock Function(ffi.Pointer)> { + objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0), + retain: true, + release: true); +} + +late final _sel_retain = objc.registerName("retain"); +late final _sel_autorelease = objc.registerName("autorelease"); /// AVAudioPlayer class AVAudioPlayer extends objc.NSObject { @@ -41950,14 +578,14 @@ class AVAudioPlayer extends objc.NSObject { /// Returns whether [obj] is an instance of [AVAudioPlayer]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_AVAudioPlayer); } /// initWithContentsOfURL:error: AVAudioPlayer? initWithContentsOfURL_error_( objc.NSURL url, ffi.Pointer> outError) { - final _ret = _objc_msgSend_1y425zh(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1705co6(this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_error_, url.ref.pointer, outError); return _ret.address == 0 ? null @@ -41967,7 +595,7 @@ class AVAudioPlayer extends objc.NSObject { /// initWithData:error: AVAudioPlayer? initWithData_error_( objc.NSData data, ffi.Pointer> outError) { - final _ret = _objc_msgSend_1y425zh(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1705co6(this.ref.retainAndReturnPointer(), _sel_initWithData_error_, data.ref.pointer, outError); return _ret.address == 0 ? null @@ -41979,7 +607,7 @@ class AVAudioPlayer extends objc.NSObject { objc.NSURL url, objc.NSString? utiString, ffi.Pointer> outError) { - final _ret = _objc_msgSend_1lpsn5w( + final _ret = _objc_msgSend_bo6ep4( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_fileTypeHint_error_, url.ref.pointer, @@ -41995,7 +623,7 @@ class AVAudioPlayer extends objc.NSObject { objc.NSData data, objc.NSString? utiString, ffi.Pointer> outError) { - final _ret = _objc_msgSend_1lpsn5w( + final _ret = _objc_msgSend_bo6ep4( this.ref.retainAndReturnPointer(), _sel_initWithData_fileTypeHint_error_, data.ref.pointer, @@ -42008,49 +636,49 @@ class AVAudioPlayer extends objc.NSObject { /// prepareToPlay bool prepareToPlay() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_prepareToPlay); + return _objc_msgSend_91o635(this.ref.pointer, _sel_prepareToPlay); } /// play bool play() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_play); + return _objc_msgSend_91o635(this.ref.pointer, _sel_play); } /// playAtTime: bool playAtTime_(double time) { - return _objc_msgSend_1hnh3lf(this.ref.pointer, _sel_playAtTime_, time); + return _objc_msgSend_18chyc(this.ref.pointer, _sel_playAtTime_, time); } /// pause void pause() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_pause); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_pause); } /// stop void stop() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stop); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_stop); } /// isPlaying bool get playing { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isPlaying); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isPlaying); } /// numberOfChannels int get numberOfChannels { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_numberOfChannels); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_numberOfChannels); } /// duration double get duration { return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_duration) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_duration); + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_duration) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_duration); } /// currentDevice objc.NSString? get currentDevice { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDevice); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_currentDevice); return _ret.address == 0 ? null : objc.NSString.castFromPointer(_ret, retain: true, release: true); @@ -42058,13 +686,13 @@ class AVAudioPlayer extends objc.NSObject { /// setCurrentDevice: set currentDevice(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCurrentDevice_, + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setCurrentDevice_, value?.ref.pointer ?? ffi.nullptr); } /// delegate objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_delegate); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); @@ -42072,13 +700,13 @@ class AVAudioPlayer extends objc.NSObject { /// setDelegate: set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( + return _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); } /// url objc.NSURL? get url { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_url); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_url); return _ret.address == 0 ? null : objc.NSURL.castFromPointer(_ret, retain: true, release: true); @@ -42086,7 +714,7 @@ class AVAudioPlayer extends objc.NSObject { /// data objc.NSData? get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_data); return _ret.address == 0 ? null : objc.NSData.castFromPointer(_ret, retain: true, release: true); @@ -42095,135 +723,135 @@ class AVAudioPlayer extends objc.NSObject { /// pan double get pan { return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_pan) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_pan); + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_pan) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_pan); } /// setPan: set pan(double value) { - return _objc_msgSend_s9gjzc(this.ref.pointer, _sel_setPan_, value); + return _objc_msgSend_v5hmet(this.ref.pointer, _sel_setPan_, value); } /// volume double get volume { return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_volume) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_volume); + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_volume) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_volume); } /// setVolume: set volume(double value) { - return _objc_msgSend_s9gjzc(this.ref.pointer, _sel_setVolume_, value); + return _objc_msgSend_v5hmet(this.ref.pointer, _sel_setVolume_, value); } /// setVolume:fadeDuration: void setVolume_fadeDuration_(double volume, double duration) { - _objc_msgSend_1kev0m2( + _objc_msgSend_1p4uk9e( this.ref.pointer, _sel_setVolume_fadeDuration_, volume, duration); } /// enableRate bool get enableRate { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_enableRate); + return _objc_msgSend_91o635(this.ref.pointer, _sel_enableRate); } /// setEnableRate: set enableRate(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setEnableRate_, value); + return _objc_msgSend_1s56lr9(this.ref.pointer, _sel_setEnableRate_, value); } /// rate double get rate { return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_rate) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_rate); + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_rate) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_rate); } /// setRate: set rate(double value) { - return _objc_msgSend_s9gjzc(this.ref.pointer, _sel_setRate_, value); + return _objc_msgSend_v5hmet(this.ref.pointer, _sel_setRate_, value); } /// currentTime double get currentTime { return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_currentTime) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_currentTime); + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_currentTime) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_currentTime); } /// setCurrentTime: set currentTime(double value) { - return _objc_msgSend_suh039(this.ref.pointer, _sel_setCurrentTime_, value); + return _objc_msgSend_hwm8nu(this.ref.pointer, _sel_setCurrentTime_, value); } /// deviceCurrentTime double get deviceCurrentTime { return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_deviceCurrentTime) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_deviceCurrentTime); + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_deviceCurrentTime) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_deviceCurrentTime); } /// numberOfLoops int get numberOfLoops { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_numberOfLoops); + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_numberOfLoops); } /// setNumberOfLoops: set numberOfLoops(int value) { - return _objc_msgSend_ke7qz2( + return _objc_msgSend_4sp4xj( this.ref.pointer, _sel_setNumberOfLoops_, value); } /// settings objc.NSDictionary get settings { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_settings); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_settings); return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); } /// format AVAudioFormat get format { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_format); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_format); return AVAudioFormat.castFromPointer(_ret, retain: true, release: true); } /// isMeteringEnabled bool get meteringEnabled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isMeteringEnabled); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isMeteringEnabled); } /// setMeteringEnabled: set meteringEnabled(bool value) { - return _objc_msgSend_117qins( + return _objc_msgSend_1s56lr9( this.ref.pointer, _sel_setMeteringEnabled_, value); } /// updateMeters void updateMeters() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_updateMeters); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_updateMeters); } /// peakPowerForChannel: double peakPowerForChannel_(int channelNumber) { return objc.useMsgSendVariants - ? _objc_msgSend_imxjxzFpret( + ? _objc_msgSend_65s5ywFpret( this.ref.pointer, _sel_peakPowerForChannel_, channelNumber) - : _objc_msgSend_imxjxz( + : _objc_msgSend_65s5yw( this.ref.pointer, _sel_peakPowerForChannel_, channelNumber); } /// averagePowerForChannel: double averagePowerForChannel_(int channelNumber) { return objc.useMsgSendVariants - ? _objc_msgSend_imxjxzFpret( + ? _objc_msgSend_65s5ywFpret( this.ref.pointer, _sel_averagePowerForChannel_, channelNumber) - : _objc_msgSend_imxjxz( + : _objc_msgSend_65s5yw( this.ref.pointer, _sel_averagePowerForChannel_, channelNumber); } /// channelAssignments objc.NSArray? get channelAssignments { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_channelAssignments); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_channelAssignments); return _ret.address == 0 ? null : objc.NSArray.castFromPointer(_ret, retain: true, release: true); @@ -42231,119 +859,51 @@ class AVAudioPlayer extends objc.NSObject { /// setChannelAssignments: set channelAssignments(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChannelAssignments_, + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setChannelAssignments_, value?.ref.pointer ?? ffi.nullptr); } /// init AVAudioPlayer init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return AVAudioPlayer.castFromPointer(_ret, retain: false, release: true); } /// new static AVAudioPlayer new1() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioPlayer, _sel_new); + final _ret = _objc_msgSend_1x359cv(_class_AVAudioPlayer, _sel_new); return AVAudioPlayer.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static AVAudioPlayer allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_AVAudioPlayer, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_AVAudioPlayer, _sel_allocWithZone_, zone); return AVAudioPlayer.castFromPointer(_ret, retain: false, release: true); } /// alloc static AVAudioPlayer alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_AVAudioPlayer, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_AVAudioPlayer, _sel_alloc); return AVAudioPlayer.castFromPointer(_ret, retain: false, release: true); } - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_AVAudioPlayer, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_AVAudioPlayer, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_AVAudioPlayer, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_AVAudioPlayer, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_AVAudioPlayer, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_AVAudioPlayer, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_AVAudioPlayer, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioPlayer, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_AVAudioPlayer, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - /// self AVAudioPlayer self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return AVAudioPlayer.castFromPointer(_ret, retain: true, release: true); } /// retain AVAudioPlayer retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return AVAudioPlayer.castFromPointer(_ret, retain: true, release: true); } /// autorelease AVAudioPlayer autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return AVAudioPlayer.castFromPointer(_ret, retain: true, release: true); } } diff --git a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m deleted file mode 100644 index 02b011c09..000000000 --- a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m +++ /dev/null @@ -1,113 +0,0 @@ -#include -#import - -#if !__has_feature(objc_arc) -#error "This file must be compiled with ARC enabled" -#endif - -id objc_retain(id); -id objc_retainBlock(id); - -typedef void (^_ListenerTrampoline)(); -_ListenerTrampoline _wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETURNS_RETAINED { - return ^void() { - objc_retainBlock(block); - block(); - }; -} - -typedef void (^_ListenerTrampoline1)(id arg0, id arg1, BOOL * arg2); -_ListenerTrampoline1 _wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { - return ^void(id arg0, id arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), objc_retain(arg1), arg2); - }; -} - -typedef void (^_ListenerTrampoline2)(void * arg0, id arg1); -_ListenerTrampoline2 _wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { - return ^void(void * arg0, id arg1) { - objc_retainBlock(block); - block(arg0, objc_retain(arg1)); - }; -} - -typedef void (^_ListenerTrampoline3)(id arg0, struct _NSRange arg1, BOOL * arg2); -_ListenerTrampoline3 _wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { - return ^void(id arg0, struct _NSRange arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, arg2); - }; -} - -typedef void (^_ListenerTrampoline4)(id arg0, BOOL arg1, BOOL * arg2); -_ListenerTrampoline4 _wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { - return ^void(id arg0, BOOL arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, arg2); - }; -} - -typedef void (^_ListenerTrampoline5)(id arg0); -_ListenerTrampoline5 _wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { - return ^void(id arg0) { - objc_retainBlock(block); - block(objc_retain(arg0)); - }; -} - -typedef void (^_ListenerTrampoline6)(id arg0, id arg1); -_ListenerTrampoline6 _wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { - return ^void(id arg0, id arg1) { - objc_retainBlock(block); - block(objc_retain(arg0), objc_retain(arg1)); - }; -} - -typedef void (^_ListenerTrampoline7)(void * arg0); -_ListenerTrampoline7 _wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { - return ^void(void * arg0) { - objc_retainBlock(block); - block(arg0); - }; -} - -typedef void (^_ListenerTrampoline8)(BOOL arg0); -_ListenerTrampoline8 _wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { - return ^void(BOOL arg0) { - objc_retainBlock(block); - block(arg0); - }; -} - -typedef void (^_ListenerTrampoline9)(id arg0, NSMatchingFlags arg1, BOOL * arg2); -_ListenerTrampoline9 _wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { - return ^void(id arg0, NSMatchingFlags arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, arg2); - }; -} - -typedef void (^_ListenerTrampoline10)(id arg0, id arg1, id arg2); -_ListenerTrampoline10 _wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { - return ^void(id arg0, id arg1, id arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), objc_retain(arg1), objc_retain(arg2)); - }; -} - -typedef void (^_ListenerTrampoline11)(id arg0, BOOL arg1, id arg2); -_ListenerTrampoline11 _wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { - return ^void(id arg0, BOOL arg1, id arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, objc_retain(arg2)); - }; -} - -typedef void (^_ListenerTrampoline12)(BOOL arg0, id arg1); -_ListenerTrampoline12 _wrapListenerBlock_1ej8563(_ListenerTrampoline12 block) NS_RETURNS_RETAINED { - return ^void(BOOL arg0, id arg1) { - objc_retainBlock(block); - block(arg0, objc_retain(arg1)); - }; -} diff --git a/pkgs/ffigen/example/objective_c/play_audio.dart b/pkgs/ffigen/example/objective_c/play_audio.dart index bca46b65a..6a6188291 100644 --- a/pkgs/ffigen/example/objective_c/play_audio.dart +++ b/pkgs/ffigen/example/objective_c/play_audio.dart @@ -6,10 +6,14 @@ import 'dart:ffi'; import 'package:objective_c/objective_c.dart'; import 'avf_audio_bindings.dart'; +// TODO(https://github.com/dart-lang/native/issues/1068): Remove this. +import '../../../objective_c/test/setup.dart' as objCSetup; + const _dylibPath = '/System/Library/Frameworks/AVFAudio.framework/Versions/Current/AVFAudio'; void main(List args) async { + objCSetup.main([]); DynamicLibrary.open(_dylibPath); for (final file in args) { final fileStr = NSString(file); diff --git a/pkgs/ffigen/example/objective_c/pubspec.yaml b/pkgs/ffigen/example/objective_c/pubspec.yaml index 6b687f598..8ce0791fc 100644 --- a/pkgs/ffigen/example/objective_c/pubspec.yaml +++ b/pkgs/ffigen/example/objective_c/pubspec.yaml @@ -8,11 +8,13 @@ environment: sdk: '>=3.2.0 <4.0.0' dependencies: + args: ^2.6.0 ffi: ^2.0.1 objective_c: ^0.0.1 + dev_dependencies: ffigen: - path: '../../' + path: ../../ lints: ^2.0.0 dependency_overrides: diff --git a/pkgs/ffigen/example/shared_bindings/generate.dart b/pkgs/ffigen/example/shared_bindings/generate.dart index 2952bf1d8..508f98137 100644 --- a/pkgs/ffigen/example/shared_bindings/generate.dart +++ b/pkgs/ffigen/example/shared_bindings/generate.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:cli_util/cli_util.dart'; import 'package:path/path.dart' as p; -ProcessResult runFfigenForConfig(String sdkPath, String configPath) { +ProcessResult runFfigenForConfig(String configPath) { return Process.runSync( p.join(sdkPath, 'bin', 'dart'), [ @@ -16,14 +16,13 @@ ProcessResult runFfigenForConfig(String sdkPath, String configPath) { } void main() { - final sdkPath = getSdkPath(); final configPaths = [ 'ffigen_configs/base.yaml', 'ffigen_configs/a.yaml', 'ffigen_configs/a_shared_base.yaml' ]; for (final configPath in configPaths) { - final res = runFfigenForConfig(sdkPath, configPath); + final res = runFfigenForConfig(configPath); print(res.stdout.toString()); if (res.exitCode != 0) { throw Exception('Some error occurred: ${res.stderr.toString()}'); diff --git a/pkgs/ffigen/example/shared_bindings/headers/a.h b/pkgs/ffigen/example/shared_bindings/headers/a.h index ef3bbea37..b2088985f 100644 --- a/pkgs/ffigen/example/shared_bindings/headers/a.h +++ b/pkgs/ffigen/example/shared_bindings/headers/a.h @@ -19,3 +19,10 @@ enum A_Enum{ void a_func1(); void a_func2(struct BaseStruct2 s, union BaseUnion2 u, BaseTypedef2 t); + +void a_func3(BaseNativeTypedef1 i); + +void a_func4(BaseNativeTypedef2 i); + +void a_func5(BaseNativeTypedef3 i); + diff --git a/pkgs/ffigen/example/shared_bindings/headers/base.h b/pkgs/ffigen/example/shared_bindings/headers/base.h index 345cac64e..61909a3fd 100644 --- a/pkgs/ffigen/example/shared_bindings/headers/base.h +++ b/pkgs/ffigen/example/shared_bindings/headers/base.h @@ -20,6 +20,9 @@ union BaseUnion2{ typedef struct BaseStruct1 BaseTypedef1; typedef struct BaseStruct2 BaseTypedef2; +typedef int BaseNativeTypedef1; +typedef BaseNativeTypedef1 BaseNativeTypedef2; +typedef BaseNativeTypedef2 BaseNativeTypedef3; enum BaseEnum{ BASE_ENUM_1, @@ -29,3 +32,4 @@ enum BaseEnum{ #define BASE_MACRO_1 1; void base_func1(BaseTypedef1 t1, BaseTypedef2 t2); + diff --git a/pkgs/ffigen/example/shared_bindings/lib/generated/a_gen.dart b/pkgs/ffigen/example/shared_bindings/lib/generated/a_gen.dart index 8f92d2216..bfcf7bbde 100644 --- a/pkgs/ffigen/example/shared_bindings/lib/generated/a_gen.dart +++ b/pkgs/ffigen/example/shared_bindings/lib/generated/a_gen.dart @@ -63,6 +63,45 @@ class NativeLibraryA { ffi.Void Function(BaseStruct2, BaseUnion2, BaseTypedef2)>>('a_func2'); late final _a_func2 = _a_func2Ptr .asFunction(); + + void a_func3( + int i, + ) { + return _a_func3( + i, + ); + } + + late final _a_func3Ptr = + _lookup>( + 'a_func3'); + late final _a_func3 = _a_func3Ptr.asFunction(); + + void a_func4( + int i, + ) { + return _a_func4( + i, + ); + } + + late final _a_func4Ptr = + _lookup>( + 'a_func4'); + late final _a_func4 = _a_func4Ptr.asFunction(); + + void a_func5( + int i, + ) { + return _a_func5( + i, + ); + } + + late final _a_func5Ptr = + _lookup>( + 'a_func5'); + late final _a_func5 = _a_func5Ptr.asFunction(); } final class BaseStruct1 extends ffi.Struct { @@ -85,16 +124,26 @@ final class BaseUnion2 extends ffi.Union { external int a; } +typedef BaseTypedef1 = BaseStruct1; +typedef BaseTypedef2 = BaseStruct2; +typedef BaseNativeTypedef1 = ffi.Int; +typedef DartBaseNativeTypedef1 = int; +typedef BaseNativeTypedef2 = BaseNativeTypedef1; +typedef BaseNativeTypedef3 = BaseNativeTypedef2; + enum BaseEnum { BASE_ENUM_1(0), BASE_ENUM_2(1); final int value; const BaseEnum(this.value); -} -typedef BaseTypedef1 = BaseStruct1; -typedef BaseTypedef2 = BaseStruct2; + static BaseEnum fromValue(int value) => switch (value) { + 0 => BASE_ENUM_1, + 1 => BASE_ENUM_2, + _ => throw ArgumentError("Unknown value for BaseEnum: $value"), + }; +} final class A_Struct1 extends ffi.Struct { @ffi.Int() diff --git a/pkgs/ffigen/example/shared_bindings/lib/generated/a_shared_b_gen.dart b/pkgs/ffigen/example/shared_bindings/lib/generated/a_shared_b_gen.dart index c220cab4f..730cd57cd 100644 --- a/pkgs/ffigen/example/shared_bindings/lib/generated/a_shared_b_gen.dart +++ b/pkgs/ffigen/example/shared_bindings/lib/generated/a_shared_b_gen.dart @@ -49,6 +49,48 @@ class NativeLibraryASharedB { imp1.BaseTypedef2)>>('a_func2'); late final _a_func2 = _a_func2Ptr.asFunction< void Function(imp1.BaseStruct2, imp1.BaseUnion2, imp1.BaseTypedef2)>(); + + void a_func3( + imp1.DartBaseNativeTypedef1 i, + ) { + return _a_func3( + i, + ); + } + + late final _a_func3Ptr = + _lookup>( + 'a_func3'); + late final _a_func3 = + _a_func3Ptr.asFunction(); + + void a_func4( + imp1.DartBaseNativeTypedef1 i, + ) { + return _a_func4( + i, + ); + } + + late final _a_func4Ptr = + _lookup>( + 'a_func4'); + late final _a_func4 = + _a_func4Ptr.asFunction(); + + void a_func5( + imp1.DartBaseNativeTypedef1 i, + ) { + return _a_func5( + i, + ); + } + + late final _a_func5Ptr = + _lookup>( + 'a_func5'); + late final _a_func5 = + _a_func5Ptr.asFunction(); } final class A_Struct1 extends ffi.Struct { diff --git a/pkgs/ffigen/example/shared_bindings/lib/generated/base_gen.dart b/pkgs/ffigen/example/shared_bindings/lib/generated/base_gen.dart index 729765a92..224400fd1 100644 --- a/pkgs/ffigen/example/shared_bindings/lib/generated/base_gen.dart +++ b/pkgs/ffigen/example/shared_bindings/lib/generated/base_gen.dart @@ -59,15 +59,25 @@ final class BaseUnion2 extends ffi.Union { external int a; } +typedef BaseTypedef1 = BaseStruct1; +typedef BaseTypedef2 = BaseStruct2; +typedef BaseNativeTypedef1 = ffi.Int; +typedef DartBaseNativeTypedef1 = int; +typedef BaseNativeTypedef2 = BaseNativeTypedef1; +typedef BaseNativeTypedef3 = BaseNativeTypedef2; + enum BaseEnum { BASE_ENUM_1(0), BASE_ENUM_2(1); final int value; const BaseEnum(this.value); -} -typedef BaseTypedef1 = BaseStruct1; -typedef BaseTypedef2 = BaseStruct2; + static BaseEnum fromValue(int value) => switch (value) { + 0 => BASE_ENUM_1, + 1 => BASE_ENUM_2, + _ => throw ArgumentError("Unknown value for BaseEnum: $value"), + }; +} const int BASE_MACRO_1 = 1; diff --git a/pkgs/ffigen/example/shared_bindings/lib/generated/base_symbols.yaml b/pkgs/ffigen/example/shared_bindings/lib/generated/base_symbols.yaml index ad455faa4..4d9ef56a5 100644 --- a/pkgs/ffigen/example/shared_bindings/lib/generated/base_symbols.yaml +++ b/pkgs/ffigen/example/shared_bindings/lib/generated/base_symbols.yaml @@ -16,6 +16,15 @@ files: name: BaseUnion1 c:@U@BaseUnion2: name: BaseUnion2 + c:base.h@T@BaseNativeTypedef1: + name: BaseNativeTypedef1 + dart-name: DartBaseNativeTypedef1 + c:base.h@T@BaseNativeTypedef2: + name: BaseNativeTypedef2 + dart-name: DartBaseNativeTypedef1 + c:base.h@T@BaseNativeTypedef3: + name: BaseNativeTypedef3 + dart-name: DartBaseNativeTypedef1 c:base.h@T@BaseTypedef1: name: BaseTypedef1 c:base.h@T@BaseTypedef2: diff --git a/pkgs/ffigen/example/shared_bindings/pubspec.yaml b/pkgs/ffigen/example/shared_bindings/pubspec.yaml index 1684c9903..42a6120ef 100644 --- a/pkgs/ffigen/example/shared_bindings/pubspec.yaml +++ b/pkgs/ffigen/example/shared_bindings/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.2.0 <4.0.0' dependencies: - cli_util: ^0.4.0 + cli_util: ^0.4.2 ffi: ^2.0.1 path: ^1.8.0 diff --git a/pkgs/ffigen/example/swift/example.dart b/pkgs/ffigen/example/swift/example.dart index b6188ce8c..2185ab93d 100644 --- a/pkgs/ffigen/example/swift/example.dart +++ b/pkgs/ffigen/example/swift/example.dart @@ -5,7 +5,12 @@ import 'dart:ffi'; import 'swift_api_bindings.dart'; +// TODO(https://github.com/dart-lang/native/issues/1068): Remove this. +import '../../../objective_c/test/setup.dart' as objCSetup; + void main() { + objCSetup.main([]); + // TODO(https://github.com/dart-lang/ffigen/issues/443): Add a test for this. DynamicLibrary.open('libswiftapi.dylib'); final object = SwiftClass.new1(); diff --git a/pkgs/ffigen/example/swift/pubspec.yaml b/pkgs/ffigen/example/swift/pubspec.yaml index 737d3fb6c..1194dde57 100644 --- a/pkgs/ffigen/example/swift/pubspec.yaml +++ b/pkgs/ffigen/example/swift/pubspec.yaml @@ -8,11 +8,13 @@ environment: sdk: ">=3.2.0-42.1.beta <4.0.0" dependencies: + args: ^2.6.0 ffi: ^2.0.1 objective_c: ^0.0.1 + dev_dependencies: ffigen: - path: "../../" + path: ../../ lints: ^2.0.0 dependency_overrides: diff --git a/pkgs/ffigen/example/swift/swift_api_bindings.dart b/pkgs/ffigen/example/swift/swift_api_bindings.dart index aca53c506..8f3b41625 100644 --- a/pkgs/ffigen/example/swift/swift_api_bindings.dart +++ b/pkgs/ffigen/example/swift/swift_api_bindings.dart @@ -14,95 +14,12 @@ // ignore_for_file: type=lint import 'dart:ffi' as ffi; import 'package:objective_c/objective_c.dart' as objc; -import 'package:ffi/ffi.dart' as pkg_ffi; -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ksby9f( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1k41wmu( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_sjfpmz( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1j7ar3u( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_rvgf02( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ukcdfq( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1tjlcwl( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hepzs( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_117qins( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_9w6y6n( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_tenbla( - ffi.Pointer block, -); - -@ffi.Native< - ffi.Pointer Function( - ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hfhq9m( - ffi.Pointer block, -); +final class _NSZone extends ffi.Opaque {} -late final _class_NSProgress = objc.getClass("NSProgress"); +late final _class_SwiftClass = objc.getClass("swift_module.SwiftClass"); late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); -final _objc_msgSend_l8lotg = objc.msgSendPointer +final _objc_msgSend_69e0x1 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Bool Function( @@ -112,8 +29,8 @@ final _objc_msgSend_l8lotg = objc.msgSendPointer .asFunction< bool Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); -late final _sel_currentProgress = objc.registerName("currentProgress"); -final _objc_msgSend_1unuoxw = objc.msgSendPointer +late final _sel_sayHello = objc.registerName("sayHello"); +final _objc_msgSend_1x359cv = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function(ffi.Pointer, @@ -121,363 +38,95 @@ final _objc_msgSend_1unuoxw = objc.msgSendPointer .asFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer)>(); -late final _sel_progressWithTotalUnitCount_ = - objc.registerName("progressWithTotalUnitCount:"); -final _objc_msgSend_n9eq1n = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int64)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_discreteProgressWithTotalUnitCount_ = - objc.registerName("discreteProgressWithTotalUnitCount:"); -late final _sel_progressWithTotalUnitCount_parent_pendingUnitCount_ = - objc.registerName("progressWithTotalUnitCount:parent:pendingUnitCount:"); -final _objc_msgSend_105mybv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int64, - ffi.Pointer, - ffi.Int64)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - int)>(); -typedef instancetype = ffi.Pointer; -typedef Dartinstancetype = objc.ObjCObjectBase; -late final _sel_initWithParent_userInfo_ = - objc.registerName("initWithParent:userInfo:"); -final _objc_msgSend_iq11qg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_becomeCurrentWithPendingUnitCount_ = - objc.registerName("becomeCurrentWithPendingUnitCount:"); -final _objc_msgSend_rrr3q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Int64)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -void _ObjCBlock_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, -) => - block.ref.target - .cast>() - .asFunction()(); -ffi.Pointer _ObjCBlock_ffiVoid_fnPtrCallable = ffi.Pointer - .fromFunction)>( - _ObjCBlock_ffiVoid_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_closureTrampoline( - ffi.Pointer block, -) => - (objc.getBlockClosure(block) as void Function())(); -ffi.Pointer _ObjCBlock_ffiVoid_closureCallable = ffi.Pointer - .fromFunction)>( - _ObjCBlock_ffiVoid_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_listenerTrampoline( - ffi.Pointer block, -) { - (objc.getBlockClosure(block) as void Function())(); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable)> - _ObjCBlock_ffiVoid_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer> ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction(void Function() fn) => - objc.ObjCBlock( - objc.newClosureBlock(_ObjCBlock_ffiVoid_closureCallable, () => fn()), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener(void Function() fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_listenerCallable.nativeFunction.cast(), () => fn()); - final wrapper = _wrapListenerBlock_ksby9f(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_CallExtension - on objc.ObjCBlock { - void call() => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block)>>() - .asFunction)>()( - ref.pointer, - ); -} - -late final _sel_performAsCurrentWithPendingUnitCount_usingBlock_ = - objc.registerName("performAsCurrentWithPendingUnitCount:usingBlock:"); -final _objc_msgSend_19q84do = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int64, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_resignCurrent = objc.registerName("resignCurrent"); -final _objc_msgSend_ksby9f = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_addChild_withPendingUnitCount_ = - objc.registerName("addChild:withPendingUnitCount:"); -final _objc_msgSend_2citz1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Int64)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_totalUnitCount = objc.registerName("totalUnitCount"); -final _objc_msgSend_1voti03 = objc.msgSendPointer +late final _sel_someField = objc.registerName("someField"); +final _objc_msgSend_1hz7y9r = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Int64 Function(ffi.Pointer, + ffi.Long Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< int Function( ffi.Pointer, ffi.Pointer)>(); -late final _sel_setTotalUnitCount_ = objc.registerName("setTotalUnitCount:"); -late final _sel_completedUnitCount = objc.registerName("completedUnitCount"); -late final _sel_setCompletedUnitCount_ = - objc.registerName("setCompletedUnitCount:"); -late final _sel_localizedDescription = - objc.registerName("localizedDescription"); -late final _sel_setLocalizedDescription_ = - objc.registerName("setLocalizedDescription:"); -final _objc_msgSend_ukcdfq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_localizedAdditionalDescription = - objc.registerName("localizedAdditionalDescription"); -late final _sel_setLocalizedAdditionalDescription_ = - objc.registerName("setLocalizedAdditionalDescription:"); -late final _sel_isCancellable = objc.registerName("isCancellable"); -final _objc_msgSend_olxnu1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setCancellable_ = objc.registerName("setCancellable:"); -final _objc_msgSend_117qins = objc.msgSendPointer +late final _sel_setSomeField_ = objc.registerName("setSomeField:"); +final _objc_msgSend_4sp4xj = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Bool)>>() + ffi.Pointer, ffi.Long)>>() .asFunction< void Function(ffi.Pointer, - ffi.Pointer, bool)>(); -late final _sel_isPausable = objc.registerName("isPausable"); -late final _sel_setPausable_ = objc.registerName("setPausable:"); -late final _sel_isCancelled = objc.registerName("isCancelled"); -late final _sel_isPaused = objc.registerName("isPaused"); -late final _sel_cancellationHandler = objc.registerName("cancellationHandler"); -final _objc_msgSend_2osec1 = objc.msgSendPointer + ffi.Pointer, int)>(); +typedef instancetype = ffi.Pointer; +typedef Dartinstancetype = objc.ObjCObjectBase; +late final _sel_init = objc.registerName("init"); +late final _sel_new = objc.registerName("new"); +late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); +final _objc_msgSend_hzlb60 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>>() .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setCancellationHandler_ = - objc.registerName("setCancellationHandler:"); -void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>(); +late final _sel_alloc = objc.registerName("alloc"); +late final _sel_self = objc.registerName("self"); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => block.ref.target .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() + ffi.Pointer Function( + ffi.Pointer arg0)>>() .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrCallable = + ffi.Pointer Function( + ffi.Pointer)>()(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline) + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureCallable = +ffi.Pointer + _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as ffi.Pointer Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureTrampoline) + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool { +/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. +abstract final class ObjCBlock_objcObjCObject_ffiVoid { /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> + static objc + .ObjCBlock Function(ffi.Pointer)> castFromPointer(ffi.Pointer pointer, {bool retain = false, bool release = false}) => objc.ObjCBlock< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(pointer, - retain: retain, release: release); + ffi.Pointer Function(ffi.Pointer)>( + pointer, + retain: retain, + release: release); /// Creates a block from a C function pointer. /// /// This block must be invoked by native code running on the same thread as /// the isolate that registered it. Invoking the block on the wrong thread /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrCallable, ptr.cast()), + static objc.ObjCBlock Function(ffi.Pointer)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock Function(ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, ptr.cast()), retain: false, release: true); @@ -487,38512 +136,48 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool { /// the isolate that registered it. Invoking the block on the wrong thread /// will result in a crash. static objc - .ObjCBlock, ffi.Pointer, ffi.Pointer)> - fromFunction(void Function(objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) fn) => - objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>( + .ObjCBlock Function(ffi.Pointer)> + fromFunction(objc.ObjCObjectBase Function(ffi.Pointer) fn) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer)>( objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2) => fn( - objc.ObjCObjectBase(arg0, retain: true, release: true), - objc.ObjCObjectBase(arg1, retain: true, release: true), - arg2)), + _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, + (ffi.Pointer arg0) => + fn(arg0).ref.retainAndAutorelease()), retain: false, release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> listener( - void Function( - objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn(objc.ObjCObjectBase(arg0, retain: false, release: true), - objc.ObjCObjectBase(arg1, retain: false, release: true), arg2)); - final wrapper = _wrapListenerBlock_1k41wmu(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(wrapper, retain: false, release: true); - } } -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> { - void call(objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1, - ffi.Pointer arg2) => +/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. +extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension on objc + .ObjCBlock Function(ffi.Pointer)> { + objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2); + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0), + retain: true, + release: true); } -final _objc_msgSend_4daxhl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_pausingHandler = objc.registerName("pausingHandler"); -late final _sel_setPausingHandler_ = objc.registerName("setPausingHandler:"); -late final _sel_resumingHandler = objc.registerName("resumingHandler"); -late final _sel_setResumingHandler_ = objc.registerName("setResumingHandler:"); -late final _sel_setUserInfoObject_forKey_ = - objc.registerName("setUserInfoObject:forKey:"); -final _objc_msgSend_1tjlcwl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isIndeterminate = objc.registerName("isIndeterminate"); -late final _sel_fractionCompleted = objc.registerName("fractionCompleted"); -final _objc_msgSend_10noklm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_10noklmFpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isFinished = objc.registerName("isFinished"); -late final _sel_cancel = objc.registerName("cancel"); -late final _sel_pause = objc.registerName("pause"); -late final _sel_resume = objc.registerName("resume"); -late final _sel_userInfo = objc.registerName("userInfo"); -late final _sel_kind = objc.registerName("kind"); -late final _sel_setKind_ = objc.registerName("setKind:"); -late final _sel_estimatedTimeRemaining = - objc.registerName("estimatedTimeRemaining"); -late final _sel_setEstimatedTimeRemaining_ = - objc.registerName("setEstimatedTimeRemaining:"); -late final _sel_throughput = objc.registerName("throughput"); -late final _sel_setThroughput_ = objc.registerName("setThroughput:"); -late final _sel_fileOperationKind = objc.registerName("fileOperationKind"); -late final _sel_setFileOperationKind_ = - objc.registerName("setFileOperationKind:"); -late final _sel_fileURL = objc.registerName("fileURL"); -late final _sel_setFileURL_ = objc.registerName("setFileURL:"); -late final _sel_fileTotalCount = objc.registerName("fileTotalCount"); -late final _sel_setFileTotalCount_ = objc.registerName("setFileTotalCount:"); -late final _sel_fileCompletedCount = objc.registerName("fileCompletedCount"); -late final _sel_setFileCompletedCount_ = - objc.registerName("setFileCompletedCount:"); -late final _sel_publish = objc.registerName("publish"); -late final _sel_unpublish = objc.registerName("unpublish"); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSProgress_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSProgress_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSProgress_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock? Function(NSProgress)>`. -abstract final class ObjCBlock_ffiVoid_NSProgress { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock? Function(NSProgress)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.ObjCBlock? Function( - NSProgress)>(pointer, retain: retain, release: release); +late final _sel_retain = objc.registerName("retain"); +late final _sel_autorelease = objc.registerName("autorelease"); - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock? Function(NSProgress)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock? Function(NSProgress)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSProgress_fnPtrCallable, ptr.cast()), - retain: false, - release: true); +/// SwiftClass +class SwiftClass extends objc.NSObject { + SwiftClass._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.ObjCBlock? Function(NSProgress)> fromFunction( - objc.ObjCBlock? Function(NSProgress) fn) => - objc.ObjCBlock? Function(NSProgress)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSProgress_closureCallable, - (ffi.Pointer arg0) => - fn(NSProgress.castFromPointer(arg0, retain: true, release: true)) - ?.ref - .retainAndAutorelease() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock? Function(NSProgress)>`. -extension ObjCBlock_ffiVoid_NSProgress_CallExtension on objc - .ObjCBlock? Function(NSProgress)> { - objc.ObjCBlock? call(NSProgress arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer)>() - (ref.pointer, arg0.ref.pointer) - .address == - 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer( - ref.pointer.ref.invoke - .cast Function(ffi.Pointer block, ffi.Pointer arg0)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0.ref.pointer), - retain: true, - release: true); -} - -late final _sel_addSubscriberForFileURL_withPublishingHandler_ = - objc.registerName("addSubscriberForFileURL:withPublishingHandler:"); -final _objc_msgSend_1kkhn3j = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_removeSubscriber_ = objc.registerName("removeSubscriber:"); -late final _sel_isOld = objc.registerName("isOld"); -late final _sel_init = objc.registerName("init"); -late final _sel_new = objc.registerName("new"); - -final class _NSZone extends ffi.Opaque {} - -late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); -final _objc_msgSend_1b3ihd0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<_NSZone>)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<_NSZone>)>(); -late final _sel_alloc = objc.registerName("alloc"); -late final _sel_cancelPreviousPerformRequestsWithTarget_selector_object_ = objc - .registerName("cancelPreviousPerformRequestsWithTarget:selector:object:"); -final _objc_msgSend_cqxsqq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_cancelPreviousPerformRequestsWithTarget_ = - objc.registerName("cancelPreviousPerformRequestsWithTarget:"); -late final _sel_accessInstanceVariablesDirectly = - objc.registerName("accessInstanceVariablesDirectly"); -late final _sel_useStoredAccessor = objc.registerName("useStoredAccessor"); -late final _sel_keyPathsForValuesAffectingValueForKey_ = - objc.registerName("keyPathsForValuesAffectingValueForKey:"); -final _objc_msgSend_juohf7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_automaticallyNotifiesObserversForKey_ = - objc.registerName("automaticallyNotifiesObserversForKey:"); -late final _sel_setKeys_triggerChangeNotificationsForDependentKey_ = - objc.registerName("setKeys:triggerChangeNotificationsForDependentKey:"); -late final _sel_classFallbacksForKeyedArchiver = - objc.registerName("classFallbacksForKeyedArchiver"); -late final _sel_classForKeyedUnarchiver = - objc.registerName("classForKeyedUnarchiver"); - -/// NSProgress -class NSProgress extends objc.NSObject { - NSProgress._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSProgress] that points to the same underlying object as [other]. - NSProgress.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSProgress] that wraps the given raw object pointer. - NSProgress.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSProgress]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSProgress); - } - - /// currentProgress - static NSProgress? currentProgress() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProgress, _sel_currentProgress); - return _ret.address == 0 - ? null - : NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// progressWithTotalUnitCount: - static NSProgress progressWithTotalUnitCount_(int unitCount) { - final _ret = _objc_msgSend_n9eq1n( - _class_NSProgress, _sel_progressWithTotalUnitCount_, unitCount); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// discreteProgressWithTotalUnitCount: - static NSProgress discreteProgressWithTotalUnitCount_(int unitCount) { - final _ret = _objc_msgSend_n9eq1n( - _class_NSProgress, _sel_discreteProgressWithTotalUnitCount_, unitCount); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// progressWithTotalUnitCount:parent:pendingUnitCount: - static NSProgress progressWithTotalUnitCount_parent_pendingUnitCount_( - int unitCount, NSProgress parent, int portionOfParentTotalUnitCount) { - final _ret = _objc_msgSend_105mybv( - _class_NSProgress, - _sel_progressWithTotalUnitCount_parent_pendingUnitCount_, - unitCount, - parent.ref.pointer, - portionOfParentTotalUnitCount); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithParent:userInfo: - NSProgress initWithParent_userInfo_( - NSProgress? parentProgressOrNil, objc.ObjCObjectBase? userInfoOrNil) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithParent_userInfo_, - parentProgressOrNil?.ref.pointer ?? ffi.nullptr, - userInfoOrNil?.ref.pointer ?? ffi.nullptr); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// becomeCurrentWithPendingUnitCount: - void becomeCurrentWithPendingUnitCount_(int unitCount) { - _objc_msgSend_rrr3q( - this.ref.pointer, _sel_becomeCurrentWithPendingUnitCount_, unitCount); - } - - /// performAsCurrentWithPendingUnitCount:usingBlock: - void performAsCurrentWithPendingUnitCount_usingBlock_( - int unitCount, objc.ObjCBlock work) { - _objc_msgSend_19q84do( - this.ref.pointer, - _sel_performAsCurrentWithPendingUnitCount_usingBlock_, - unitCount, - work.ref.pointer); - } - - /// resignCurrent - void resignCurrent() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resignCurrent); - } - - /// addChild:withPendingUnitCount: - void addChild_withPendingUnitCount_(NSProgress child, int inUnitCount) { - _objc_msgSend_2citz1(this.ref.pointer, _sel_addChild_withPendingUnitCount_, - child.ref.pointer, inUnitCount); - } - - /// totalUnitCount - int get totalUnitCount { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_totalUnitCount); - } - - /// setTotalUnitCount: - set totalUnitCount(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setTotalUnitCount_, value); - } - - /// completedUnitCount - int get completedUnitCount { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_completedUnitCount); - } - - /// setCompletedUnitCount: - set completedUnitCount(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setCompletedUnitCount_, value); - } - - /// localizedDescription - objc.NSString get localizedDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedDescription); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocalizedDescription: - set localizedDescription(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocalizedDescription_, value.ref.pointer); - } - - /// localizedAdditionalDescription - objc.NSString get localizedAdditionalDescription { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_localizedAdditionalDescription); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocalizedAdditionalDescription: - set localizedAdditionalDescription(objc.NSString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setLocalizedAdditionalDescription_, value.ref.pointer); - } - - /// isCancellable - bool get cancellable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isCancellable); - } - - /// setCancellable: - set cancellable(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setCancellable_, value); - } - - /// isPausable - bool get pausable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isPausable); - } - - /// setPausable: - set pausable(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setPausable_, value); - } - - /// isCancelled - bool get cancelled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isCancelled); - } - - /// isPaused - bool get paused { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isPaused); - } - - /// cancellationHandler - objc.ObjCBlock? get cancellationHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_cancellationHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setCancellationHandler: - set cancellationHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setCancellationHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// pausingHandler - objc.ObjCBlock? get pausingHandler { - final _ret = _objc_msgSend_2osec1(this.ref.pointer, _sel_pausingHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setPausingHandler: - set pausingHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setPausingHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// resumingHandler - objc.ObjCBlock? get resumingHandler { - final _ret = _objc_msgSend_2osec1(this.ref.pointer, _sel_resumingHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setResumingHandler: - set resumingHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setResumingHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setUserInfoObject:forKey: - void setUserInfoObject_forKey_( - objc.ObjCObjectBase? objectOrNil, objc.NSString key) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_setUserInfoObject_forKey_, - objectOrNil?.ref.pointer ?? ffi.nullptr, key.ref.pointer); - } - - /// isIndeterminate - bool get indeterminate { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isIndeterminate); - } - - /// fractionCompleted - double get fractionCompleted { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_fractionCompleted) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_fractionCompleted); - } - - /// isFinished - bool get finished { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isFinished); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// pause - void pause() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_pause); - } - - /// resume - void resume() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resume); - } - - /// userInfo - objc.ObjCObjectBase get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// kind - objc.NSString? get kind { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_kind); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setKind: - set kind(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setKind_, value?.ref.pointer ?? ffi.nullptr); - } - - /// estimatedTimeRemaining - objc.NSNumber? get estimatedTimeRemaining { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_estimatedTimeRemaining); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setEstimatedTimeRemaining: - set estimatedTimeRemaining(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setEstimatedTimeRemaining_, value?.ref.pointer ?? ffi.nullptr); - } - - /// throughput - objc.NSNumber? get throughput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_throughput); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setThroughput: - set throughput(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setThroughput_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// fileOperationKind - objc.NSString? get fileOperationKind { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileOperationKind); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileOperationKind: - set fileOperationKind(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setFileOperationKind_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// fileURL - objc.NSURL? get fileURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileURL: - set fileURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFileURL_, value?.ref.pointer ?? ffi.nullptr); - } - - /// fileTotalCount - objc.NSNumber? get fileTotalCount { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileTotalCount); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileTotalCount: - set fileTotalCount(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setFileTotalCount_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// fileCompletedCount - objc.NSNumber? get fileCompletedCount { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileCompletedCount); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileCompletedCount: - set fileCompletedCount(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setFileCompletedCount_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// publish - void publish() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_publish); - } - - /// unpublish - void unpublish() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_unpublish); - } - - /// addSubscriberForFileURL:withPublishingHandler: - static objc.ObjCObjectBase addSubscriberForFileURL_withPublishingHandler_( - objc.NSURL url, - objc.ObjCBlock? Function(NSProgress)> - publishingHandler) { - final _ret = _objc_msgSend_1kkhn3j( - _class_NSProgress, - _sel_addSubscriberForFileURL_withPublishingHandler_, - url.ref.pointer, - publishingHandler.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// removeSubscriber: - static void removeSubscriber_(objc.ObjCObjectBase subscriber) { - _objc_msgSend_ukcdfq( - _class_NSProgress, _sel_removeSubscriber_, subscriber.ref.pointer); - } - - /// isOld - bool get old { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isOld); - } - - /// init - NSProgress init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSProgress new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProgress, _sel_new); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSProgress allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSProgress, _sel_allocWithZone_, zone); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSProgress alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProgress, _sel_alloc); - return NSProgress.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSProgress, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSProgress, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSProgress, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSProgress, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSProgress, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSProgress, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSProgress, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSProgress, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSProgress, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSBundle = objc.getClass("NSBundle"); -late final _sel_mainBundle = objc.registerName("mainBundle"); -late final _sel_bundleWithPath_ = objc.registerName("bundleWithPath:"); -late final _sel_initWithPath_ = objc.registerName("initWithPath:"); -late final _sel_bundleWithURL_ = objc.registerName("bundleWithURL:"); -late final _sel_initWithURL_ = objc.registerName("initWithURL:"); -late final _sel_bundleForClass_ = objc.registerName("bundleForClass:"); -late final _sel_bundleWithIdentifier_ = - objc.registerName("bundleWithIdentifier:"); -late final _sel_allBundles = objc.registerName("allBundles"); -late final _sel_allFrameworks = objc.registerName("allFrameworks"); -late final _sel_load = objc.registerName("load"); -late final _sel_isLoaded = objc.registerName("isLoaded"); -late final _sel_unload = objc.registerName("unload"); -late final _sel_preflightAndReturnError_ = - objc.registerName("preflightAndReturnError:"); -final _objc_msgSend_1rk90ll = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_loadAndReturnError_ = objc.registerName("loadAndReturnError:"); -late final _sel_bundleURL = objc.registerName("bundleURL"); -late final _sel_resourceURL = objc.registerName("resourceURL"); -late final _sel_executableURL = objc.registerName("executableURL"); -late final _sel_URLForAuxiliaryExecutable_ = - objc.registerName("URLForAuxiliaryExecutable:"); -late final _sel_privateFrameworksURL = - objc.registerName("privateFrameworksURL"); -late final _sel_sharedFrameworksURL = objc.registerName("sharedFrameworksURL"); -late final _sel_sharedSupportURL = objc.registerName("sharedSupportURL"); -late final _sel_builtInPlugInsURL = objc.registerName("builtInPlugInsURL"); -late final _sel_appStoreReceiptURL = objc.registerName("appStoreReceiptURL"); -late final _sel_bundlePath = objc.registerName("bundlePath"); -late final _sel_resourcePath = objc.registerName("resourcePath"); -late final _sel_executablePath = objc.registerName("executablePath"); -late final _sel_pathForAuxiliaryExecutable_ = - objc.registerName("pathForAuxiliaryExecutable:"); -late final _sel_privateFrameworksPath = - objc.registerName("privateFrameworksPath"); -late final _sel_sharedFrameworksPath = - objc.registerName("sharedFrameworksPath"); -late final _sel_sharedSupportPath = objc.registerName("sharedSupportPath"); -late final _sel_builtInPlugInsPath = objc.registerName("builtInPlugInsPath"); -late final _sel_URLForResource_withExtension_subdirectory_inBundleWithURL_ = - objc.registerName( - "URLForResource:withExtension:subdirectory:inBundleWithURL:"); -final _objc_msgSend_1qje3rk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_URLsForResourcesWithExtension_subdirectory_inBundleWithURL_ = - objc.registerName( - "URLsForResourcesWithExtension:subdirectory:inBundleWithURL:"); -final _objc_msgSend_aud7dn = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_URLForResource_withExtension_ = - objc.registerName("URLForResource:withExtension:"); -late final _sel_URLForResource_withExtension_subdirectory_ = - objc.registerName("URLForResource:withExtension:subdirectory:"); -late final _sel_URLForResource_withExtension_subdirectory_localization_ = objc - .registerName("URLForResource:withExtension:subdirectory:localization:"); -late final _sel_URLsForResourcesWithExtension_subdirectory_ = - objc.registerName("URLsForResourcesWithExtension:subdirectory:"); -late final _sel_URLsForResourcesWithExtension_subdirectory_localization_ = objc - .registerName("URLsForResourcesWithExtension:subdirectory:localization:"); -late final _sel_pathForResource_ofType_inDirectory_ = - objc.registerName("pathForResource:ofType:inDirectory:"); -late final _sel_pathsForResourcesOfType_inDirectory_ = - objc.registerName("pathsForResourcesOfType:inDirectory:"); -late final _sel_pathForResource_ofType_ = - objc.registerName("pathForResource:ofType:"); -late final _sel_pathForResource_ofType_inDirectory_forLocalization_ = - objc.registerName("pathForResource:ofType:inDirectory:forLocalization:"); -late final _sel_pathsForResourcesOfType_inDirectory_forLocalization_ = - objc.registerName("pathsForResourcesOfType:inDirectory:forLocalization:"); -late final _sel_localizedStringForKey_value_table_ = - objc.registerName("localizedStringForKey:value:table:"); -late final _class_NSAttributedString = objc.getClass("NSAttributedString"); -late final _sel_copyWithZone_ = objc.registerName("copyWithZone:"); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, ffi.Pointer<_NSZone>))(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_NSZone { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1)>> ptr) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer<_NSZone>) fn) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureCallable, - (ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1) => - fn(arg0, arg1).ref.retainAndReturnPointer()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_NSZone_CallExtension - on objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>()(ref.pointer, arg0, arg1), - retain: false, - release: true); -} - -late final _sel_mutableCopyWithZone_ = - objc.registerName("mutableCopyWithZone:"); -late final _sel_encodeWithCoder_ = objc.registerName("encodeWithCoder:"); -void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock, objc.NSCoder)>`. -abstract final class ObjCBlock_ffiVoid_ffiVoid_NSCoder { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock, objc.NSCoder)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, - objc.NSCoder)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.NSCoder)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, objc.NSCoder)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.NSCoder)> - fromFunction(void Function(ffi.Pointer, objc.NSCoder) fn) => - objc.ObjCBlock, objc.NSCoder)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn( - arg0, - objc.NSCoder.castFromPointer(arg1, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock, objc.NSCoder)> - listener(void Function(ffi.Pointer, objc.NSCoder) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0, - objc.NSCoder.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_sjfpmz(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(ffi.Pointer, objc.NSCoder)>(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock, objc.NSCoder)>`. -extension ObjCBlock_ffiVoid_ffiVoid_NSCoder_CallExtension - on objc.ObjCBlock, objc.NSCoder)> { - void call(ffi.Pointer arg0, objc.NSCoder arg1) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer); -} - -late final _sel_initWithCoder_ = objc.registerName("initWithCoder:"); -instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable = - ffi.Pointer.fromFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline) - .cast(); -instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as instancetype Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable = - ffi.Pointer.fromFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>`. -abstract final class ObjCBlock_instancetype_ffiVoid_NSCoder { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, - objc.NSCoder)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => - objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)>( - objc.newPointerBlock( - _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)> fromFunction( - Dartinstancetype? Function(ffi.Pointer, objc.NSCoder) fn) => - objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>( - objc.newClosureBlock( - _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, objc.NSCoder.castFromPointer(arg1, retain: true, release: true)) - ?.ref - .retainAndReturnPointer() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>`. -extension ObjCBlock_instancetype_ffiVoid_NSCoder_CallExtension - on objc.ObjCBlock< - objc.Retained?> Function( - ffi.Pointer, objc.NSCoder)> { - Dartinstancetype? call(ffi.Pointer arg0, objc.NSCoder arg1) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction, ffi.Pointer, ffi.Pointer)>() - (ref.pointer, arg0, arg1.ref.pointer) - .address == - 0 - ? null - : objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast block, ffi.Pointer arg0, ffi.Pointer arg1)>>() - .asFunction, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0, arg1.ref.pointer), - retain: false, - release: true); -} - -late final _sel_supportsSecureCoding = - objc.registerName("supportsSecureCoding"); -bool _ObjCBlock_bool_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_bool_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as bool Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_bool_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_bool_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - bool Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock(_ObjCBlock_bool_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_bool_ffiVoid_CallExtension - on objc.ObjCBlock)> { - bool call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_string = objc.registerName("string"); -late final _sel_attributesAtIndex_effectiveRange_ = - objc.registerName("attributesAtIndex:effectiveRange:"); -final _objc_msgSend_1lz7qql = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, ffi.Pointer)>(); -late final _sel_length = objc.registerName("length"); -final _objc_msgSend_eldhrq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_attribute_atIndex_effectiveRange_ = - objc.registerName("attribute:atIndex:effectiveRange:"); -final _objc_msgSend_6erk1e = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_attributedSubstringFromRange_ = - objc.registerName("attributedSubstringFromRange:"); -final _objc_msgSend_176f8tz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>(); -late final _sel_attributesAtIndex_longestEffectiveRange_inRange_ = - objc.registerName("attributesAtIndex:longestEffectiveRange:inRange:"); -final _objc_msgSend_7mxs62 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_attribute_atIndex_longestEffectiveRange_inRange_ = - objc.registerName("attribute:atIndex:longestEffectiveRange:inRange:"); -final _objc_msgSend_1hy2clh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_isEqualToAttributedString_ = - objc.registerName("isEqualToAttributedString:"); -late final _sel_initWithString_ = objc.registerName("initWithString:"); -late final _sel_initWithString_attributes_ = - objc.registerName("initWithString:attributes:"); -late final _sel_initWithAttributedString_ = - objc.registerName("initWithAttributedString:"); - -enum NSAttributedStringEnumerationOptions { - NSAttributedStringEnumerationReverse(2), - NSAttributedStringEnumerationLongestEffectiveRangeNotRequired(1048576); - - final int value; - const NSAttributedStringEnumerationOptions(this.value); - - static NSAttributedStringEnumerationOptions fromValue(int value) => - switch (value) { - 2 => NSAttributedStringEnumerationReverse, - 1048576 => - NSAttributedStringEnumerationLongestEffectiveRangeNotRequired, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringEnumerationOptions: $value"), - }; -} - -void _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - objc.NSRange arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, objc.NSRange, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_NSDictionary_NSRange_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock)> - fromFunctionPointer(ffi.Pointer arg0, objc.NSRange arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDictionary, objc.NSRange, ffi.Pointer)> - fromFunction(void Function(objc.NSDictionary, objc.NSRange, ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_closureCallable, - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn(objc.NSDictionary.castFromPointer(arg0, retain: true, release: true), arg1, arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> listener( - void Function(objc.NSDictionary, objc.NSRange, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn( - objc.NSDictionary.castFromPointer(arg0, - retain: false, release: true), - arg1, - arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSDictionary, objc.NSRange, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_NSDictionary_NSRange_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> { - void call(objc.NSDictionary arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1, arg2); -} - -late final _sel_enumerateAttributesInRange_options_usingBlock_ = - objc.registerName("enumerateAttributesInRange:options:usingBlock:"); -final _objc_msgSend_1g4s41q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - int, - ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - objc.NSRange arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, objc.NSRange, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - objc.NSRange, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange, ffi.Pointer)> - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock?, objc.NSRange, ffi.Pointer)>`. -abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock?, objc.NSRange, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer arg0, objc.NSRange arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, ffi.Pointer)> - fromFunction(void Function(objc.ObjCObjectBase?, objc.NSRange, ffi.Pointer) fn) => - objc.ObjCBlock?, objc.NSRange, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_closureCallable, - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn(arg0.address == 0 ? null : objc.ObjCObjectBase(arg0, retain: true, release: true), arg1, arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> listener( - void Function(objc.ObjCObjectBase?, objc.NSRange, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.ObjCObjectBase(arg0, retain: false, release: true), - arg1, - arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock?, objc.NSRange, ffi.Pointer)>`. -extension ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> { - void call(objc.ObjCObjectBase? arg0, objc.NSRange arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - objc.NSRange arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1, arg2); -} - -late final _sel_enumerateAttribute_inRange_options_usingBlock_ = - objc.registerName("enumerateAttribute:inRange:options:usingBlock:"); -final _objc_msgSend_o0ok8d = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - int, - ffi.Pointer)>(); -late final _class_NSAttributedStringMarkdownParsingOptions = - objc.getClass("NSAttributedStringMarkdownParsingOptions"); -late final _sel_allowsExtendedAttributes = - objc.registerName("allowsExtendedAttributes"); -late final _sel_setAllowsExtendedAttributes_ = - objc.registerName("setAllowsExtendedAttributes:"); - -enum NSAttributedStringMarkdownInterpretedSyntax { - NSAttributedStringMarkdownInterpretedSyntaxFull(0), - NSAttributedStringMarkdownInterpretedSyntaxInlineOnly(1), - NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace(2); - - final int value; - const NSAttributedStringMarkdownInterpretedSyntax(this.value); - - static NSAttributedStringMarkdownInterpretedSyntax fromValue(int value) => - switch (value) { - 0 => NSAttributedStringMarkdownInterpretedSyntaxFull, - 1 => NSAttributedStringMarkdownInterpretedSyntaxInlineOnly, - 2 => - NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringMarkdownInterpretedSyntax: $value"), - }; -} - -late final _sel_interpretedSyntax = objc.registerName("interpretedSyntax"); -final _objc_msgSend_1pa46zt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setInterpretedSyntax_ = - objc.registerName("setInterpretedSyntax:"); -final _objc_msgSend_1fjzvvc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSAttributedStringMarkdownParsingFailurePolicy { - NSAttributedStringMarkdownParsingFailureReturnError(0), - NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible(1); - - final int value; - const NSAttributedStringMarkdownParsingFailurePolicy(this.value); - - static NSAttributedStringMarkdownParsingFailurePolicy fromValue(int value) => - switch (value) { - 0 => NSAttributedStringMarkdownParsingFailureReturnError, - 1 => - NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringMarkdownParsingFailurePolicy: $value"), - }; -} - -late final _sel_failurePolicy = objc.registerName("failurePolicy"); -final _objc_msgSend_gdi6fo = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setFailurePolicy_ = objc.registerName("setFailurePolicy:"); -final _objc_msgSend_9ynxkb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_languageCode = objc.registerName("languageCode"); -late final _sel_setLanguageCode_ = objc.registerName("setLanguageCode:"); -late final _sel_appliesSourcePositionAttributes = - objc.registerName("appliesSourcePositionAttributes"); -late final _sel_setAppliesSourcePositionAttributes_ = - objc.registerName("setAppliesSourcePositionAttributes:"); -late final _sel_self = objc.registerName("self"); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock Function(ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock Function(ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer) fn) => - objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension on objc - .ObjCBlock Function(ffi.Pointer)> { - objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -late final _sel_retain = objc.registerName("retain"); -late final _sel_autorelease = objc.registerName("autorelease"); - -/// NSAttributedStringMarkdownParsingOptions -class NSAttributedStringMarkdownParsingOptions extends objc.NSObject { - NSAttributedStringMarkdownParsingOptions._( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSAttributedStringMarkdownParsingOptions] that points to the same underlying object as [other]. - NSAttributedStringMarkdownParsingOptions.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSAttributedStringMarkdownParsingOptions] that wraps the given raw object pointer. - NSAttributedStringMarkdownParsingOptions.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSAttributedStringMarkdownParsingOptions]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_NSAttributedStringMarkdownParsingOptions); - } - - /// init - NSAttributedStringMarkdownParsingOptions init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// allowsExtendedAttributes - bool get allowsExtendedAttributes { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExtendedAttributes); - } - - /// setAllowsExtendedAttributes: - set allowsExtendedAttributes(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsExtendedAttributes_, value); - } - - /// interpretedSyntax - NSAttributedStringMarkdownInterpretedSyntax get interpretedSyntax { - final _ret = - _objc_msgSend_1pa46zt(this.ref.pointer, _sel_interpretedSyntax); - return NSAttributedStringMarkdownInterpretedSyntax.fromValue(_ret); - } - - /// setInterpretedSyntax: - set interpretedSyntax(NSAttributedStringMarkdownInterpretedSyntax value) { - return _objc_msgSend_1fjzvvc( - this.ref.pointer, _sel_setInterpretedSyntax_, value.value); - } - - /// failurePolicy - NSAttributedStringMarkdownParsingFailurePolicy get failurePolicy { - final _ret = _objc_msgSend_gdi6fo(this.ref.pointer, _sel_failurePolicy); - return NSAttributedStringMarkdownParsingFailurePolicy.fromValue(_ret); - } - - /// setFailurePolicy: - set failurePolicy(NSAttributedStringMarkdownParsingFailurePolicy value) { - return _objc_msgSend_9ynxkb( - this.ref.pointer, _sel_setFailurePolicy_, value.value); - } - - /// languageCode - objc.NSString? get languageCode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_languageCode); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLanguageCode: - set languageCode(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setLanguageCode_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// appliesSourcePositionAttributes - bool get appliesSourcePositionAttributes { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_appliesSourcePositionAttributes); - } - - /// setAppliesSourcePositionAttributes: - set appliesSourcePositionAttributes(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAppliesSourcePositionAttributes_, value); - } - - /// new - static NSAttributedStringMarkdownParsingOptions new1() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, _sel_new); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSAttributedStringMarkdownParsingOptions allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_allocWithZone_, - zone); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSAttributedStringMarkdownParsingOptions alloc() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, _sel_alloc); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSAttributedStringMarkdownParsingOptions, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_NSAttributedStringMarkdownParsingOptions, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSAttributedStringMarkdownParsingOptions, - _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_keyPathsForValuesAffectingValueForKey_, - key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSAttributedStringMarkdownParsingOptions, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedStringMarkdownParsingOptions, - _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSAttributedStringMarkdownParsingOptions self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSAttributedStringMarkdownParsingOptions retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSAttributedStringMarkdownParsingOptions autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSAttributedStringMarkdownParsingOptions.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_initWithContentsOfMarkdownFileAtURL_options_baseURL_error_ = - objc.registerName( - "initWithContentsOfMarkdownFileAtURL:options:baseURL:error:"); -final _objc_msgSend_w9wiqt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_initWithMarkdown_options_baseURL_error_ = - objc.registerName("initWithMarkdown:options:baseURL:error:"); -late final _sel_initWithMarkdownString_options_baseURL_error_ = - objc.registerName("initWithMarkdownString:options:baseURL:error:"); - -enum NSAttributedStringFormattingOptions { - NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging(1), - NSAttributedStringFormattingApplyReplacementIndexAttribute(2); - - final int value; - const NSAttributedStringFormattingOptions(this.value); - - static NSAttributedStringFormattingOptions fromValue(int value) => - switch (value) { - 1 => NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging, - 2 => NSAttributedStringFormattingApplyReplacementIndexAttribute, - _ => throw ArgumentError( - "Unknown value for NSAttributedStringFormattingOptions: $value"), - }; -} - -late final _sel_initWithFormat_options_locale_ = - objc.registerName("initWithFormat:options:locale:"); -final _objc_msgSend_4x8h9q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_localizedAttributedStringWithFormat_ = - objc.registerName("localizedAttributedStringWithFormat:"); -late final _sel_localizedAttributedStringWithFormat_options_ = - objc.registerName("localizedAttributedStringWithFormat:options:"); -final _objc_msgSend_1vfncet = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_initWithFormat_options_locale_context_ = - objc.registerName("initWithFormat:options:locale:context:"); -final _objc_msgSend_xvcwe5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_localizedAttributedStringWithFormat_context_ = - objc.registerName("localizedAttributedStringWithFormat:context:"); -late final _sel_localizedAttributedStringWithFormat_options_context_ = - objc.registerName("localizedAttributedStringWithFormat:options:context:"); -late final _sel_attributedStringByInflectingString = - objc.registerName("attributedStringByInflectingString"); - -/// NSAttributedString -class NSAttributedString extends objc.NSObject { - NSAttributedString._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSAttributedString] that points to the same underlying object as [other]. - NSAttributedString.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSAttributedString] that wraps the given raw object pointer. - NSAttributedString.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSAttributedString]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSAttributedString); - } - - /// string - objc.NSString get string { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_string); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// attributesAtIndex:effectiveRange: - objc.NSDictionary attributesAtIndex_effectiveRange_( - int location, ffi.Pointer range) { - final _ret = _objc_msgSend_1lz7qql(this.ref.pointer, - _sel_attributesAtIndex_effectiveRange_, location, range); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// length - int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); - } - - /// attribute:atIndex:effectiveRange: - objc.ObjCObjectBase? attribute_atIndex_effectiveRange_( - objc.NSString attrName, int location, ffi.Pointer range) { - final _ret = _objc_msgSend_6erk1e( - this.ref.pointer, - _sel_attribute_atIndex_effectiveRange_, - attrName.ref.pointer, - location, - range); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributedSubstringFromRange: - NSAttributedString attributedSubstringFromRange_(objc.NSRange range) { - final _ret = _objc_msgSend_176f8tz( - this.ref.pointer, _sel_attributedSubstringFromRange_, range); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// attributesAtIndex:longestEffectiveRange:inRange: - objc.NSDictionary attributesAtIndex_longestEffectiveRange_inRange_( - int location, ffi.Pointer range, objc.NSRange rangeLimit) { - final _ret = _objc_msgSend_7mxs62( - this.ref.pointer, - _sel_attributesAtIndex_longestEffectiveRange_inRange_, - location, - range, - rangeLimit); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// attribute:atIndex:longestEffectiveRange:inRange: - objc.ObjCObjectBase? attribute_atIndex_longestEffectiveRange_inRange_( - objc.NSString attrName, - int location, - ffi.Pointer range, - objc.NSRange rangeLimit) { - final _ret = _objc_msgSend_1hy2clh( - this.ref.pointer, - _sel_attribute_atIndex_longestEffectiveRange_inRange_, - attrName.ref.pointer, - location, - range, - rangeLimit); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// isEqualToAttributedString: - bool isEqualToAttributedString_(NSAttributedString other) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToAttributedString_, other.ref.pointer); - } - - /// initWithString: - NSAttributedString initWithString_(objc.NSString str) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, str.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithString:attributes: - NSAttributedString initWithString_attributes_( - objc.NSString str, objc.NSDictionary? attrs) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithString_attributes_, - str.ref.pointer, - attrs?.ref.pointer ?? ffi.nullptr); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithAttributedString: - NSAttributedString initWithAttributedString_(NSAttributedString attrStr) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithAttributedString_, attrStr.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// enumerateAttributesInRange:options:usingBlock: - void enumerateAttributesInRange_options_usingBlock_( - objc.NSRange enumerationRange, - NSAttributedStringEnumerationOptions opts, - objc.ObjCBlock< - ffi.Void Function( - objc.NSDictionary, objc.NSRange, ffi.Pointer)> - block) { - _objc_msgSend_1g4s41q( - this.ref.pointer, - _sel_enumerateAttributesInRange_options_usingBlock_, - enumerationRange, - opts.value, - block.ref.pointer); - } - - /// enumerateAttribute:inRange:options:usingBlock: - void enumerateAttribute_inRange_options_usingBlock_( - objc.NSString attrName, - objc.NSRange enumerationRange, - NSAttributedStringEnumerationOptions opts, - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, objc.NSRange, - ffi.Pointer)> - block) { - _objc_msgSend_o0ok8d( - this.ref.pointer, - _sel_enumerateAttribute_inRange_options_usingBlock_, - attrName.ref.pointer, - enumerationRange, - opts.value, - block.ref.pointer); - } - - /// initWithContentsOfMarkdownFileAtURL:options:baseURL:error: - NSAttributedString? - initWithContentsOfMarkdownFileAtURL_options_baseURL_error_( - objc.NSURL markdownFile, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfMarkdownFileAtURL_options_baseURL_error_, - markdownFile.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdown:options:baseURL:error: - NSAttributedString? initWithMarkdown_options_baseURL_error_( - objc.NSData markdown, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdown_options_baseURL_error_, - markdown.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdownString:options:baseURL:error: - NSAttributedString? initWithMarkdownString_options_baseURL_error_( - objc.NSString markdownString, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdownString_options_baseURL_error_, - markdownString.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithFormat:options:locale: - NSAttributedString initWithFormat_options_locale_(NSAttributedString format, - NSAttributedStringFormattingOptions options, objc.NSLocale? locale) { - final _ret = _objc_msgSend_4x8h9q( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat: - static NSAttributedString localizedAttributedStringWithFormat_( - NSAttributedString format) { - final _ret = _objc_msgSend_juohf7(_class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_, format.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options: - static NSAttributedString localizedAttributedStringWithFormat_options_( - NSAttributedString format, NSAttributedStringFormattingOptions options) { - final _ret = _objc_msgSend_1vfncet( - _class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_options_, - format.ref.pointer, - options.value); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithFormat:options:locale:context: - NSAttributedString initWithFormat_options_locale_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSLocale? locale, - objc.NSDictionary context) { - final _ret = _objc_msgSend_xvcwe5( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_context_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr, - context.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat:context: - static NSAttributedString localizedAttributedStringWithFormat_context_( - NSAttributedString format, objc.NSDictionary context) { - final _ret = _objc_msgSend_iq11qg( - _class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_context_, - format.ref.pointer, - context.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options:context: - static NSAttributedString - localizedAttributedStringWithFormat_options_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSDictionary context) { - final _ret = _objc_msgSend_4x8h9q( - _class_NSAttributedString, - _sel_localizedAttributedStringWithFormat_options_context_, - format.ref.pointer, - options.value, - context.ref.pointer); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// attributedStringByInflectingString - NSAttributedString attributedStringByInflectingString() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_attributedStringByInflectingString); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSAttributedString init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSAttributedString new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSAttributedString, _sel_new); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSAttributedString allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSAttributedString, _sel_allocWithZone_, zone); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSAttributedString alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSAttributedString, _sel_alloc); - return NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSAttributedString, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSAttributedString, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSAttributedString, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSAttributedString, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSAttributedString, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedString, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAttributedString, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSAttributedString self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSAttributedString retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSAttributedString autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSAttributedString, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSAttributedString? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_localizedAttributedStringForKey_value_table_ = - objc.registerName("localizedAttributedStringForKey:value:table:"); -late final _sel_bundleIdentifier = objc.registerName("bundleIdentifier"); -late final _sel_infoDictionary = objc.registerName("infoDictionary"); -late final _sel_localizedInfoDictionary = - objc.registerName("localizedInfoDictionary"); -late final _sel_objectForInfoDictionaryKey_ = - objc.registerName("objectForInfoDictionaryKey:"); -late final _sel_classNamed_ = objc.registerName("classNamed:"); -late final _sel_principalClass = objc.registerName("principalClass"); -late final _sel_preferredLocalizations = - objc.registerName("preferredLocalizations"); -late final _sel_localizations = objc.registerName("localizations"); -late final _sel_developmentLocalization = - objc.registerName("developmentLocalization"); -late final _sel_preferredLocalizationsFromArray_ = - objc.registerName("preferredLocalizationsFromArray:"); -late final _sel_preferredLocalizationsFromArray_forPreferences_ = - objc.registerName("preferredLocalizationsFromArray:forPreferences:"); -late final _sel_executableArchitectures = - objc.registerName("executableArchitectures"); -late final _sel_setPreservationPriority_forTags_ = - objc.registerName("setPreservationPriority:forTags:"); -final _objc_msgSend_13ndgwe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer)>(); -late final _sel_preservationPriorityForTag_ = - objc.registerName("preservationPriorityForTag:"); -final _objc_msgSend_om71r5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Double Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_om71r5Fpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Double Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - -/// NSBundle -class NSBundle extends objc.NSObject { - NSBundle._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSBundle] that points to the same underlying object as [other]. - NSBundle.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSBundle] that wraps the given raw object pointer. - NSBundle.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSBundle]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSBundle); - } - - /// mainBundle - static NSBundle getMainBundle() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_mainBundle); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// bundleWithPath: - static NSBundle? bundleWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleWithPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithPath: - NSBundle? initWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// bundleWithURL: - static NSBundle? bundleWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleWithURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithURL: - NSBundle? initWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// bundleForClass: - static NSBundle bundleForClass_(objc.ObjCObjectBase aClass) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleForClass_, aClass.ref.pointer); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// bundleWithIdentifier: - static NSBundle? bundleWithIdentifier_(objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7( - _class_NSBundle, _sel_bundleWithIdentifier_, identifier.ref.pointer); - return _ret.address == 0 - ? null - : NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// allBundles - static objc.NSArray getAllBundles() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_allBundles); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allFrameworks - static objc.NSArray getAllFrameworks() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_allFrameworks); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// load - bool load() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_load); - } - - /// isLoaded - bool get loaded { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLoaded); - } - - /// unload - bool unload() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_unload); - } - - /// preflightAndReturnError: - bool preflightAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_preflightAndReturnError_, error); - } - - /// loadAndReturnError: - bool loadAndReturnError_(ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_loadAndReturnError_, error); - } - - /// bundleURL - objc.NSURL get bundleURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bundleURL); - return objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// resourceURL - objc.NSURL? get resourceURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_resourceURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// executableURL - objc.NSURL? get executableURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executableURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForAuxiliaryExecutable: - objc.NSURL? URLForAuxiliaryExecutable_(objc.NSString executableName) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_URLForAuxiliaryExecutable_, executableName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// privateFrameworksURL - objc.NSURL? get privateFrameworksURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_privateFrameworksURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedFrameworksURL - objc.NSURL? get sharedFrameworksURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedFrameworksURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedSupportURL - objc.NSURL? get sharedSupportURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedSupportURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// builtInPlugInsURL - objc.NSURL? get builtInPlugInsURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_builtInPlugInsURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// appStoreReceiptURL - objc.NSURL? get appStoreReceiptURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_appStoreReceiptURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// bundlePath - objc.NSString get bundlePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bundlePath); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// resourcePath - objc.NSString? get resourcePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_resourcePath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// executablePath - objc.NSString? get executablePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executablePath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForAuxiliaryExecutable: - objc.NSString? pathForAuxiliaryExecutable_(objc.NSString executableName) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_pathForAuxiliaryExecutable_, executableName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// privateFrameworksPath - objc.NSString? get privateFrameworksPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_privateFrameworksPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedFrameworksPath - objc.NSString? get sharedFrameworksPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedFrameworksPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedSupportPath - objc.NSString? get sharedSupportPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedSupportPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// builtInPlugInsPath - objc.NSString? get builtInPlugInsPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_builtInPlugInsPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension:subdirectory:inBundleWithURL: - static objc.NSURL? URLForResource_withExtension_subdirectory_inBundleWithURL_( - objc.NSString? name, - objc.NSString? ext, - objc.NSString? subpath, - objc.NSURL bundleURL) { - final _ret = _objc_msgSend_1qje3rk( - _class_NSBundle, - _sel_URLForResource_withExtension_subdirectory_inBundleWithURL_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - bundleURL.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForResourcesWithExtension:subdirectory:inBundleWithURL: - static objc.NSArray? - URLsForResourcesWithExtension_subdirectory_inBundleWithURL_( - objc.NSString? ext, objc.NSString? subpath, objc.NSURL bundleURL) { - final _ret = _objc_msgSend_aud7dn( - _class_NSBundle, - _sel_URLsForResourcesWithExtension_subdirectory_inBundleWithURL_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - bundleURL.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension: - objc.NSURL? URLForResource_withExtension_( - objc.NSString? name, objc.NSString? ext) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_URLForResource_withExtension_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension:subdirectory: - objc.NSURL? URLForResource_withExtension_subdirectory_( - objc.NSString? name, objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_URLForResource_withExtension_subdirectory_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForResource:withExtension:subdirectory:localization: - objc.NSURL? URLForResource_withExtension_subdirectory_localization_( - objc.NSString? name, - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_1qje3rk( - this.ref.pointer, - _sel_URLForResource_withExtension_subdirectory_localization_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForResourcesWithExtension:subdirectory: - objc.NSArray? URLsForResourcesWithExtension_subdirectory_( - objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_URLsForResourcesWithExtension_subdirectory_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForResourcesWithExtension:subdirectory:localization: - objc.NSArray? URLsForResourcesWithExtension_subdirectory_localization_( - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_URLsForResourcesWithExtension_subdirectory_localization_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForResource:ofType:inDirectory: - objc.NSString? pathForResource_ofType_inDirectory_( - objc.NSString? name, objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_pathForResource_ofType_inDirectory_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathsForResourcesOfType:inDirectory: - objc.NSArray pathsForResourcesOfType_inDirectory_( - objc.NSString? ext, objc.NSString? subpath) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_pathsForResourcesOfType_inDirectory_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForResource:ofType: - objc.NSString? pathForResource_ofType_( - objc.NSString? name, objc.NSString? ext) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_pathForResource_ofType_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathForResource:ofType:inDirectory:forLocalization: - objc.NSString? pathForResource_ofType_inDirectory_forLocalization_( - objc.NSString? name, - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_1qje3rk( - this.ref.pointer, - _sel_pathForResource_ofType_inDirectory_forLocalization_, - name?.ref.pointer ?? ffi.nullptr, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathsForResourcesOfType:inDirectory:forLocalization: - objc.NSArray pathsForResourcesOfType_inDirectory_forLocalization_( - objc.NSString? ext, - objc.NSString? subpath, - objc.NSString? localizationName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_pathsForResourcesOfType_inDirectory_forLocalization_, - ext?.ref.pointer ?? ffi.nullptr, - subpath?.ref.pointer ?? ffi.nullptr, - localizationName?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedStringForKey:value:table: - objc.NSString localizedStringForKey_value_table_( - objc.NSString key, objc.NSString? value, objc.NSString? tableName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_localizedStringForKey_value_table_, - key.ref.pointer, - value?.ref.pointer ?? ffi.nullptr, - tableName?.ref.pointer ?? ffi.nullptr); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedAttributedStringForKey:value:table: - NSAttributedString localizedAttributedStringForKey_value_table_( - objc.NSString key, objc.NSString? value, objc.NSString? tableName) { - final _ret = _objc_msgSend_aud7dn( - this.ref.pointer, - _sel_localizedAttributedStringForKey_value_table_, - key.ref.pointer, - value?.ref.pointer ?? ffi.nullptr, - tableName?.ref.pointer ?? ffi.nullptr); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// bundleIdentifier - objc.NSString? get bundleIdentifier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bundleIdentifier); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// infoDictionary - objc.NSDictionary? get infoDictionary { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_infoDictionary); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedInfoDictionary - objc.NSDictionary? get localizedInfoDictionary { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedInfoDictionary); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// objectForInfoDictionaryKey: - objc.ObjCObjectBase? objectForInfoDictionaryKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_objectForInfoDictionaryKey_, key.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// classNamed: - objc.ObjCObjectBase? classNamed_(objc.NSString className) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_classNamed_, className.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// principalClass - objc.ObjCObjectBase? get principalClass { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_principalClass); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// preferredLocalizations - objc.NSArray get preferredLocalizations { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredLocalizations); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localizations - objc.NSArray get localizations { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizations); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// developmentLocalization - objc.NSString? get developmentLocalization { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_developmentLocalization); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// preferredLocalizationsFromArray: - static objc.NSArray preferredLocalizationsFromArray_( - objc.NSArray localizationsArray) { - final _ret = _objc_msgSend_juohf7(_class_NSBundle, - _sel_preferredLocalizationsFromArray_, localizationsArray.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// preferredLocalizationsFromArray:forPreferences: - static objc.NSArray preferredLocalizationsFromArray_forPreferences_( - objc.NSArray localizationsArray, objc.NSArray? preferencesArray) { - final _ret = _objc_msgSend_iq11qg( - _class_NSBundle, - _sel_preferredLocalizationsFromArray_forPreferences_, - localizationsArray.ref.pointer, - preferencesArray?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// executableArchitectures - objc.NSArray? get executableArchitectures { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executableArchitectures); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setPreservationPriority:forTags: - void setPreservationPriority_forTags_(double priority, objc.NSSet tags) { - _objc_msgSend_13ndgwe(this.ref.pointer, - _sel_setPreservationPriority_forTags_, priority, tags.ref.pointer); - } - - /// preservationPriorityForTag: - double preservationPriorityForTag_(objc.NSString tag) { - return objc.useMsgSendVariants - ? _objc_msgSend_om71r5Fpret( - this.ref.pointer, _sel_preservationPriorityForTag_, tag.ref.pointer) - : _objc_msgSend_om71r5(this.ref.pointer, - _sel_preservationPriorityForTag_, tag.ref.pointer); - } - - /// init - NSBundle init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSBundle new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_new); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSBundle allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSBundle, _sel_allocWithZone_, zone); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSBundle alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSBundle, _sel_alloc); - return NSBundle.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSBundle, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSBundle, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSBundle, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSBundle, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSBundle, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSBundle, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSBundle, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSBundle, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSBundle, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSBundle self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSBundle retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSBundle autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSBundle.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSMutableAttributedString = - objc.getClass("NSMutableAttributedString"); -late final _sel_replaceCharactersInRange_withString_ = - objc.registerName("replaceCharactersInRange:withString:"); -final _objc_msgSend_85e5ih = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_setAttributes_range_ = - objc.registerName("setAttributes:range:"); -final _objc_msgSend_lusc9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_mutableString = objc.registerName("mutableString"); -late final _sel_addAttribute_value_range_ = - objc.registerName("addAttribute:value:range:"); -final _objc_msgSend_1fmqvtu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_addAttributes_range_ = - objc.registerName("addAttributes:range:"); -late final _sel_removeAttribute_range_ = - objc.registerName("removeAttribute:range:"); -late final _sel_replaceCharactersInRange_withAttributedString_ = - objc.registerName("replaceCharactersInRange:withAttributedString:"); -late final _sel_insertAttributedString_atIndex_ = - objc.registerName("insertAttributedString:atIndex:"); -final _objc_msgSend_cjm5ga = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_appendAttributedString_ = - objc.registerName("appendAttributedString:"); -late final _sel_deleteCharactersInRange_ = - objc.registerName("deleteCharactersInRange:"); -final _objc_msgSend_9xf7uy = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, objc.NSRange)>(); -late final _sel_setAttributedString_ = - objc.registerName("setAttributedString:"); -late final _sel_beginEditing = objc.registerName("beginEditing"); -late final _sel_endEditing = objc.registerName("endEditing"); -late final _sel_appendLocalizedFormat_ = - objc.registerName("appendLocalizedFormat:"); - -/// NSMutableAttributedString -class NSMutableAttributedString extends NSAttributedString { - NSMutableAttributedString._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMutableAttributedString] that points to the same underlying object as [other]. - NSMutableAttributedString.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMutableAttributedString] that wraps the given raw object pointer. - NSMutableAttributedString.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMutableAttributedString]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableAttributedString); - } - - /// replaceCharactersInRange:withString: - void replaceCharactersInRange_withString_( - objc.NSRange range, objc.NSString str) { - _objc_msgSend_85e5ih(this.ref.pointer, - _sel_replaceCharactersInRange_withString_, range, str.ref.pointer); - } - - /// setAttributes:range: - void setAttributes_range_(objc.NSDictionary? attrs, objc.NSRange range) { - _objc_msgSend_lusc9(this.ref.pointer, _sel_setAttributes_range_, - attrs?.ref.pointer ?? ffi.nullptr, range); - } - - /// mutableString - objc.NSMutableString get mutableString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mutableString); - return objc.NSMutableString.castFromPointer(_ret, - retain: true, release: true); - } - - /// addAttribute:value:range: - void addAttribute_value_range_( - objc.NSString name, objc.ObjCObjectBase value, objc.NSRange range) { - _objc_msgSend_1fmqvtu(this.ref.pointer, _sel_addAttribute_value_range_, - name.ref.pointer, value.ref.pointer, range); - } - - /// addAttributes:range: - void addAttributes_range_(objc.NSDictionary attrs, objc.NSRange range) { - _objc_msgSend_lusc9( - this.ref.pointer, _sel_addAttributes_range_, attrs.ref.pointer, range); - } - - /// removeAttribute:range: - void removeAttribute_range_(objc.NSString name, objc.NSRange range) { - _objc_msgSend_lusc9( - this.ref.pointer, _sel_removeAttribute_range_, name.ref.pointer, range); - } - - /// replaceCharactersInRange:withAttributedString: - void replaceCharactersInRange_withAttributedString_( - objc.NSRange range, NSAttributedString attrString) { - _objc_msgSend_85e5ih( - this.ref.pointer, - _sel_replaceCharactersInRange_withAttributedString_, - range, - attrString.ref.pointer); - } - - /// insertAttributedString:atIndex: - void insertAttributedString_atIndex_(NSAttributedString attrString, int loc) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertAttributedString_atIndex_, - attrString.ref.pointer, loc); - } - - /// appendAttributedString: - void appendAttributedString_(NSAttributedString attrString) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_appendAttributedString_, attrString.ref.pointer); - } - - /// deleteCharactersInRange: - void deleteCharactersInRange_(objc.NSRange range) { - _objc_msgSend_9xf7uy( - this.ref.pointer, _sel_deleteCharactersInRange_, range); - } - - /// setAttributedString: - void setAttributedString_(NSAttributedString attrString) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAttributedString_, attrString.ref.pointer); - } - - /// beginEditing - void beginEditing() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_beginEditing); - } - - /// endEditing - void endEditing() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_endEditing); - } - - /// appendLocalizedFormat: - void appendLocalizedFormat_(NSAttributedString format) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_appendLocalizedFormat_, format.ref.pointer); - } - - /// initWithString: - NSMutableAttributedString initWithString_(objc.NSString str) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, str.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithString:attributes: - NSMutableAttributedString initWithString_attributes_( - objc.NSString str, objc.NSDictionary? attrs) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithString_attributes_, - str.ref.pointer, - attrs?.ref.pointer ?? ffi.nullptr); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithAttributedString: - NSMutableAttributedString initWithAttributedString_( - NSAttributedString attrStr) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithAttributedString_, attrStr.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithContentsOfMarkdownFileAtURL:options:baseURL:error: - NSMutableAttributedString? - initWithContentsOfMarkdownFileAtURL_options_baseURL_error_( - objc.NSURL markdownFile, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfMarkdownFileAtURL_options_baseURL_error_, - markdownFile.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdown:options:baseURL:error: - NSMutableAttributedString? initWithMarkdown_options_baseURL_error_( - objc.NSData markdown, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdown_options_baseURL_error_, - markdown.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithMarkdownString:options:baseURL:error: - NSMutableAttributedString? initWithMarkdownString_options_baseURL_error_( - objc.NSString markdownString, - NSAttributedStringMarkdownParsingOptions? options, - objc.NSURL? baseURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( - this.ref.retainAndReturnPointer(), - _sel_initWithMarkdownString_options_baseURL_error_, - markdownString.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - baseURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithFormat:options:locale: - NSMutableAttributedString initWithFormat_options_locale_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSLocale? locale) { - final _ret = _objc_msgSend_4x8h9q( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat: - static NSMutableAttributedString localizedAttributedStringWithFormat_( - NSAttributedString format) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_, format.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options: - static NSMutableAttributedString localizedAttributedStringWithFormat_options_( - NSAttributedString format, NSAttributedStringFormattingOptions options) { - final _ret = _objc_msgSend_1vfncet( - _class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_options_, - format.ref.pointer, - options.value); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithFormat:options:locale:context: - NSMutableAttributedString initWithFormat_options_locale_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSLocale? locale, - objc.NSDictionary context) { - final _ret = _objc_msgSend_xvcwe5( - this.ref.retainAndReturnPointer(), - _sel_initWithFormat_options_locale_context_, - format.ref.pointer, - options.value, - locale?.ref.pointer ?? ffi.nullptr, - context.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// localizedAttributedStringWithFormat:context: - static NSMutableAttributedString localizedAttributedStringWithFormat_context_( - NSAttributedString format, objc.NSDictionary context) { - final _ret = _objc_msgSend_iq11qg( - _class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_context_, - format.ref.pointer, - context.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// localizedAttributedStringWithFormat:options:context: - static NSMutableAttributedString - localizedAttributedStringWithFormat_options_context_( - NSAttributedString format, - NSAttributedStringFormattingOptions options, - objc.NSDictionary context) { - final _ret = _objc_msgSend_4x8h9q( - _class_NSMutableAttributedString, - _sel_localizedAttributedStringWithFormat_options_context_, - format.ref.pointer, - options.value, - context.ref.pointer); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSMutableAttributedString init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSMutableAttributedString new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMutableAttributedString, _sel_new); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSMutableAttributedString allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMutableAttributedString, _sel_allocWithZone_, zone); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSMutableAttributedString alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMutableAttributedString, _sel_alloc); - return NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMutableAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMutableAttributedString, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMutableAttributedString, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSMutableAttributedString, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableAttributedString, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableAttributedString, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMutableAttributedString, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableAttributedString, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableAttributedString, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMutableAttributedString self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSMutableAttributedString retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSMutableAttributedString autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMutableAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableAttributedString, _sel_supportsSecureCoding); - } - - /// initWithCoder: - NSMutableAttributedString? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableAttributedString.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _class_NSFormatter = objc.getClass("NSFormatter"); -late final _sel_stringForObjectValue_ = - objc.registerName("stringForObjectValue:"); -late final _sel_attributedStringForObjectValue_withDefaultAttributes_ = - objc.registerName("attributedStringForObjectValue:withDefaultAttributes:"); -late final _sel_editingStringForObjectValue_ = - objc.registerName("editingStringForObjectValue:"); -late final _sel_getObjectValue_forString_errorDescription_ = - objc.registerName("getObjectValue:forString:errorDescription:"); -final _objc_msgSend_1tdtroe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_isPartialStringValid_newEditingString_errorDescription_ = objc - .registerName("isPartialStringValid:newEditingString:errorDescription:"); -final _objc_msgSend_to8xlo = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription_ = - objc.registerName( - "isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:"); -final _objc_msgSend_1hu6x2w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer>)>(); - -/// NSFormatter -class NSFormatter extends objc.NSObject { - NSFormatter._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFormatter] that points to the same underlying object as [other]. - NSFormatter.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFormatter] that wraps the given raw object pointer. - NSFormatter.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFormatter]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFormatter); - } - - /// stringForObjectValue: - objc.NSString? stringForObjectValue_(objc.ObjCObjectBase? obj) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_stringForObjectValue_, obj?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// attributedStringForObjectValue:withDefaultAttributes: - NSAttributedString? attributedStringForObjectValue_withDefaultAttributes_( - objc.ObjCObjectBase obj, objc.NSDictionary? attrs) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_attributedStringForObjectValue_withDefaultAttributes_, - obj.ref.pointer, - attrs?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSAttributedString.castFromPointer(_ret, retain: true, release: true); - } - - /// editingStringForObjectValue: - objc.NSString? editingStringForObjectValue_(objc.ObjCObjectBase obj) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_editingStringForObjectValue_, obj.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// getObjectValue:forString:errorDescription: - bool getObjectValue_forString_errorDescription_( - ffi.Pointer> obj, - objc.NSString string, - ffi.Pointer> error) { - return _objc_msgSend_1tdtroe( - this.ref.pointer, - _sel_getObjectValue_forString_errorDescription_, - obj, - string.ref.pointer, - error); - } - - /// isPartialStringValid:newEditingString:errorDescription: - bool isPartialStringValid_newEditingString_errorDescription_( - objc.NSString partialString, - ffi.Pointer> newString, - ffi.Pointer> error) { - return _objc_msgSend_to8xlo( - this.ref.pointer, - _sel_isPartialStringValid_newEditingString_errorDescription_, - partialString.ref.pointer, - newString, - error); - } - - /// isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription: - bool - isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription_( - ffi.Pointer> partialStringPtr, - ffi.Pointer proposedSelRangePtr, - objc.NSString origString, - objc.NSRange origSelRange, - ffi.Pointer> error) { - return _objc_msgSend_1hu6x2w( - this.ref.pointer, - _sel_isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription_, - partialStringPtr, - proposedSelRangePtr, - origString.ref.pointer, - origSelRange, - error); - } - - /// init - NSFormatter init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFormatter new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFormatter, _sel_new); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFormatter allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFormatter, _sel_allocWithZone_, zone); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFormatter alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFormatter, _sel_alloc); - return NSFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFormatter, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFormatter, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFormatter, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFormatter, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFormatter, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFormatter, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSFormatter, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSFormatter self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSFormatter retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSFormatter autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSFormatter? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSFormatter.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSDateFormatter = objc.getClass("NSDateFormatter"); - -enum NSFormattingContext { - NSFormattingContextUnknown(0), - NSFormattingContextDynamic(1), - NSFormattingContextStandalone(2), - NSFormattingContextListItem(3), - NSFormattingContextBeginningOfSentence(4), - NSFormattingContextMiddleOfSentence(5); - - final int value; - const NSFormattingContext(this.value); - - static NSFormattingContext fromValue(int value) => switch (value) { - 0 => NSFormattingContextUnknown, - 1 => NSFormattingContextDynamic, - 2 => NSFormattingContextStandalone, - 3 => NSFormattingContextListItem, - 4 => NSFormattingContextBeginningOfSentence, - 5 => NSFormattingContextMiddleOfSentence, - _ => - throw ArgumentError("Unknown value for NSFormattingContext: $value"), - }; -} - -late final _sel_formattingContext = objc.registerName("formattingContext"); -final _objc_msgSend_10wicfq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setFormattingContext_ = - objc.registerName("setFormattingContext:"); -final _objc_msgSend_1gtwv7x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_getObjectValue_forString_range_error_ = - objc.registerName("getObjectValue:forString:range:error:"); -final _objc_msgSend_bl9kx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_stringFromDate_ = objc.registerName("stringFromDate:"); -late final _sel_dateFromString_ = objc.registerName("dateFromString:"); - -enum NSDateFormatterStyle { - NSDateFormatterNoStyle(0), - NSDateFormatterShortStyle(1), - NSDateFormatterMediumStyle(2), - NSDateFormatterLongStyle(3), - NSDateFormatterFullStyle(4); - - final int value; - const NSDateFormatterStyle(this.value); - - static NSDateFormatterStyle fromValue(int value) => switch (value) { - 0 => NSDateFormatterNoStyle, - 1 => NSDateFormatterShortStyle, - 2 => NSDateFormatterMediumStyle, - 3 => NSDateFormatterLongStyle, - 4 => NSDateFormatterFullStyle, - _ => - throw ArgumentError("Unknown value for NSDateFormatterStyle: $value"), - }; -} - -late final _sel_localizedStringFromDate_dateStyle_timeStyle_ = - objc.registerName("localizedStringFromDate:dateStyle:timeStyle:"); -final _objc_msgSend_1sgexgh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int)>(); -late final _sel_dateFormatFromTemplate_options_locale_ = - objc.registerName("dateFormatFromTemplate:options:locale:"); -final _objc_msgSend_1czjmpk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - -enum NSDateFormatterBehavior { - NSDateFormatterBehaviorDefault(0), - NSDateFormatterBehavior10_0(1000), - NSDateFormatterBehavior10_4(1040); - - final int value; - const NSDateFormatterBehavior(this.value); - - static NSDateFormatterBehavior fromValue(int value) => switch (value) { - 0 => NSDateFormatterBehaviorDefault, - 1000 => NSDateFormatterBehavior10_0, - 1040 => NSDateFormatterBehavior10_4, - _ => throw ArgumentError( - "Unknown value for NSDateFormatterBehavior: $value"), - }; -} - -late final _sel_defaultFormatterBehavior = - objc.registerName("defaultFormatterBehavior"); -final _objc_msgSend_ti9wzk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDefaultFormatterBehavior_ = - objc.registerName("setDefaultFormatterBehavior:"); -final _objc_msgSend_ffb1q7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setLocalizedDateFormatFromTemplate_ = - objc.registerName("setLocalizedDateFormatFromTemplate:"); -late final _sel_dateFormat = objc.registerName("dateFormat"); -late final _sel_setDateFormat_ = objc.registerName("setDateFormat:"); -late final _sel_dateStyle = objc.registerName("dateStyle"); -final _objc_msgSend_r4ksf1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDateStyle_ = objc.registerName("setDateStyle:"); -final _objc_msgSend_7hnqfw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_timeStyle = objc.registerName("timeStyle"); -late final _sel_setTimeStyle_ = objc.registerName("setTimeStyle:"); -late final _sel_locale = objc.registerName("locale"); -late final _sel_setLocale_ = objc.registerName("setLocale:"); -late final _sel_generatesCalendarDates = - objc.registerName("generatesCalendarDates"); -late final _sel_setGeneratesCalendarDates_ = - objc.registerName("setGeneratesCalendarDates:"); -late final _sel_formatterBehavior = objc.registerName("formatterBehavior"); -late final _sel_setFormatterBehavior_ = - objc.registerName("setFormatterBehavior:"); -late final _class_NSTimeZone = objc.getClass("NSTimeZone"); -late final _sel_name = objc.registerName("name"); -late final _sel_data = objc.registerName("data"); -late final _sel_secondsFromGMTForDate_ = - objc.registerName("secondsFromGMTForDate:"); -final _objc_msgSend_hrsqsi = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_abbreviationForDate_ = - objc.registerName("abbreviationForDate:"); -late final _sel_isDaylightSavingTimeForDate_ = - objc.registerName("isDaylightSavingTimeForDate:"); -late final _sel_daylightSavingTimeOffsetForDate_ = - objc.registerName("daylightSavingTimeOffsetForDate:"); -late final _sel_nextDaylightSavingTimeTransitionAfterDate_ = - objc.registerName("nextDaylightSavingTimeTransitionAfterDate:"); -late final _sel_systemTimeZone = objc.registerName("systemTimeZone"); -late final _sel_resetSystemTimeZone = objc.registerName("resetSystemTimeZone"); -late final _sel_defaultTimeZone = objc.registerName("defaultTimeZone"); -late final _sel_setDefaultTimeZone_ = objc.registerName("setDefaultTimeZone:"); -late final _sel_localTimeZone = objc.registerName("localTimeZone"); -late final _sel_knownTimeZoneNames = objc.registerName("knownTimeZoneNames"); -late final _sel_abbreviationDictionary = - objc.registerName("abbreviationDictionary"); -late final _sel_setAbbreviationDictionary_ = - objc.registerName("setAbbreviationDictionary:"); -late final _sel_timeZoneDataVersion = objc.registerName("timeZoneDataVersion"); -late final _sel_secondsFromGMT = objc.registerName("secondsFromGMT"); -final _objc_msgSend_z1fx1b = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_abbreviation = objc.registerName("abbreviation"); -late final _sel_isDaylightSavingTime = - objc.registerName("isDaylightSavingTime"); -late final _sel_daylightSavingTimeOffset = - objc.registerName("daylightSavingTimeOffset"); -late final _sel_nextDaylightSavingTimeTransition = - objc.registerName("nextDaylightSavingTimeTransition"); -late final _sel_description = objc.registerName("description"); -late final _sel_isEqualToTimeZone_ = objc.registerName("isEqualToTimeZone:"); - -enum NSTimeZoneNameStyle { - NSTimeZoneNameStyleStandard(0), - NSTimeZoneNameStyleShortStandard(1), - NSTimeZoneNameStyleDaylightSaving(2), - NSTimeZoneNameStyleShortDaylightSaving(3), - NSTimeZoneNameStyleGeneric(4), - NSTimeZoneNameStyleShortGeneric(5); - - final int value; - const NSTimeZoneNameStyle(this.value); - - static NSTimeZoneNameStyle fromValue(int value) => switch (value) { - 0 => NSTimeZoneNameStyleStandard, - 1 => NSTimeZoneNameStyleShortStandard, - 2 => NSTimeZoneNameStyleDaylightSaving, - 3 => NSTimeZoneNameStyleShortDaylightSaving, - 4 => NSTimeZoneNameStyleGeneric, - 5 => NSTimeZoneNameStyleShortGeneric, - _ => - throw ArgumentError("Unknown value for NSTimeZoneNameStyle: $value"), - }; -} - -late final _sel_localizedName_locale_ = - objc.registerName("localizedName:locale:"); -final _objc_msgSend_1c91ngg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_timeZoneWithName_ = objc.registerName("timeZoneWithName:"); -late final _sel_timeZoneWithName_data_ = - objc.registerName("timeZoneWithName:data:"); -late final _sel_initWithName_ = objc.registerName("initWithName:"); -late final _sel_initWithName_data_ = objc.registerName("initWithName:data:"); -late final _sel_timeZoneForSecondsFromGMT_ = - objc.registerName("timeZoneForSecondsFromGMT:"); -final _objc_msgSend_crtxa9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_timeZoneWithAbbreviation_ = - objc.registerName("timeZoneWithAbbreviation:"); - -/// NSTimeZone -class NSTimeZone extends objc.NSObject { - NSTimeZone._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTimeZone] that points to the same underlying object as [other]. - NSTimeZone.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTimeZone] that wraps the given raw object pointer. - NSTimeZone.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTimeZone]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTimeZone); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// data - objc.NSData get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// secondsFromGMTForDate: - int secondsFromGMTForDate_(objc.NSDate aDate) { - return _objc_msgSend_hrsqsi( - this.ref.pointer, _sel_secondsFromGMTForDate_, aDate.ref.pointer); - } - - /// abbreviationForDate: - objc.NSString? abbreviationForDate_(objc.NSDate aDate) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_abbreviationForDate_, aDate.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isDaylightSavingTimeForDate: - bool isDaylightSavingTimeForDate_(objc.NSDate aDate) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDaylightSavingTimeForDate_, aDate.ref.pointer); - } - - /// daylightSavingTimeOffsetForDate: - double daylightSavingTimeOffsetForDate_(objc.NSDate aDate) { - return objc.useMsgSendVariants - ? _objc_msgSend_om71r5Fpret(this.ref.pointer, - _sel_daylightSavingTimeOffsetForDate_, aDate.ref.pointer) - : _objc_msgSend_om71r5(this.ref.pointer, - _sel_daylightSavingTimeOffsetForDate_, aDate.ref.pointer); - } - - /// nextDaylightSavingTimeTransitionAfterDate: - objc.NSDate? nextDaylightSavingTimeTransitionAfterDate_(objc.NSDate aDate) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_nextDaylightSavingTimeTransitionAfterDate_, aDate.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// systemTimeZone - static NSTimeZone getSystemTimeZone() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_systemTimeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// resetSystemTimeZone - static void resetSystemTimeZone() { - _objc_msgSend_ksby9f(_class_NSTimeZone, _sel_resetSystemTimeZone); - } - - /// defaultTimeZone - static NSTimeZone getDefaultTimeZone() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_defaultTimeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setDefaultTimeZone: - static void setDefaultTimeZone(NSTimeZone value) { - return _objc_msgSend_ukcdfq( - _class_NSTimeZone, _sel_setDefaultTimeZone_, value.ref.pointer); - } - - /// localTimeZone - static NSTimeZone getLocalTimeZone() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_localTimeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// knownTimeZoneNames - static objc.NSArray getKnownTimeZoneNames() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_knownTimeZoneNames); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// abbreviationDictionary - static objc.NSDictionary getAbbreviationDictionary() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_abbreviationDictionary); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setAbbreviationDictionary: - static void setAbbreviationDictionary(objc.NSDictionary value) { - return _objc_msgSend_ukcdfq( - _class_NSTimeZone, _sel_setAbbreviationDictionary_, value.ref.pointer); - } - - /// timeZoneDataVersion - static objc.NSString getTimeZoneDataVersion() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_timeZoneDataVersion); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// secondsFromGMT - int get secondsFromGMT { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_secondsFromGMT); - } - - /// abbreviation - objc.NSString? get abbreviation { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_abbreviation); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isDaylightSavingTime - bool get daylightSavingTime { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isDaylightSavingTime); - } - - /// daylightSavingTimeOffset - double get daylightSavingTimeOffset { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_daylightSavingTimeOffset) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_daylightSavingTimeOffset); - } - - /// nextDaylightSavingTimeTransition - objc.NSDate? get nextDaylightSavingTimeTransition { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_nextDaylightSavingTimeTransition); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// description - objc.NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isEqualToTimeZone: - bool isEqualToTimeZone_(NSTimeZone aTimeZone) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToTimeZone_, aTimeZone.ref.pointer); - } - - /// localizedName:locale: - objc.NSString? localizedName_locale_( - NSTimeZoneNameStyle style, objc.NSLocale? locale) { - final _ret = _objc_msgSend_1c91ngg( - this.ref.pointer, - _sel_localizedName_locale_, - style.value, - locale?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZoneWithName: - static NSTimeZone? timeZoneWithName_(objc.NSString tzName) { - final _ret = _objc_msgSend_juohf7( - _class_NSTimeZone, _sel_timeZoneWithName_, tzName.ref.pointer); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZoneWithName:data: - static NSTimeZone? timeZoneWithName_data_( - objc.NSString tzName, objc.NSData? aData) { - final _ret = _objc_msgSend_iq11qg( - _class_NSTimeZone, - _sel_timeZoneWithName_data_, - tzName.ref.pointer, - aData?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithName: - NSTimeZone? initWithName_(objc.NSString tzName) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithName_, tzName.ref.pointer); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithName:data: - NSTimeZone? initWithName_data_(objc.NSString tzName, objc.NSData? aData) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithName_data_, - tzName.ref.pointer, - aData?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// timeZoneForSecondsFromGMT: - static NSTimeZone timeZoneForSecondsFromGMT_(int seconds) { - final _ret = _objc_msgSend_crtxa9( - _class_NSTimeZone, _sel_timeZoneForSecondsFromGMT_, seconds); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZoneWithAbbreviation: - static NSTimeZone? timeZoneWithAbbreviation_(objc.NSString abbreviation) { - final _ret = _objc_msgSend_juohf7(_class_NSTimeZone, - _sel_timeZoneWithAbbreviation_, abbreviation.ref.pointer); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSTimeZone init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSTimeZone new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_new); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSTimeZone allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSTimeZone, _sel_allocWithZone_, zone); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSTimeZone alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_alloc); - return NSTimeZone.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTimeZone, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTimeZone, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTimeZone, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSTimeZone, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTimeZone, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTimeZone, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTimeZone, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTimeZone, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimeZone, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSTimeZone, _sel_supportsSecureCoding); - } -} - -late final _sel_timeZone = objc.registerName("timeZone"); -late final _sel_setTimeZone_ = objc.registerName("setTimeZone:"); -late final _class_NSCalendar = objc.getClass("NSCalendar"); -late final _sel_currentCalendar = objc.registerName("currentCalendar"); -late final _sel_autoupdatingCurrentCalendar = - objc.registerName("autoupdatingCurrentCalendar"); -late final _sel_calendarWithIdentifier_ = - objc.registerName("calendarWithIdentifier:"); -late final _sel_initWithCalendarIdentifier_ = - objc.registerName("initWithCalendarIdentifier:"); -late final _sel_calendarIdentifier = objc.registerName("calendarIdentifier"); -late final _sel_firstWeekday = objc.registerName("firstWeekday"); -late final _sel_setFirstWeekday_ = objc.registerName("setFirstWeekday:"); -final _objc_msgSend_1k4zaz5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_minimumDaysInFirstWeek = - objc.registerName("minimumDaysInFirstWeek"); -late final _sel_setMinimumDaysInFirstWeek_ = - objc.registerName("setMinimumDaysInFirstWeek:"); -late final _sel_eraSymbols = objc.registerName("eraSymbols"); -late final _sel_longEraSymbols = objc.registerName("longEraSymbols"); -late final _sel_monthSymbols = objc.registerName("monthSymbols"); -late final _sel_shortMonthSymbols = objc.registerName("shortMonthSymbols"); -late final _sel_veryShortMonthSymbols = - objc.registerName("veryShortMonthSymbols"); -late final _sel_standaloneMonthSymbols = - objc.registerName("standaloneMonthSymbols"); -late final _sel_shortStandaloneMonthSymbols = - objc.registerName("shortStandaloneMonthSymbols"); -late final _sel_veryShortStandaloneMonthSymbols = - objc.registerName("veryShortStandaloneMonthSymbols"); -late final _sel_weekdaySymbols = objc.registerName("weekdaySymbols"); -late final _sel_shortWeekdaySymbols = objc.registerName("shortWeekdaySymbols"); -late final _sel_veryShortWeekdaySymbols = - objc.registerName("veryShortWeekdaySymbols"); -late final _sel_standaloneWeekdaySymbols = - objc.registerName("standaloneWeekdaySymbols"); -late final _sel_shortStandaloneWeekdaySymbols = - objc.registerName("shortStandaloneWeekdaySymbols"); -late final _sel_veryShortStandaloneWeekdaySymbols = - objc.registerName("veryShortStandaloneWeekdaySymbols"); -late final _sel_quarterSymbols = objc.registerName("quarterSymbols"); -late final _sel_shortQuarterSymbols = objc.registerName("shortQuarterSymbols"); -late final _sel_standaloneQuarterSymbols = - objc.registerName("standaloneQuarterSymbols"); -late final _sel_shortStandaloneQuarterSymbols = - objc.registerName("shortStandaloneQuarterSymbols"); -late final _sel_AMSymbol = objc.registerName("AMSymbol"); -late final _sel_PMSymbol = objc.registerName("PMSymbol"); - -enum NSCalendarUnit { - NSCalendarUnitEra(2), - NSCalendarUnitYear(4), - NSCalendarUnitMonth(8), - NSCalendarUnitDay(16), - NSCalendarUnitHour(32), - NSCalendarUnitMinute(64), - NSCalendarUnitSecond(128), - NSCalendarUnitWeekday(512), - NSCalendarUnitWeekdayOrdinal(1024), - NSCalendarUnitQuarter(2048), - NSCalendarUnitWeekOfMonth(4096), - NSCalendarUnitWeekOfYear(8192), - NSCalendarUnitYearForWeekOfYear(16384), - NSCalendarUnitNanosecond(32768), - NSCalendarUnitCalendar(1048576), - NSCalendarUnitTimeZone(2097152), - NSWeekCalendarUnit(256); - - static const NSEraCalendarUnit = NSCalendarUnitEra; - static const NSYearCalendarUnit = NSCalendarUnitYear; - static const NSMonthCalendarUnit = NSCalendarUnitMonth; - static const NSDayCalendarUnit = NSCalendarUnitDay; - static const NSHourCalendarUnit = NSCalendarUnitHour; - static const NSMinuteCalendarUnit = NSCalendarUnitMinute; - static const NSSecondCalendarUnit = NSCalendarUnitSecond; - static const NSWeekdayCalendarUnit = NSCalendarUnitWeekday; - static const NSWeekdayOrdinalCalendarUnit = NSCalendarUnitWeekdayOrdinal; - static const NSQuarterCalendarUnit = NSCalendarUnitQuarter; - static const NSWeekOfMonthCalendarUnit = NSCalendarUnitWeekOfMonth; - static const NSWeekOfYearCalendarUnit = NSCalendarUnitWeekOfYear; - static const NSYearForWeekOfYearCalendarUnit = - NSCalendarUnitYearForWeekOfYear; - static const NSCalendarCalendarUnit = NSCalendarUnitCalendar; - static const NSTimeZoneCalendarUnit = NSCalendarUnitTimeZone; - - final int value; - const NSCalendarUnit(this.value); - - static NSCalendarUnit fromValue(int value) => switch (value) { - 2 => NSCalendarUnitEra, - 4 => NSCalendarUnitYear, - 8 => NSCalendarUnitMonth, - 16 => NSCalendarUnitDay, - 32 => NSCalendarUnitHour, - 64 => NSCalendarUnitMinute, - 128 => NSCalendarUnitSecond, - 512 => NSCalendarUnitWeekday, - 1024 => NSCalendarUnitWeekdayOrdinal, - 2048 => NSCalendarUnitQuarter, - 4096 => NSCalendarUnitWeekOfMonth, - 8192 => NSCalendarUnitWeekOfYear, - 16384 => NSCalendarUnitYearForWeekOfYear, - 32768 => NSCalendarUnitNanosecond, - 1048576 => NSCalendarUnitCalendar, - 2097152 => NSCalendarUnitTimeZone, - 256 => NSWeekCalendarUnit, - _ => throw ArgumentError("Unknown value for NSCalendarUnit: $value"), - }; - - @override - String toString() { - if (this == NSCalendarUnitEra) - return "NSCalendarUnit.NSCalendarUnitEra, NSCalendarUnit.NSEraCalendarUnit"; - if (this == NSCalendarUnitYear) - return "NSCalendarUnit.NSCalendarUnitYear, NSCalendarUnit.NSYearCalendarUnit"; - if (this == NSCalendarUnitMonth) - return "NSCalendarUnit.NSCalendarUnitMonth, NSCalendarUnit.NSMonthCalendarUnit"; - if (this == NSCalendarUnitDay) - return "NSCalendarUnit.NSCalendarUnitDay, NSCalendarUnit.NSDayCalendarUnit"; - if (this == NSCalendarUnitHour) - return "NSCalendarUnit.NSCalendarUnitHour, NSCalendarUnit.NSHourCalendarUnit"; - if (this == NSCalendarUnitMinute) - return "NSCalendarUnit.NSCalendarUnitMinute, NSCalendarUnit.NSMinuteCalendarUnit"; - if (this == NSCalendarUnitSecond) - return "NSCalendarUnit.NSCalendarUnitSecond, NSCalendarUnit.NSSecondCalendarUnit"; - if (this == NSCalendarUnitWeekday) - return "NSCalendarUnit.NSCalendarUnitWeekday, NSCalendarUnit.NSWeekdayCalendarUnit"; - if (this == NSCalendarUnitWeekdayOrdinal) - return "NSCalendarUnit.NSCalendarUnitWeekdayOrdinal, NSCalendarUnit.NSWeekdayOrdinalCalendarUnit"; - if (this == NSCalendarUnitQuarter) - return "NSCalendarUnit.NSCalendarUnitQuarter, NSCalendarUnit.NSQuarterCalendarUnit"; - if (this == NSCalendarUnitWeekOfMonth) - return "NSCalendarUnit.NSCalendarUnitWeekOfMonth, NSCalendarUnit.NSWeekOfMonthCalendarUnit"; - if (this == NSCalendarUnitWeekOfYear) - return "NSCalendarUnit.NSCalendarUnitWeekOfYear, NSCalendarUnit.NSWeekOfYearCalendarUnit"; - if (this == NSCalendarUnitYearForWeekOfYear) - return "NSCalendarUnit.NSCalendarUnitYearForWeekOfYear, NSCalendarUnit.NSYearForWeekOfYearCalendarUnit"; - if (this == NSCalendarUnitCalendar) - return "NSCalendarUnit.NSCalendarUnitCalendar, NSCalendarUnit.NSCalendarCalendarUnit"; - if (this == NSCalendarUnitTimeZone) - return "NSCalendarUnit.NSCalendarUnitTimeZone, NSCalendarUnit.NSTimeZoneCalendarUnit"; - return super.toString(); - } -} - -late final _sel_minimumRangeOfUnit_ = objc.registerName("minimumRangeOfUnit:"); -final _objc_msgSend_8biqtb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_8biqtbStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_maximumRangeOfUnit_ = objc.registerName("maximumRangeOfUnit:"); -late final _sel_rangeOfUnit_inUnit_forDate_ = - objc.registerName("rangeOfUnit:inUnit:forDate:"); -final _objc_msgSend_1lmqh7m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -final _objc_msgSend_1lmqh7mStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -late final _sel_ordinalityOfUnit_inUnit_forDate_ = - objc.registerName("ordinalityOfUnit:inUnit:forDate:"); -final _objc_msgSend_1bi4n7h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -late final _sel_rangeOfUnit_startDate_interval_forDate_ = - objc.registerName("rangeOfUnit:startDate:interval:forDate:"); -final _objc_msgSend_amvrpq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>(); -late final _class_NSDateComponents = objc.getClass("NSDateComponents"); -late final _sel_calendar = objc.registerName("calendar"); -late final _sel_setCalendar_ = objc.registerName("setCalendar:"); -late final _sel_era = objc.registerName("era"); -late final _sel_setEra_ = objc.registerName("setEra:"); -final _objc_msgSend_ke7qz2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_year = objc.registerName("year"); -late final _sel_setYear_ = objc.registerName("setYear:"); -late final _sel_month = objc.registerName("month"); -late final _sel_setMonth_ = objc.registerName("setMonth:"); -late final _sel_day = objc.registerName("day"); -late final _sel_setDay_ = objc.registerName("setDay:"); -late final _sel_hour = objc.registerName("hour"); -late final _sel_setHour_ = objc.registerName("setHour:"); -late final _sel_minute = objc.registerName("minute"); -late final _sel_setMinute_ = objc.registerName("setMinute:"); -late final _sel_second = objc.registerName("second"); -late final _sel_setSecond_ = objc.registerName("setSecond:"); -late final _sel_nanosecond = objc.registerName("nanosecond"); -late final _sel_setNanosecond_ = objc.registerName("setNanosecond:"); -late final _sel_weekday = objc.registerName("weekday"); -late final _sel_setWeekday_ = objc.registerName("setWeekday:"); -late final _sel_weekdayOrdinal = objc.registerName("weekdayOrdinal"); -late final _sel_setWeekdayOrdinal_ = objc.registerName("setWeekdayOrdinal:"); -late final _sel_quarter = objc.registerName("quarter"); -late final _sel_setQuarter_ = objc.registerName("setQuarter:"); -late final _sel_weekOfMonth = objc.registerName("weekOfMonth"); -late final _sel_setWeekOfMonth_ = objc.registerName("setWeekOfMonth:"); -late final _sel_weekOfYear = objc.registerName("weekOfYear"); -late final _sel_setWeekOfYear_ = objc.registerName("setWeekOfYear:"); -late final _sel_yearForWeekOfYear = objc.registerName("yearForWeekOfYear"); -late final _sel_setYearForWeekOfYear_ = - objc.registerName("setYearForWeekOfYear:"); -late final _sel_isLeapMonth = objc.registerName("isLeapMonth"); -late final _sel_setLeapMonth_ = objc.registerName("setLeapMonth:"); -late final _sel_date = objc.registerName("date"); -late final _sel_week = objc.registerName("week"); -late final _sel_setWeek_ = objc.registerName("setWeek:"); -late final _sel_setValue_forComponent_ = - objc.registerName("setValue:forComponent:"); -final _objc_msgSend_13g4496 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -late final _sel_valueForComponent_ = objc.registerName("valueForComponent:"); -final _objc_msgSend_1uobo2v = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_isValidDate = objc.registerName("isValidDate"); -late final _sel_isValidDateInCalendar_ = - objc.registerName("isValidDateInCalendar:"); - -/// NSDateComponents -class NSDateComponents extends objc.NSObject { - NSDateComponents._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDateComponents] that points to the same underlying object as [other]. - NSDateComponents.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDateComponents] that wraps the given raw object pointer. - NSDateComponents.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDateComponents]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDateComponents); - } - - /// calendar - NSCalendar? get calendar { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_calendar); - return _ret.address == 0 - ? null - : NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// setCalendar: - set calendar(NSCalendar? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCalendar_, value?.ref.pointer ?? ffi.nullptr); - } - - /// timeZone - NSTimeZone? get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setTimeZone: - set timeZone(NSTimeZone? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setTimeZone_, value?.ref.pointer ?? ffi.nullptr); - } - - /// era - int get era { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_era); - } - - /// setEra: - set era(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setEra_, value); - } - - /// year - int get year { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_year); - } - - /// setYear: - set year(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setYear_, value); - } - - /// month - int get month { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_month); - } - - /// setMonth: - set month(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setMonth_, value); - } - - /// day - int get day { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_day); - } - - /// setDay: - set day(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setDay_, value); - } - - /// hour - int get hour { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_hour); - } - - /// setHour: - set hour(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setHour_, value); - } - - /// minute - int get minute { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_minute); - } - - /// setMinute: - set minute(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setMinute_, value); - } - - /// second - int get second { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_second); - } - - /// setSecond: - set second(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setSecond_, value); - } - - /// nanosecond - int get nanosecond { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_nanosecond); - } - - /// setNanosecond: - set nanosecond(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setNanosecond_, value); - } - - /// weekday - int get weekday { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekday); - } - - /// setWeekday: - set weekday(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeekday_, value); - } - - /// weekdayOrdinal - int get weekdayOrdinal { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekdayOrdinal); - } - - /// setWeekdayOrdinal: - set weekdayOrdinal(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setWeekdayOrdinal_, value); - } - - /// quarter - int get quarter { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_quarter); - } - - /// setQuarter: - set quarter(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setQuarter_, value); - } - - /// weekOfMonth - int get weekOfMonth { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekOfMonth); - } - - /// setWeekOfMonth: - set weekOfMonth(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeekOfMonth_, value); - } - - /// weekOfYear - int get weekOfYear { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_weekOfYear); - } - - /// setWeekOfYear: - set weekOfYear(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeekOfYear_, value); - } - - /// yearForWeekOfYear - int get yearForWeekOfYear { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_yearForWeekOfYear); - } - - /// setYearForWeekOfYear: - set yearForWeekOfYear(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setYearForWeekOfYear_, value); - } - - /// isLeapMonth - bool get leapMonth { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLeapMonth); - } - - /// setLeapMonth: - set leapMonth(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setLeapMonth_, value); - } - - /// date - objc.NSDate? get date { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_date); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// week - int week() { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_week); - } - - /// setWeek: - void setWeek_(int v) { - _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setWeek_, v); - } - - /// setValue:forComponent: - void setValue_forComponent_(int value, NSCalendarUnit unit) { - _objc_msgSend_13g4496( - this.ref.pointer, _sel_setValue_forComponent_, value, unit.value); - } - - /// valueForComponent: - int valueForComponent_(NSCalendarUnit unit) { - return _objc_msgSend_1uobo2v( - this.ref.pointer, _sel_valueForComponent_, unit.value); - } - - /// isValidDate - bool get validDate { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValidDate); - } - - /// isValidDateInCalendar: - bool isValidDateInCalendar_(NSCalendar calendar) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isValidDateInCalendar_, calendar.ref.pointer); - } - - /// init - NSDateComponents init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSDateComponents new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateComponents, _sel_new); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSDateComponents allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDateComponents, _sel_allocWithZone_, zone); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSDateComponents alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateComponents, _sel_alloc); - return NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDateComponents, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDateComponents, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDateComponents, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSDateComponents, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDateComponents, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDateComponents, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDateComponents, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateComponents, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateComponents, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSDateComponents self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSDateComponents retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSDateComponents autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSDateComponents, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSDateComponents? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDateComponents.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_dateFromComponents_ = objc.registerName("dateFromComponents:"); -late final _sel_components_fromDate_ = - objc.registerName("components:fromDate:"); -final _objc_msgSend_t9w2ff = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - -enum NSCalendarOptions { - NSCalendarWrapComponents(1), - NSCalendarMatchStrictly(2), - NSCalendarSearchBackwards(4), - NSCalendarMatchPreviousTimePreservingSmallerUnits(256), - NSCalendarMatchNextTimePreservingSmallerUnits(512), - NSCalendarMatchNextTime(1024), - NSCalendarMatchFirst(4096), - NSCalendarMatchLast(8192); - - final int value; - const NSCalendarOptions(this.value); - - static NSCalendarOptions fromValue(int value) => switch (value) { - 1 => NSCalendarWrapComponents, - 2 => NSCalendarMatchStrictly, - 4 => NSCalendarSearchBackwards, - 256 => NSCalendarMatchPreviousTimePreservingSmallerUnits, - 512 => NSCalendarMatchNextTimePreservingSmallerUnits, - 1024 => NSCalendarMatchNextTime, - 4096 => NSCalendarMatchFirst, - 8192 => NSCalendarMatchLast, - _ => throw ArgumentError("Unknown value for NSCalendarOptions: $value"), - }; -} - -late final _sel_dateByAddingComponents_toDate_options_ = - objc.registerName("dateByAddingComponents:toDate:options:"); -final _objc_msgSend_2sm1zi = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_components_fromDate_toDate_options_ = - objc.registerName("components:fromDate:toDate:options:"); -final _objc_msgSend_1jc93x2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_getEra_year_month_day_fromDate_ = - objc.registerName("getEra:year:month:day:fromDate:"); -final _objc_msgSend_1ermmsa = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate_ = - objc.registerName("getEra:yearForWeekOfYear:weekOfYear:weekday:fromDate:"); -late final _sel_getHour_minute_second_nanosecond_fromDate_ = - objc.registerName("getHour:minute:second:nanosecond:fromDate:"); -late final _sel_component_fromDate_ = objc.registerName("component:fromDate:"); -final _objc_msgSend_tm9h70 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_dateWithEra_year_month_day_hour_minute_second_nanosecond_ = objc - .registerName("dateWithEra:year:month:day:hour:minute:second:nanosecond:"); -final _objc_msgSend_1747i7s = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Long)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - int, - int, - int, - int, - int, - int)>(); -late final _sel_dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond_ = - objc.registerName( - "dateWithEra:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:"); -late final _sel_startOfDayForDate_ = objc.registerName("startOfDayForDate:"); -late final _sel_componentsInTimeZone_fromDate_ = - objc.registerName("componentsInTimeZone:fromDate:"); -late final _sel_compareDate_toDate_toUnitGranularity_ = - objc.registerName("compareDate:toDate:toUnitGranularity:"); -final _objc_msgSend_jpc2bg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_isDate_equalToDate_toUnitGranularity_ = - objc.registerName("isDate:equalToDate:toUnitGranularity:"); -final _objc_msgSend_188aig1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_isDate_inSameDayAsDate_ = - objc.registerName("isDate:inSameDayAsDate:"); -final _objc_msgSend_1ywe6ev = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isDateInToday_ = objc.registerName("isDateInToday:"); -late final _sel_isDateInYesterday_ = objc.registerName("isDateInYesterday:"); -late final _sel_isDateInTomorrow_ = objc.registerName("isDateInTomorrow:"); -late final _sel_isDateInWeekend_ = objc.registerName("isDateInWeekend:"); -late final _sel_rangeOfWeekendStartDate_interval_containingDate_ = - objc.registerName("rangeOfWeekendStartDate:interval:containingDate:"); -final _objc_msgSend_seipso = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_nextWeekendStartDate_interval_options_afterDate_ = - objc.registerName("nextWeekendStartDate:interval:options:afterDate:"); -final _objc_msgSend_1brdgri = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_components_fromDateComponents_toDateComponents_options_ = objc - .registerName("components:fromDateComponents:toDateComponents:options:"); -late final _sel_dateByAddingUnit_value_toDate_options_ = - objc.registerName("dateByAddingUnit:value:toDate:options:"); -final _objc_msgSend_b1fge4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Long, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - int)>(); -void _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Bool arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, bool, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDate_bool_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSDate_bool_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDate_bool_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Bool, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerCallable = ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_NSDate_bool_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function( - objc.NSDate?, ffi.Bool, ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - fromFunctionPointer( - ffi.Pointer arg0, ffi.Bool arg1, ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSDate_bool_bool_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - void Function(objc.NSDate?, bool, ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDate_bool_bool_closureCallable, - (ffi.Pointer arg0, bool arg1, ffi.Pointer arg2) => fn( - arg0.address == 0 - ? null - : objc.NSDate.castFromPointer(arg0, retain: true, release: true), - arg1, - arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - listener(void Function(objc.NSDate?, bool, ffi.Pointer) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDate_bool_bool_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, bool arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.NSDate.castFromPointer(arg0, - retain: false, release: true), - arg1, - arg2)); - final wrapper = _wrapListenerBlock_rvgf02(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_NSDate_bool_bool_CallExtension on objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> { - void call(objc.NSDate? arg0, bool arg1, ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Bool arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1, arg2); -} - -late final _sel_enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock_ = - objc.registerName( - "enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock:"); -final _objc_msgSend_z9v2cv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_nextDateAfterDate_matchingComponents_options_ = - objc.registerName("nextDateAfterDate:matchingComponents:options:"); -late final _sel_nextDateAfterDate_matchingUnit_value_options_ = - objc.registerName("nextDateAfterDate:matchingUnit:value:options:"); -final _objc_msgSend_1im3h6w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Long, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - int)>(); -late final _sel_nextDateAfterDate_matchingHour_minute_second_options_ = - objc.registerName("nextDateAfterDate:matchingHour:minute:second:options:"); -final _objc_msgSend_tio5o0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - int, - int)>(); -late final _sel_dateBySettingUnit_value_ofDate_options_ = - objc.registerName("dateBySettingUnit:value:ofDate:options:"); -late final _sel_dateBySettingHour_minute_second_ofDate_options_ = - objc.registerName("dateBySettingHour:minute:second:ofDate:options:"); -final _objc_msgSend_16h627a = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Long, - ffi.Long, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - int, - ffi.Pointer, - int)>(); -late final _sel_date_matchesComponents_ = - objc.registerName("date:matchesComponents:"); - -/// NSCalendar -class NSCalendar extends objc.NSObject { - NSCalendar._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSCalendar] that points to the same underlying object as [other]. - NSCalendar.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSCalendar] that wraps the given raw object pointer. - NSCalendar.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSCalendar]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSCalendar); - } - - /// currentCalendar - static NSCalendar getCurrentCalendar() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_currentCalendar); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// autoupdatingCurrentCalendar - static NSCalendar getAutoupdatingCurrentCalendar() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCalendar, _sel_autoupdatingCurrentCalendar); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// calendarWithIdentifier: - static NSCalendar? calendarWithIdentifier_( - objc.NSString calendarIdentifierConstant) { - final _ret = _objc_msgSend_juohf7(_class_NSCalendar, - _sel_calendarWithIdentifier_, calendarIdentifierConstant.ref.pointer); - return _ret.address == 0 - ? null - : NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSCalendar init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCalendarIdentifier: - objc.ObjCObjectBase? initWithCalendarIdentifier_(objc.NSString ident) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCalendarIdentifier_, ident.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// calendarIdentifier - objc.NSString get calendarIdentifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_calendarIdentifier); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// locale - objc.NSLocale? get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return _ret.address == 0 - ? null - : objc.NSLocale.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.NSLocale? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value?.ref.pointer ?? ffi.nullptr); - } - - /// timeZone - NSTimeZone get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setTimeZone: - set timeZone(NSTimeZone value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setTimeZone_, value.ref.pointer); - } - - /// firstWeekday - int get firstWeekday { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_firstWeekday); - } - - /// setFirstWeekday: - set firstWeekday(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setFirstWeekday_, value); - } - - /// minimumDaysInFirstWeek - int get minimumDaysInFirstWeek { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_minimumDaysInFirstWeek); - } - - /// setMinimumDaysInFirstWeek: - set minimumDaysInFirstWeek(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumDaysInFirstWeek_, value); - } - - /// eraSymbols - objc.NSArray get eraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_eraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// longEraSymbols - objc.NSArray get longEraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_longEraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// monthSymbols - objc.NSArray get monthSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_monthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortMonthSymbols - objc.NSArray get shortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortMonthSymbols - objc.NSArray get veryShortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// standaloneMonthSymbols - objc.NSArray get standaloneMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortStandaloneMonthSymbols - objc.NSArray get shortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortStandaloneMonthSymbols - objc.NSArray get veryShortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// weekdaySymbols - objc.NSArray get weekdaySymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_weekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortWeekdaySymbols - objc.NSArray get shortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortWeekdaySymbols - objc.NSArray get veryShortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// standaloneWeekdaySymbols - objc.NSArray get standaloneWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortStandaloneWeekdaySymbols - objc.NSArray get shortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// veryShortStandaloneWeekdaySymbols - objc.NSArray get veryShortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// quarterSymbols - objc.NSArray get quarterSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_quarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortQuarterSymbols - objc.NSArray get shortQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// standaloneQuarterSymbols - objc.NSArray get standaloneQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// shortStandaloneQuarterSymbols - objc.NSArray get shortStandaloneQuarterSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// AMSymbol - objc.NSString get AMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_AMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// PMSymbol - objc.NSString get PMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_PMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// minimumRangeOfUnit: - objc.NSRange minimumRangeOfUnit_(NSCalendarUnit unit) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_8biqtbStret( - _ptr, this.ref.pointer, _sel_minimumRangeOfUnit_, unit.value) - : _ptr.ref = _objc_msgSend_8biqtb( - this.ref.pointer, _sel_minimumRangeOfUnit_, unit.value); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// maximumRangeOfUnit: - objc.NSRange maximumRangeOfUnit_(NSCalendarUnit unit) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_8biqtbStret( - _ptr, this.ref.pointer, _sel_maximumRangeOfUnit_, unit.value) - : _ptr.ref = _objc_msgSend_8biqtb( - this.ref.pointer, _sel_maximumRangeOfUnit_, unit.value); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// rangeOfUnit:inUnit:forDate: - objc.NSRange rangeOfUnit_inUnit_forDate_( - NSCalendarUnit smaller, NSCalendarUnit larger, objc.NSDate date) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1lmqh7mStret( - _ptr, - this.ref.pointer, - _sel_rangeOfUnit_inUnit_forDate_, - smaller.value, - larger.value, - date.ref.pointer) - : _ptr.ref = _objc_msgSend_1lmqh7m( - this.ref.pointer, - _sel_rangeOfUnit_inUnit_forDate_, - smaller.value, - larger.value, - date.ref.pointer); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// ordinalityOfUnit:inUnit:forDate: - int ordinalityOfUnit_inUnit_forDate_( - NSCalendarUnit smaller, NSCalendarUnit larger, objc.NSDate date) { - return _objc_msgSend_1bi4n7h( - this.ref.pointer, - _sel_ordinalityOfUnit_inUnit_forDate_, - smaller.value, - larger.value, - date.ref.pointer); - } - - /// rangeOfUnit:startDate:interval:forDate: - bool rangeOfUnit_startDate_interval_forDate_( - NSCalendarUnit unit, - ffi.Pointer> datep, - ffi.Pointer tip, - objc.NSDate date) { - return _objc_msgSend_amvrpq( - this.ref.pointer, - _sel_rangeOfUnit_startDate_interval_forDate_, - unit.value, - datep, - tip, - date.ref.pointer); - } - - /// dateFromComponents: - objc.NSDate? dateFromComponents_(NSDateComponents comps) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dateFromComponents_, comps.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// components:fromDate: - NSDateComponents components_fromDate_( - NSCalendarUnit unitFlags, objc.NSDate date) { - final _ret = _objc_msgSend_t9w2ff(this.ref.pointer, - _sel_components_fromDate_, unitFlags.value, date.ref.pointer); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// dateByAddingComponents:toDate:options: - objc.NSDate? dateByAddingComponents_toDate_options_( - NSDateComponents comps, objc.NSDate date, NSCalendarOptions opts) { - final _ret = _objc_msgSend_2sm1zi( - this.ref.pointer, - _sel_dateByAddingComponents_toDate_options_, - comps.ref.pointer, - date.ref.pointer, - opts.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// components:fromDate:toDate:options: - NSDateComponents components_fromDate_toDate_options_( - NSCalendarUnit unitFlags, - objc.NSDate startingDate, - objc.NSDate resultDate, - NSCalendarOptions opts) { - final _ret = _objc_msgSend_1jc93x2( - this.ref.pointer, - _sel_components_fromDate_toDate_options_, - unitFlags.value, - startingDate.ref.pointer, - resultDate.ref.pointer, - opts.value); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// getEra:year:month:day:fromDate: - void getEra_year_month_day_fromDate_( - ffi.Pointer eraValuePointer, - ffi.Pointer yearValuePointer, - ffi.Pointer monthValuePointer, - ffi.Pointer dayValuePointer, - objc.NSDate date) { - _objc_msgSend_1ermmsa( - this.ref.pointer, - _sel_getEra_year_month_day_fromDate_, - eraValuePointer, - yearValuePointer, - monthValuePointer, - dayValuePointer, - date.ref.pointer); - } - - /// getEra:yearForWeekOfYear:weekOfYear:weekday:fromDate: - void getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate_( - ffi.Pointer eraValuePointer, - ffi.Pointer yearValuePointer, - ffi.Pointer weekValuePointer, - ffi.Pointer weekdayValuePointer, - objc.NSDate date) { - _objc_msgSend_1ermmsa( - this.ref.pointer, - _sel_getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate_, - eraValuePointer, - yearValuePointer, - weekValuePointer, - weekdayValuePointer, - date.ref.pointer); - } - - /// getHour:minute:second:nanosecond:fromDate: - void getHour_minute_second_nanosecond_fromDate_( - ffi.Pointer hourValuePointer, - ffi.Pointer minuteValuePointer, - ffi.Pointer secondValuePointer, - ffi.Pointer nanosecondValuePointer, - objc.NSDate date) { - _objc_msgSend_1ermmsa( - this.ref.pointer, - _sel_getHour_minute_second_nanosecond_fromDate_, - hourValuePointer, - minuteValuePointer, - secondValuePointer, - nanosecondValuePointer, - date.ref.pointer); - } - - /// component:fromDate: - int component_fromDate_(NSCalendarUnit unit, objc.NSDate date) { - return _objc_msgSend_tm9h70(this.ref.pointer, _sel_component_fromDate_, - unit.value, date.ref.pointer); - } - - /// dateWithEra:year:month:day:hour:minute:second:nanosecond: - objc.NSDate? dateWithEra_year_month_day_hour_minute_second_nanosecond_( - int eraValue, - int yearValue, - int monthValue, - int dayValue, - int hourValue, - int minuteValue, - int secondValue, - int nanosecondValue) { - final _ret = _objc_msgSend_1747i7s( - this.ref.pointer, - _sel_dateWithEra_year_month_day_hour_minute_second_nanosecond_, - eraValue, - yearValue, - monthValue, - dayValue, - hourValue, - minuteValue, - secondValue, - nanosecondValue); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateWithEra:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond: - objc.NSDate? - dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond_( - int eraValue, - int yearValue, - int weekValue, - int weekdayValue, - int hourValue, - int minuteValue, - int secondValue, - int nanosecondValue) { - final _ret = _objc_msgSend_1747i7s( - this.ref.pointer, - _sel_dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond_, - eraValue, - yearValue, - weekValue, - weekdayValue, - hourValue, - minuteValue, - secondValue, - nanosecondValue); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// startOfDayForDate: - objc.NSDate startOfDayForDate_(objc.NSDate date) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_startOfDayForDate_, date.ref.pointer); - return objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// componentsInTimeZone:fromDate: - NSDateComponents componentsInTimeZone_fromDate_( - NSTimeZone timezone, objc.NSDate date) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_componentsInTimeZone_fromDate_, - timezone.ref.pointer, - date.ref.pointer); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// compareDate:toDate:toUnitGranularity: - objc.NSComparisonResult compareDate_toDate_toUnitGranularity_( - objc.NSDate date1, objc.NSDate date2, NSCalendarUnit unit) { - final _ret = _objc_msgSend_jpc2bg( - this.ref.pointer, - _sel_compareDate_toDate_toUnitGranularity_, - date1.ref.pointer, - date2.ref.pointer, - unit.value); - return objc.NSComparisonResult.fromValue(_ret); - } - - /// isDate:equalToDate:toUnitGranularity: - bool isDate_equalToDate_toUnitGranularity_( - objc.NSDate date1, objc.NSDate date2, NSCalendarUnit unit) { - return _objc_msgSend_188aig1( - this.ref.pointer, - _sel_isDate_equalToDate_toUnitGranularity_, - date1.ref.pointer, - date2.ref.pointer, - unit.value); - } - - /// isDate:inSameDayAsDate: - bool isDate_inSameDayAsDate_(objc.NSDate date1, objc.NSDate date2) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_isDate_inSameDayAsDate_, - date1.ref.pointer, date2.ref.pointer); - } - - /// isDateInToday: - bool isDateInToday_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInToday_, date.ref.pointer); - } - - /// isDateInYesterday: - bool isDateInYesterday_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInYesterday_, date.ref.pointer); - } - - /// isDateInTomorrow: - bool isDateInTomorrow_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInTomorrow_, date.ref.pointer); - } - - /// isDateInWeekend: - bool isDateInWeekend_(objc.NSDate date) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDateInWeekend_, date.ref.pointer); - } - - /// rangeOfWeekendStartDate:interval:containingDate: - bool rangeOfWeekendStartDate_interval_containingDate_( - ffi.Pointer> datep, - ffi.Pointer tip, - objc.NSDate date) { - return _objc_msgSend_seipso( - this.ref.pointer, - _sel_rangeOfWeekendStartDate_interval_containingDate_, - datep, - tip, - date.ref.pointer); - } - - /// nextWeekendStartDate:interval:options:afterDate: - bool nextWeekendStartDate_interval_options_afterDate_( - ffi.Pointer> datep, - ffi.Pointer tip, - NSCalendarOptions options, - objc.NSDate date) { - return _objc_msgSend_1brdgri( - this.ref.pointer, - _sel_nextWeekendStartDate_interval_options_afterDate_, - datep, - tip, - options.value, - date.ref.pointer); - } - - /// components:fromDateComponents:toDateComponents:options: - NSDateComponents components_fromDateComponents_toDateComponents_options_( - NSCalendarUnit unitFlags, - NSDateComponents startingDateComp, - NSDateComponents resultDateComp, - NSCalendarOptions options) { - final _ret = _objc_msgSend_1jc93x2( - this.ref.pointer, - _sel_components_fromDateComponents_toDateComponents_options_, - unitFlags.value, - startingDateComp.ref.pointer, - resultDateComp.ref.pointer, - options.value); - return NSDateComponents.castFromPointer(_ret, retain: true, release: true); - } - - /// dateByAddingUnit:value:toDate:options: - objc.NSDate? dateByAddingUnit_value_toDate_options_(NSCalendarUnit unit, - int value, objc.NSDate date, NSCalendarOptions options) { - final _ret = _objc_msgSend_b1fge4( - this.ref.pointer, - _sel_dateByAddingUnit_value_toDate_options_, - unit.value, - value, - date.ref.pointer, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock: - void enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock_( - objc.NSDate start, - NSDateComponents comps, - NSCalendarOptions opts, - objc.ObjCBlock< - ffi.Void Function(objc.NSDate?, ffi.Bool, ffi.Pointer)> - block) { - _objc_msgSend_z9v2cv( - this.ref.pointer, - _sel_enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock_, - start.ref.pointer, - comps.ref.pointer, - opts.value, - block.ref.pointer); - } - - /// nextDateAfterDate:matchingComponents:options: - objc.NSDate? nextDateAfterDate_matchingComponents_options_( - objc.NSDate date, NSDateComponents comps, NSCalendarOptions options) { - final _ret = _objc_msgSend_2sm1zi( - this.ref.pointer, - _sel_nextDateAfterDate_matchingComponents_options_, - date.ref.pointer, - comps.ref.pointer, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// nextDateAfterDate:matchingUnit:value:options: - objc.NSDate? nextDateAfterDate_matchingUnit_value_options_(objc.NSDate date, - NSCalendarUnit unit, int value, NSCalendarOptions options) { - final _ret = _objc_msgSend_1im3h6w( - this.ref.pointer, - _sel_nextDateAfterDate_matchingUnit_value_options_, - date.ref.pointer, - unit.value, - value, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// nextDateAfterDate:matchingHour:minute:second:options: - objc.NSDate? nextDateAfterDate_matchingHour_minute_second_options_( - objc.NSDate date, - int hourValue, - int minuteValue, - int secondValue, - NSCalendarOptions options) { - final _ret = _objc_msgSend_tio5o0( - this.ref.pointer, - _sel_nextDateAfterDate_matchingHour_minute_second_options_, - date.ref.pointer, - hourValue, - minuteValue, - secondValue, - options.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateBySettingUnit:value:ofDate:options: - objc.NSDate? dateBySettingUnit_value_ofDate_options_( - NSCalendarUnit unit, int v, objc.NSDate date, NSCalendarOptions opts) { - final _ret = _objc_msgSend_b1fge4( - this.ref.pointer, - _sel_dateBySettingUnit_value_ofDate_options_, - unit.value, - v, - date.ref.pointer, - opts.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateBySettingHour:minute:second:ofDate:options: - objc.NSDate? dateBySettingHour_minute_second_ofDate_options_( - int h, int m, int s, objc.NSDate date, NSCalendarOptions opts) { - final _ret = _objc_msgSend_16h627a( - this.ref.pointer, - _sel_dateBySettingHour_minute_second_ofDate_options_, - h, - m, - s, - date.ref.pointer, - opts.value); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// date:matchesComponents: - bool date_matchesComponents_(objc.NSDate date, NSDateComponents components) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_date_matchesComponents_, - date.ref.pointer, components.ref.pointer); - } - - /// new - static NSCalendar new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_new); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSCalendar allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSCalendar, _sel_allocWithZone_, zone); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSCalendar alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_alloc); - return NSCalendar.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSCalendar, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSCalendar, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSCalendar, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSCalendar, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSCalendar, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSCalendar, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSCalendar, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCalendar, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSCalendar, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSCalendar self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSCalendar retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSCalendar autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSCalendar, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSCalendar? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSCalendar.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_isLenient = objc.registerName("isLenient"); -late final _sel_setLenient_ = objc.registerName("setLenient:"); -late final _sel_twoDigitStartDate = objc.registerName("twoDigitStartDate"); -late final _sel_setTwoDigitStartDate_ = - objc.registerName("setTwoDigitStartDate:"); -late final _sel_defaultDate = objc.registerName("defaultDate"); -late final _sel_setDefaultDate_ = objc.registerName("setDefaultDate:"); -late final _sel_setEraSymbols_ = objc.registerName("setEraSymbols:"); -late final _sel_setMonthSymbols_ = objc.registerName("setMonthSymbols:"); -late final _sel_setShortMonthSymbols_ = - objc.registerName("setShortMonthSymbols:"); -late final _sel_setWeekdaySymbols_ = objc.registerName("setWeekdaySymbols:"); -late final _sel_setShortWeekdaySymbols_ = - objc.registerName("setShortWeekdaySymbols:"); -late final _sel_setAMSymbol_ = objc.registerName("setAMSymbol:"); -late final _sel_setPMSymbol_ = objc.registerName("setPMSymbol:"); -late final _sel_setLongEraSymbols_ = objc.registerName("setLongEraSymbols:"); -late final _sel_setVeryShortMonthSymbols_ = - objc.registerName("setVeryShortMonthSymbols:"); -late final _sel_setStandaloneMonthSymbols_ = - objc.registerName("setStandaloneMonthSymbols:"); -late final _sel_setShortStandaloneMonthSymbols_ = - objc.registerName("setShortStandaloneMonthSymbols:"); -late final _sel_setVeryShortStandaloneMonthSymbols_ = - objc.registerName("setVeryShortStandaloneMonthSymbols:"); -late final _sel_setVeryShortWeekdaySymbols_ = - objc.registerName("setVeryShortWeekdaySymbols:"); -late final _sel_setStandaloneWeekdaySymbols_ = - objc.registerName("setStandaloneWeekdaySymbols:"); -late final _sel_setShortStandaloneWeekdaySymbols_ = - objc.registerName("setShortStandaloneWeekdaySymbols:"); -late final _sel_setVeryShortStandaloneWeekdaySymbols_ = - objc.registerName("setVeryShortStandaloneWeekdaySymbols:"); -late final _sel_setQuarterSymbols_ = objc.registerName("setQuarterSymbols:"); -late final _sel_setShortQuarterSymbols_ = - objc.registerName("setShortQuarterSymbols:"); -late final _sel_setStandaloneQuarterSymbols_ = - objc.registerName("setStandaloneQuarterSymbols:"); -late final _sel_setShortStandaloneQuarterSymbols_ = - objc.registerName("setShortStandaloneQuarterSymbols:"); -late final _sel_gregorianStartDate = objc.registerName("gregorianStartDate"); -late final _sel_setGregorianStartDate_ = - objc.registerName("setGregorianStartDate:"); -late final _sel_doesRelativeDateFormatting = - objc.registerName("doesRelativeDateFormatting"); -late final _sel_setDoesRelativeDateFormatting_ = - objc.registerName("setDoesRelativeDateFormatting:"); -late final _sel_initWithDateFormat_allowNaturalLanguage_ = - objc.registerName("initWithDateFormat:allowNaturalLanguage:"); -final _objc_msgSend_qqbb5y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_allowsNaturalLanguage = - objc.registerName("allowsNaturalLanguage"); - -/// NSDateFormatter -class NSDateFormatter extends NSFormatter { - NSDateFormatter._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDateFormatter] that points to the same underlying object as [other]. - NSDateFormatter.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDateFormatter] that wraps the given raw object pointer. - NSDateFormatter.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDateFormatter]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDateFormatter); - } - - /// formattingContext - NSFormattingContext get formattingContext { - final _ret = - _objc_msgSend_10wicfq(this.ref.pointer, _sel_formattingContext); - return NSFormattingContext.fromValue(_ret); - } - - /// setFormattingContext: - set formattingContext(NSFormattingContext value) { - return _objc_msgSend_1gtwv7x( - this.ref.pointer, _sel_setFormattingContext_, value.value); - } - - /// getObjectValue:forString:range:error: - bool getObjectValue_forString_range_error_( - ffi.Pointer> obj, - objc.NSString string, - ffi.Pointer rangep, - ffi.Pointer> error) { - return _objc_msgSend_bl9kx( - this.ref.pointer, - _sel_getObjectValue_forString_range_error_, - obj, - string.ref.pointer, - rangep, - error); - } - - /// stringFromDate: - objc.NSString stringFromDate_(objc.NSDate date) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_stringFromDate_, date.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dateFromString: - objc.NSDate? dateFromString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dateFromString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedStringFromDate:dateStyle:timeStyle: - static objc.NSString localizedStringFromDate_dateStyle_timeStyle_( - objc.NSDate date, - NSDateFormatterStyle dstyle, - NSDateFormatterStyle tstyle) { - final _ret = _objc_msgSend_1sgexgh( - _class_NSDateFormatter, - _sel_localizedStringFromDate_dateStyle_timeStyle_, - date.ref.pointer, - dstyle.value, - tstyle.value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dateFormatFromTemplate:options:locale: - static objc.NSString? dateFormatFromTemplate_options_locale_( - objc.NSString tmplate, int opts, objc.NSLocale? locale) { - final _ret = _objc_msgSend_1czjmpk( - _class_NSDateFormatter, - _sel_dateFormatFromTemplate_options_locale_, - tmplate.ref.pointer, - opts, - locale?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultFormatterBehavior - static NSDateFormatterBehavior getDefaultFormatterBehavior() { - final _ret = _objc_msgSend_ti9wzk( - _class_NSDateFormatter, _sel_defaultFormatterBehavior); - return NSDateFormatterBehavior.fromValue(_ret); - } - - /// setDefaultFormatterBehavior: - static void setDefaultFormatterBehavior(NSDateFormatterBehavior value) { - return _objc_msgSend_ffb1q7( - _class_NSDateFormatter, _sel_setDefaultFormatterBehavior_, value.value); - } - - /// setLocalizedDateFormatFromTemplate: - void setLocalizedDateFormatFromTemplate_(objc.NSString dateFormatTemplate) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setLocalizedDateFormatFromTemplate_, - dateFormatTemplate.ref.pointer); - } - - /// dateFormat - objc.NSString get dateFormat { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dateFormat); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setDateFormat: - set dateFormat(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDateFormat_, value.ref.pointer); - } - - /// dateStyle - NSDateFormatterStyle get dateStyle { - final _ret = _objc_msgSend_r4ksf1(this.ref.pointer, _sel_dateStyle); - return NSDateFormatterStyle.fromValue(_ret); - } - - /// setDateStyle: - set dateStyle(NSDateFormatterStyle value) { - return _objc_msgSend_7hnqfw( - this.ref.pointer, _sel_setDateStyle_, value.value); - } - - /// timeStyle - NSDateFormatterStyle get timeStyle { - final _ret = _objc_msgSend_r4ksf1(this.ref.pointer, _sel_timeStyle); - return NSDateFormatterStyle.fromValue(_ret); - } - - /// setTimeStyle: - set timeStyle(NSDateFormatterStyle value) { - return _objc_msgSend_7hnqfw( - this.ref.pointer, _sel_setTimeStyle_, value.value); - } - - /// locale - objc.NSLocale get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return objc.NSLocale.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.NSLocale value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value.ref.pointer); - } - - /// generatesCalendarDates - bool get generatesCalendarDates { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_generatesCalendarDates); - } - - /// setGeneratesCalendarDates: - set generatesCalendarDates(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setGeneratesCalendarDates_, value); - } - - /// formatterBehavior - NSDateFormatterBehavior get formatterBehavior { - final _ret = _objc_msgSend_ti9wzk(this.ref.pointer, _sel_formatterBehavior); - return NSDateFormatterBehavior.fromValue(_ret); - } - - /// setFormatterBehavior: - set formatterBehavior(NSDateFormatterBehavior value) { - return _objc_msgSend_ffb1q7( - this.ref.pointer, _sel_setFormatterBehavior_, value.value); - } - - /// timeZone - NSTimeZone get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// setTimeZone: - set timeZone(NSTimeZone value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setTimeZone_, value.ref.pointer); - } - - /// calendar - NSCalendar get calendar { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_calendar); - return NSCalendar.castFromPointer(_ret, retain: true, release: true); - } - - /// setCalendar: - set calendar(NSCalendar value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCalendar_, value.ref.pointer); - } - - /// isLenient - bool get lenient { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLenient); - } - - /// setLenient: - set lenient(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setLenient_, value); - } - - /// twoDigitStartDate - objc.NSDate? get twoDigitStartDate { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_twoDigitStartDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setTwoDigitStartDate: - set twoDigitStartDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setTwoDigitStartDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// defaultDate - objc.NSDate? get defaultDate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_defaultDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setDefaultDate: - set defaultDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDefaultDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// eraSymbols - objc.NSArray get eraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_eraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setEraSymbols: - set eraSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setEraSymbols_, value.ref.pointer); - } - - /// monthSymbols - objc.NSArray get monthSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_monthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setMonthSymbols: - set monthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMonthSymbols_, value.ref.pointer); - } - - /// shortMonthSymbols - objc.NSArray get shortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortMonthSymbols: - set shortMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setShortMonthSymbols_, value.ref.pointer); - } - - /// weekdaySymbols - objc.NSArray get weekdaySymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_weekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setWeekdaySymbols: - set weekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setWeekdaySymbols_, value.ref.pointer); - } - - /// shortWeekdaySymbols - objc.NSArray get shortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortWeekdaySymbols: - set shortWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setShortWeekdaySymbols_, value.ref.pointer); - } - - /// AMSymbol - objc.NSString get AMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_AMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setAMSymbol: - set AMSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAMSymbol_, value.ref.pointer); - } - - /// PMSymbol - objc.NSString get PMSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_PMSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPMSymbol: - set PMSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPMSymbol_, value.ref.pointer); - } - - /// longEraSymbols - objc.NSArray get longEraSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_longEraSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setLongEraSymbols: - set longEraSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLongEraSymbols_, value.ref.pointer); - } - - /// veryShortMonthSymbols - objc.NSArray get veryShortMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortMonthSymbols: - set veryShortMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setVeryShortMonthSymbols_, value.ref.pointer); - } - - /// standaloneMonthSymbols - objc.NSArray get standaloneMonthSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setStandaloneMonthSymbols: - set standaloneMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setStandaloneMonthSymbols_, value.ref.pointer); - } - - /// shortStandaloneMonthSymbols - objc.NSArray get shortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortStandaloneMonthSymbols: - set shortStandaloneMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setShortStandaloneMonthSymbols_, value.ref.pointer); - } - - /// veryShortStandaloneMonthSymbols - objc.NSArray get veryShortStandaloneMonthSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneMonthSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortStandaloneMonthSymbols: - set veryShortStandaloneMonthSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setVeryShortStandaloneMonthSymbols_, value.ref.pointer); - } - - /// veryShortWeekdaySymbols - objc.NSArray get veryShortWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_veryShortWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortWeekdaySymbols: - set veryShortWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setVeryShortWeekdaySymbols_, value.ref.pointer); - } - - /// standaloneWeekdaySymbols - objc.NSArray get standaloneWeekdaySymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setStandaloneWeekdaySymbols: - set standaloneWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setStandaloneWeekdaySymbols_, value.ref.pointer); - } - - /// shortStandaloneWeekdaySymbols - objc.NSArray get shortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortStandaloneWeekdaySymbols: - set shortStandaloneWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setShortStandaloneWeekdaySymbols_, value.ref.pointer); - } - - /// veryShortStandaloneWeekdaySymbols - objc.NSArray get veryShortStandaloneWeekdaySymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_veryShortStandaloneWeekdaySymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setVeryShortStandaloneWeekdaySymbols: - set veryShortStandaloneWeekdaySymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setVeryShortStandaloneWeekdaySymbols_, value.ref.pointer); - } - - /// quarterSymbols - objc.NSArray get quarterSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_quarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setQuarterSymbols: - set quarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setQuarterSymbols_, value.ref.pointer); - } - - /// shortQuarterSymbols - objc.NSArray get shortQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_shortQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortQuarterSymbols: - set shortQuarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setShortQuarterSymbols_, value.ref.pointer); - } - - /// standaloneQuarterSymbols - objc.NSArray get standaloneQuarterSymbols { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setStandaloneQuarterSymbols: - set standaloneQuarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setStandaloneQuarterSymbols_, value.ref.pointer); - } - - /// shortStandaloneQuarterSymbols - objc.NSArray get shortStandaloneQuarterSymbols { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_shortStandaloneQuarterSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setShortStandaloneQuarterSymbols: - set shortStandaloneQuarterSymbols(objc.NSArray value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setShortStandaloneQuarterSymbols_, value.ref.pointer); - } - - /// gregorianStartDate - objc.NSDate? get gregorianStartDate { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_gregorianStartDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setGregorianStartDate: - set gregorianStartDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setGregorianStartDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// doesRelativeDateFormatting - bool get doesRelativeDateFormatting { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_doesRelativeDateFormatting); - } - - /// setDoesRelativeDateFormatting: - set doesRelativeDateFormatting(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setDoesRelativeDateFormatting_, value); - } - - /// initWithDateFormat:allowNaturalLanguage: - objc.ObjCObjectBase initWithDateFormat_allowNaturalLanguage_( - objc.NSString format, bool flag) { - final _ret = _objc_msgSend_qqbb5y( - this.ref.retainAndReturnPointer(), - _sel_initWithDateFormat_allowNaturalLanguage_, - format.ref.pointer, - flag); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// allowsNaturalLanguage - bool allowsNaturalLanguage() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsNaturalLanguage); - } - - /// init - NSDateFormatter init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSDateFormatter new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateFormatter, _sel_new); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSDateFormatter allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDateFormatter, _sel_allocWithZone_, zone); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSDateFormatter alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDateFormatter, _sel_alloc); - return NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDateFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDateFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDateFormatter, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSDateFormatter, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDateFormatter, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDateFormatter, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDateFormatter, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateFormatter, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDateFormatter, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSDateFormatter self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDateFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSDateFormatter retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDateFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSDateFormatter autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDateFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithCoder: - NSDateFormatter? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDateFormatter.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSNumberFormatter = objc.getClass("NSNumberFormatter"); -late final _sel_stringFromNumber_ = objc.registerName("stringFromNumber:"); -late final _sel_numberFromString_ = objc.registerName("numberFromString:"); - -enum NSNumberFormatterStyle { - NSNumberFormatterNoStyle(0), - NSNumberFormatterDecimalStyle(1), - NSNumberFormatterCurrencyStyle(2), - NSNumberFormatterPercentStyle(3), - NSNumberFormatterScientificStyle(4), - NSNumberFormatterSpellOutStyle(5), - NSNumberFormatterOrdinalStyle(6), - NSNumberFormatterCurrencyISOCodeStyle(8), - NSNumberFormatterCurrencyPluralStyle(9), - NSNumberFormatterCurrencyAccountingStyle(10); - - final int value; - const NSNumberFormatterStyle(this.value); - - static NSNumberFormatterStyle fromValue(int value) => switch (value) { - 0 => NSNumberFormatterNoStyle, - 1 => NSNumberFormatterDecimalStyle, - 2 => NSNumberFormatterCurrencyStyle, - 3 => NSNumberFormatterPercentStyle, - 4 => NSNumberFormatterScientificStyle, - 5 => NSNumberFormatterSpellOutStyle, - 6 => NSNumberFormatterOrdinalStyle, - 8 => NSNumberFormatterCurrencyISOCodeStyle, - 9 => NSNumberFormatterCurrencyPluralStyle, - 10 => NSNumberFormatterCurrencyAccountingStyle, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterStyle: $value"), - }; -} - -late final _sel_localizedStringFromNumber_numberStyle_ = - objc.registerName("localizedStringFromNumber:numberStyle:"); -final _objc_msgSend_1dsaaq7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); - -enum NSNumberFormatterBehavior { - NSNumberFormatterBehaviorDefault(0), - NSNumberFormatterBehavior10_0(1000), - NSNumberFormatterBehavior10_4(1040); - - final int value; - const NSNumberFormatterBehavior(this.value); - - static NSNumberFormatterBehavior fromValue(int value) => switch (value) { - 0 => NSNumberFormatterBehaviorDefault, - 1000 => NSNumberFormatterBehavior10_0, - 1040 => NSNumberFormatterBehavior10_4, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterBehavior: $value"), - }; -} - -final _objc_msgSend_1nvfxwt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1p18hg0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberStyle = objc.registerName("numberStyle"); -final _objc_msgSend_1we0qxe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setNumberStyle_ = objc.registerName("setNumberStyle:"); -final _objc_msgSend_qp19lh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_generatesDecimalNumbers = - objc.registerName("generatesDecimalNumbers"); -late final _sel_setGeneratesDecimalNumbers_ = - objc.registerName("setGeneratesDecimalNumbers:"); -late final _sel_negativeFormat = objc.registerName("negativeFormat"); -late final _sel_setNegativeFormat_ = objc.registerName("setNegativeFormat:"); -late final _sel_textAttributesForNegativeValues = - objc.registerName("textAttributesForNegativeValues"); -late final _sel_setTextAttributesForNegativeValues_ = - objc.registerName("setTextAttributesForNegativeValues:"); -late final _sel_positiveFormat = objc.registerName("positiveFormat"); -late final _sel_setPositiveFormat_ = objc.registerName("setPositiveFormat:"); -late final _sel_textAttributesForPositiveValues = - objc.registerName("textAttributesForPositiveValues"); -late final _sel_setTextAttributesForPositiveValues_ = - objc.registerName("setTextAttributesForPositiveValues:"); -late final _sel_allowsFloats = objc.registerName("allowsFloats"); -late final _sel_setAllowsFloats_ = objc.registerName("setAllowsFloats:"); -late final _sel_decimalSeparator = objc.registerName("decimalSeparator"); -late final _sel_setDecimalSeparator_ = - objc.registerName("setDecimalSeparator:"); -late final _sel_alwaysShowsDecimalSeparator = - objc.registerName("alwaysShowsDecimalSeparator"); -late final _sel_setAlwaysShowsDecimalSeparator_ = - objc.registerName("setAlwaysShowsDecimalSeparator:"); -late final _sel_currencyDecimalSeparator = - objc.registerName("currencyDecimalSeparator"); -late final _sel_setCurrencyDecimalSeparator_ = - objc.registerName("setCurrencyDecimalSeparator:"); -late final _sel_usesGroupingSeparator = - objc.registerName("usesGroupingSeparator"); -late final _sel_setUsesGroupingSeparator_ = - objc.registerName("setUsesGroupingSeparator:"); -late final _sel_groupingSeparator = objc.registerName("groupingSeparator"); -late final _sel_setGroupingSeparator_ = - objc.registerName("setGroupingSeparator:"); -late final _sel_zeroSymbol = objc.registerName("zeroSymbol"); -late final _sel_setZeroSymbol_ = objc.registerName("setZeroSymbol:"); -late final _sel_textAttributesForZero = - objc.registerName("textAttributesForZero"); -late final _sel_setTextAttributesForZero_ = - objc.registerName("setTextAttributesForZero:"); -late final _sel_nilSymbol = objc.registerName("nilSymbol"); -late final _sel_setNilSymbol_ = objc.registerName("setNilSymbol:"); -late final _sel_textAttributesForNil = - objc.registerName("textAttributesForNil"); -late final _sel_setTextAttributesForNil_ = - objc.registerName("setTextAttributesForNil:"); -late final _sel_notANumberSymbol = objc.registerName("notANumberSymbol"); -late final _sel_setNotANumberSymbol_ = - objc.registerName("setNotANumberSymbol:"); -late final _sel_textAttributesForNotANumber = - objc.registerName("textAttributesForNotANumber"); -late final _sel_setTextAttributesForNotANumber_ = - objc.registerName("setTextAttributesForNotANumber:"); -late final _sel_positiveInfinitySymbol = - objc.registerName("positiveInfinitySymbol"); -late final _sel_setPositiveInfinitySymbol_ = - objc.registerName("setPositiveInfinitySymbol:"); -late final _sel_textAttributesForPositiveInfinity = - objc.registerName("textAttributesForPositiveInfinity"); -late final _sel_setTextAttributesForPositiveInfinity_ = - objc.registerName("setTextAttributesForPositiveInfinity:"); -late final _sel_negativeInfinitySymbol = - objc.registerName("negativeInfinitySymbol"); -late final _sel_setNegativeInfinitySymbol_ = - objc.registerName("setNegativeInfinitySymbol:"); -late final _sel_textAttributesForNegativeInfinity = - objc.registerName("textAttributesForNegativeInfinity"); -late final _sel_setTextAttributesForNegativeInfinity_ = - objc.registerName("setTextAttributesForNegativeInfinity:"); -late final _sel_positivePrefix = objc.registerName("positivePrefix"); -late final _sel_setPositivePrefix_ = objc.registerName("setPositivePrefix:"); -late final _sel_positiveSuffix = objc.registerName("positiveSuffix"); -late final _sel_setPositiveSuffix_ = objc.registerName("setPositiveSuffix:"); -late final _sel_negativePrefix = objc.registerName("negativePrefix"); -late final _sel_setNegativePrefix_ = objc.registerName("setNegativePrefix:"); -late final _sel_negativeSuffix = objc.registerName("negativeSuffix"); -late final _sel_setNegativeSuffix_ = objc.registerName("setNegativeSuffix:"); -late final _sel_currencyCode = objc.registerName("currencyCode"); -late final _sel_setCurrencyCode_ = objc.registerName("setCurrencyCode:"); -late final _sel_currencySymbol = objc.registerName("currencySymbol"); -late final _sel_setCurrencySymbol_ = objc.registerName("setCurrencySymbol:"); -late final _sel_internationalCurrencySymbol = - objc.registerName("internationalCurrencySymbol"); -late final _sel_setInternationalCurrencySymbol_ = - objc.registerName("setInternationalCurrencySymbol:"); -late final _sel_percentSymbol = objc.registerName("percentSymbol"); -late final _sel_setPercentSymbol_ = objc.registerName("setPercentSymbol:"); -late final _sel_perMillSymbol = objc.registerName("perMillSymbol"); -late final _sel_setPerMillSymbol_ = objc.registerName("setPerMillSymbol:"); -late final _sel_minusSign = objc.registerName("minusSign"); -late final _sel_setMinusSign_ = objc.registerName("setMinusSign:"); -late final _sel_plusSign = objc.registerName("plusSign"); -late final _sel_setPlusSign_ = objc.registerName("setPlusSign:"); -late final _sel_exponentSymbol = objc.registerName("exponentSymbol"); -late final _sel_setExponentSymbol_ = objc.registerName("setExponentSymbol:"); -late final _sel_groupingSize = objc.registerName("groupingSize"); -late final _sel_setGroupingSize_ = objc.registerName("setGroupingSize:"); -late final _sel_secondaryGroupingSize = - objc.registerName("secondaryGroupingSize"); -late final _sel_setSecondaryGroupingSize_ = - objc.registerName("setSecondaryGroupingSize:"); -late final _sel_multiplier = objc.registerName("multiplier"); -late final _sel_setMultiplier_ = objc.registerName("setMultiplier:"); -late final _sel_formatWidth = objc.registerName("formatWidth"); -late final _sel_setFormatWidth_ = objc.registerName("setFormatWidth:"); -late final _sel_paddingCharacter = objc.registerName("paddingCharacter"); -late final _sel_setPaddingCharacter_ = - objc.registerName("setPaddingCharacter:"); - -enum NSNumberFormatterPadPosition { - NSNumberFormatterPadBeforePrefix(0), - NSNumberFormatterPadAfterPrefix(1), - NSNumberFormatterPadBeforeSuffix(2), - NSNumberFormatterPadAfterSuffix(3); - - final int value; - const NSNumberFormatterPadPosition(this.value); - - static NSNumberFormatterPadPosition fromValue(int value) => switch (value) { - 0 => NSNumberFormatterPadBeforePrefix, - 1 => NSNumberFormatterPadAfterPrefix, - 2 => NSNumberFormatterPadBeforeSuffix, - 3 => NSNumberFormatterPadAfterSuffix, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterPadPosition: $value"), - }; -} - -late final _sel_paddingPosition = objc.registerName("paddingPosition"); -final _objc_msgSend_1s69i33 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPaddingPosition_ = objc.registerName("setPaddingPosition:"); -final _objc_msgSend_gz8txq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSNumberFormatterRoundingMode { - NSNumberFormatterRoundCeiling(0), - NSNumberFormatterRoundFloor(1), - NSNumberFormatterRoundDown(2), - NSNumberFormatterRoundUp(3), - NSNumberFormatterRoundHalfEven(4), - NSNumberFormatterRoundHalfDown(5), - NSNumberFormatterRoundHalfUp(6); - - final int value; - const NSNumberFormatterRoundingMode(this.value); - - static NSNumberFormatterRoundingMode fromValue(int value) => switch (value) { - 0 => NSNumberFormatterRoundCeiling, - 1 => NSNumberFormatterRoundFloor, - 2 => NSNumberFormatterRoundDown, - 3 => NSNumberFormatterRoundUp, - 4 => NSNumberFormatterRoundHalfEven, - 5 => NSNumberFormatterRoundHalfDown, - 6 => NSNumberFormatterRoundHalfUp, - _ => throw ArgumentError( - "Unknown value for NSNumberFormatterRoundingMode: $value"), - }; -} - -late final _sel_roundingMode = objc.registerName("roundingMode"); -final _objc_msgSend_38d07q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setRoundingMode_ = objc.registerName("setRoundingMode:"); -final _objc_msgSend_5krs29 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_roundingIncrement = objc.registerName("roundingIncrement"); -late final _sel_setRoundingIncrement_ = - objc.registerName("setRoundingIncrement:"); -late final _sel_minimumIntegerDigits = - objc.registerName("minimumIntegerDigits"); -late final _sel_setMinimumIntegerDigits_ = - objc.registerName("setMinimumIntegerDigits:"); -late final _sel_maximumIntegerDigits = - objc.registerName("maximumIntegerDigits"); -late final _sel_setMaximumIntegerDigits_ = - objc.registerName("setMaximumIntegerDigits:"); -late final _sel_minimumFractionDigits = - objc.registerName("minimumFractionDigits"); -late final _sel_setMinimumFractionDigits_ = - objc.registerName("setMinimumFractionDigits:"); -late final _sel_maximumFractionDigits = - objc.registerName("maximumFractionDigits"); -late final _sel_setMaximumFractionDigits_ = - objc.registerName("setMaximumFractionDigits:"); -late final _sel_minimum = objc.registerName("minimum"); -late final _sel_setMinimum_ = objc.registerName("setMinimum:"); -late final _sel_maximum = objc.registerName("maximum"); -late final _sel_setMaximum_ = objc.registerName("setMaximum:"); -late final _sel_currencyGroupingSeparator = - objc.registerName("currencyGroupingSeparator"); -late final _sel_setCurrencyGroupingSeparator_ = - objc.registerName("setCurrencyGroupingSeparator:"); -late final _sel_usesSignificantDigits = - objc.registerName("usesSignificantDigits"); -late final _sel_setUsesSignificantDigits_ = - objc.registerName("setUsesSignificantDigits:"); -late final _sel_minimumSignificantDigits = - objc.registerName("minimumSignificantDigits"); -late final _sel_setMinimumSignificantDigits_ = - objc.registerName("setMinimumSignificantDigits:"); -late final _sel_maximumSignificantDigits = - objc.registerName("maximumSignificantDigits"); -late final _sel_setMaximumSignificantDigits_ = - objc.registerName("setMaximumSignificantDigits:"); -late final _sel_isPartialStringValidationEnabled = - objc.registerName("isPartialStringValidationEnabled"); -late final _sel_setPartialStringValidationEnabled_ = - objc.registerName("setPartialStringValidationEnabled:"); -late final _sel_hasThousandSeparators = - objc.registerName("hasThousandSeparators"); -late final _sel_setHasThousandSeparators_ = - objc.registerName("setHasThousandSeparators:"); -late final _sel_thousandSeparator = objc.registerName("thousandSeparator"); -late final _sel_setThousandSeparator_ = - objc.registerName("setThousandSeparator:"); -late final _sel_localizesFormat = objc.registerName("localizesFormat"); -late final _sel_setLocalizesFormat_ = objc.registerName("setLocalizesFormat:"); -late final _sel_format = objc.registerName("format"); -late final _sel_setFormat_ = objc.registerName("setFormat:"); -late final _sel_attributedStringForZero = - objc.registerName("attributedStringForZero"); -late final _sel_setAttributedStringForZero_ = - objc.registerName("setAttributedStringForZero:"); -late final _sel_attributedStringForNil = - objc.registerName("attributedStringForNil"); -late final _sel_setAttributedStringForNil_ = - objc.registerName("setAttributedStringForNil:"); -late final _sel_attributedStringForNotANumber = - objc.registerName("attributedStringForNotANumber"); -late final _sel_setAttributedStringForNotANumber_ = - objc.registerName("setAttributedStringForNotANumber:"); -late final _class_NSDecimalNumberHandler = - objc.getClass("NSDecimalNumberHandler"); - -enum NSRoundingMode { - NSRoundPlain(0), - NSRoundDown(1), - NSRoundUp(2), - NSRoundBankers(3); - - final int value; - const NSRoundingMode(this.value); - - static NSRoundingMode fromValue(int value) => switch (value) { - 0 => NSRoundPlain, - 1 => NSRoundDown, - 2 => NSRoundUp, - 3 => NSRoundBankers, - _ => throw ArgumentError("Unknown value for NSRoundingMode: $value"), - }; -} - -final _objc_msgSend_1iugf7h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -int _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrTrampoline, 0) - .cast(); -int _ObjCBlock_NSRoundingMode_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSRoundingMode_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSRoundingMode_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSRoundingMode_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_NSRoundingMode_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(NSRoundingMode Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSRoundingMode_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0).value), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSRoundingMode_ffiVoid_CallExtension - on objc.ObjCBlock)> { - NSRoundingMode call(ffi.Pointer arg0) => - NSRoundingMode.fromValue(ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0)); -} - -late final _sel_scale = objc.registerName("scale"); -final _objc_msgSend_157j54x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -int _ObjCBlock_ffiShort_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi - .NativeFunction arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiShort_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Short Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiShort_ffiVoid_fnPtrTrampoline, 0) - .cast(); -int _ObjCBlock_ffiShort_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiShort_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Short Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiShort_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiShort_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiShort_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - int Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock(_ObjCBlock_ffiShort_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiShort_ffiVoid_CallExtension - on objc.ObjCBlock)> { - int call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _class_NSDecimalNumber = objc.getClass("NSDecimalNumber"); -late final _sel_initWithMantissa_exponent_isNegative_ = - objc.registerName("initWithMantissa:exponent:isNegative:"); -final _objc_msgSend_1f2l7cc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLongLong, - ffi.Short, - ffi.Bool)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, int, bool)>(); -late final _sel_initWithString_locale_ = - objc.registerName("initWithString:locale:"); -late final _sel_descriptionWithLocale_ = - objc.registerName("descriptionWithLocale:"); -late final _sel_decimalNumberWithMantissa_exponent_isNegative_ = - objc.registerName("decimalNumberWithMantissa:exponent:isNegative:"); -late final _sel_decimalNumberWithString_ = - objc.registerName("decimalNumberWithString:"); -late final _sel_decimalNumberWithString_locale_ = - objc.registerName("decimalNumberWithString:locale:"); -late final _sel_zero = objc.registerName("zero"); -late final _sel_one = objc.registerName("one"); -late final _sel_minimumDecimalNumber = - objc.registerName("minimumDecimalNumber"); -late final _sel_maximumDecimalNumber = - objc.registerName("maximumDecimalNumber"); -late final _sel_notANumber = objc.registerName("notANumber"); -late final _sel_decimalNumberByAdding_ = - objc.registerName("decimalNumberByAdding:"); -late final _sel_decimalNumberByAdding_withBehavior_ = - objc.registerName("decimalNumberByAdding:withBehavior:"); -late final _sel_decimalNumberBySubtracting_ = - objc.registerName("decimalNumberBySubtracting:"); -late final _sel_decimalNumberBySubtracting_withBehavior_ = - objc.registerName("decimalNumberBySubtracting:withBehavior:"); -late final _sel_decimalNumberByMultiplyingBy_ = - objc.registerName("decimalNumberByMultiplyingBy:"); -late final _sel_decimalNumberByMultiplyingBy_withBehavior_ = - objc.registerName("decimalNumberByMultiplyingBy:withBehavior:"); -late final _sel_decimalNumberByDividingBy_ = - objc.registerName("decimalNumberByDividingBy:"); -late final _sel_decimalNumberByDividingBy_withBehavior_ = - objc.registerName("decimalNumberByDividingBy:withBehavior:"); -late final _sel_decimalNumberByRaisingToPower_ = - objc.registerName("decimalNumberByRaisingToPower:"); -final _objc_msgSend_ehxl2g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_decimalNumberByRaisingToPower_withBehavior_ = - objc.registerName("decimalNumberByRaisingToPower:withBehavior:"); -final _objc_msgSend_m23d4r = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_decimalNumberByMultiplyingByPowerOf10_ = - objc.registerName("decimalNumberByMultiplyingByPowerOf10:"); -final _objc_msgSend_15di41h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Short)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_decimalNumberByMultiplyingByPowerOf10_withBehavior_ = - objc.registerName("decimalNumberByMultiplyingByPowerOf10:withBehavior:"); -final _objc_msgSend_1y5v0cu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Short, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_decimalNumberByRoundingAccordingToBehavior_ = - objc.registerName("decimalNumberByRoundingAccordingToBehavior:"); -late final _sel_compare_ = objc.registerName("compare:"); -final _objc_msgSend_1ile2ev = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_defaultBehavior = objc.registerName("defaultBehavior"); -late final _sel_setDefaultBehavior_ = objc.registerName("setDefaultBehavior:"); -late final _sel_objCType = objc.registerName("objCType"); -final _objc_msgSend_1ypnhm3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_doubleValue = objc.registerName("doubleValue"); -late final _sel_numberWithChar_ = objc.registerName("numberWithChar:"); -final _objc_msgSend_1pfmxrb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Char)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithUnsignedChar_ = - objc.registerName("numberWithUnsignedChar:"); -final _objc_msgSend_1ar9f5m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedChar)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithShort_ = objc.registerName("numberWithShort:"); -late final _sel_numberWithUnsignedShort_ = - objc.registerName("numberWithUnsignedShort:"); -final _objc_msgSend_122gbai = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedShort)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithInt_ = objc.registerName("numberWithInt:"); -final _objc_msgSend_105o5we = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithUnsignedInt_ = - objc.registerName("numberWithUnsignedInt:"); -final _objc_msgSend_pxgym4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithLong_ = objc.registerName("numberWithLong:"); -late final _sel_numberWithUnsignedLong_ = - objc.registerName("numberWithUnsignedLong:"); -late final _sel_numberWithLongLong_ = objc.registerName("numberWithLongLong:"); -final _objc_msgSend_yjzv9z = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.LongLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithUnsignedLongLong_ = - objc.registerName("numberWithUnsignedLongLong:"); -final _objc_msgSend_ybbscc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLongLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_numberWithFloat_ = objc.registerName("numberWithFloat:"); -final _objc_msgSend_1pmj399 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Float)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_numberWithDouble_ = objc.registerName("numberWithDouble:"); -final _objc_msgSend_m7jc8y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Double)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_numberWithBool_ = objc.registerName("numberWithBool:"); -final _objc_msgSend_1upz917 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Bool)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, bool)>(); -late final _sel_numberWithInteger_ = objc.registerName("numberWithInteger:"); -late final _sel_numberWithUnsignedInteger_ = - objc.registerName("numberWithUnsignedInteger:"); -late final _sel_initWithBytes_objCType_ = - objc.registerName("initWithBytes:objCType:"); -final _objc_msgSend_1sdw29g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_valueWithBytes_objCType_ = - objc.registerName("valueWithBytes:objCType:"); -late final _sel_value_withObjCType_ = objc.registerName("value:withObjCType:"); -late final _sel_valueWithNonretainedObject_ = - objc.registerName("valueWithNonretainedObject:"); -late final _sel_valueWithPointer_ = objc.registerName("valueWithPointer:"); -final _objc_msgSend_1ph8ubj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_valueWithRange_ = objc.registerName("valueWithRange:"); - -final class CGPoint extends ffi.Struct { - @ffi.Double() - external double x; - - @ffi.Double() - external double y; -} - -late final _sel_valueWithPoint_ = objc.registerName("valueWithPoint:"); -final _objc_msgSend_1xj0srq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGPoint)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGPoint)>(); - -final class CGSize extends ffi.Struct { - @ffi.Double() - external double width; - - @ffi.Double() - external double height; -} - -late final _sel_valueWithSize_ = objc.registerName("valueWithSize:"); -final _objc_msgSend_fnn627 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGSize)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGSize)>(); - -final class CGRect extends ffi.Struct { - external CGPoint origin; - - external CGSize size; -} - -late final _sel_valueWithRect_ = objc.registerName("valueWithRect:"); -final _objc_msgSend_14yq09w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGRect)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, CGRect)>(); - -final class NSEdgeInsets extends ffi.Struct { - @ffi.Double() - external double top; - - @ffi.Double() - external double left; - - @ffi.Double() - external double bottom; - - @ffi.Double() - external double right; -} - -late final _sel_valueWithEdgeInsets_ = - objc.registerName("valueWithEdgeInsets:"); -final _objc_msgSend_12s6yn4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, NSEdgeInsets)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, NSEdgeInsets)>(); - -/// NSDecimalNumber -class NSDecimalNumber extends objc.NSNumber { - NSDecimalNumber._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDecimalNumber] that points to the same underlying object as [other]. - NSDecimalNumber.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDecimalNumber] that wraps the given raw object pointer. - NSDecimalNumber.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDecimalNumber]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDecimalNumber); - } - - /// initWithMantissa:exponent:isNegative: - NSDecimalNumber initWithMantissa_exponent_isNegative_( - int mantissa, int exponent, bool flag) { - final _ret = _objc_msgSend_1f2l7cc(this.ref.retainAndReturnPointer(), - _sel_initWithMantissa_exponent_isNegative_, mantissa, exponent, flag); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithString: - NSDecimalNumber initWithString_(objc.NSString? numberValue) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, numberValue?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithString:locale: - NSDecimalNumber initWithString_locale_( - objc.NSString? numberValue, objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithString_locale_, - numberValue?.ref.pointer ?? ffi.nullptr, - locale?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// descriptionWithLocale: - objc.NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberWithMantissa:exponent:isNegative: - static NSDecimalNumber decimalNumberWithMantissa_exponent_isNegative_( - int mantissa, int exponent, bool flag) { - final _ret = _objc_msgSend_1f2l7cc( - _class_NSDecimalNumber, - _sel_decimalNumberWithMantissa_exponent_isNegative_, - mantissa, - exponent, - flag); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberWithString: - static NSDecimalNumber decimalNumberWithString_(objc.NSString? numberValue) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumber, - _sel_decimalNumberWithString_, numberValue?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberWithString:locale: - static NSDecimalNumber decimalNumberWithString_locale_( - objc.NSString? numberValue, objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_iq11qg( - _class_NSDecimalNumber, - _sel_decimalNumberWithString_locale_, - numberValue?.ref.pointer ?? ffi.nullptr, - locale?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// zero - static NSDecimalNumber getZero() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_zero); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// one - static NSDecimalNumber getOne() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_one); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// minimumDecimalNumber - static NSDecimalNumber getMinimumDecimalNumber() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_minimumDecimalNumber); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// maximumDecimalNumber - static NSDecimalNumber getMaximumDecimalNumber() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_maximumDecimalNumber); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// notANumber - static NSDecimalNumber getNotANumber() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_notANumber); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByAdding: - NSDecimalNumber decimalNumberByAdding_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberByAdding_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByAdding:withBehavior: - NSDecimalNumber decimalNumberByAdding_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberByAdding_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberBySubtracting: - NSDecimalNumber decimalNumberBySubtracting_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberBySubtracting_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberBySubtracting:withBehavior: - NSDecimalNumber decimalNumberBySubtracting_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberBySubtracting_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingBy: - NSDecimalNumber decimalNumberByMultiplyingBy_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberByMultiplyingBy_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingBy:withBehavior: - NSDecimalNumber decimalNumberByMultiplyingBy_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberByMultiplyingBy_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByDividingBy: - NSDecimalNumber decimalNumberByDividingBy_(NSDecimalNumber decimalNumber) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_decimalNumberByDividingBy_, decimalNumber.ref.pointer); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByDividingBy:withBehavior: - NSDecimalNumber decimalNumberByDividingBy_withBehavior_( - NSDecimalNumber decimalNumber, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_decimalNumberByDividingBy_withBehavior_, - decimalNumber.ref.pointer, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByRaisingToPower: - NSDecimalNumber decimalNumberByRaisingToPower_(int power) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_decimalNumberByRaisingToPower_, power); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByRaisingToPower:withBehavior: - NSDecimalNumber decimalNumberByRaisingToPower_withBehavior_( - int power, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_m23d4r( - this.ref.pointer, - _sel_decimalNumberByRaisingToPower_withBehavior_, - power, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingByPowerOf10: - NSDecimalNumber decimalNumberByMultiplyingByPowerOf10_(int power) { - final _ret = _objc_msgSend_15di41h( - this.ref.pointer, _sel_decimalNumberByMultiplyingByPowerOf10_, power); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByMultiplyingByPowerOf10:withBehavior: - NSDecimalNumber decimalNumberByMultiplyingByPowerOf10_withBehavior_( - int power, objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_1y5v0cu( - this.ref.pointer, - _sel_decimalNumberByMultiplyingByPowerOf10_withBehavior_, - power, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// decimalNumberByRoundingAccordingToBehavior: - NSDecimalNumber decimalNumberByRoundingAccordingToBehavior_( - objc.ObjCObjectBase? behavior) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_decimalNumberByRoundingAccordingToBehavior_, - behavior?.ref.pointer ?? ffi.nullptr); - return NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// compare: - objc.NSComparisonResult compare_(objc.NSNumber decimalNumber) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_compare_, decimalNumber.ref.pointer); - return objc.NSComparisonResult.fromValue(_ret); - } - - /// defaultBehavior - static objc.ObjCObjectBase getDefaultBehavior() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_defaultBehavior); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDefaultBehavior: - static void setDefaultBehavior(objc.ObjCObjectBase value) { - return _objc_msgSend_ukcdfq( - _class_NSDecimalNumber, _sel_setDefaultBehavior_, value.ref.pointer); - } - - /// objCType - ffi.Pointer get objCType { - return _objc_msgSend_1ypnhm3(this.ref.pointer, _sel_objCType); - } - - /// doubleValue - double get doubleValue { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_doubleValue) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_doubleValue); - } - - /// initWithCoder: - NSDecimalNumber? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// numberWithChar: - static objc.NSNumber numberWithChar_(int value) { - final _ret = _objc_msgSend_1pfmxrb( - _class_NSDecimalNumber, _sel_numberWithChar_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedChar: - static objc.NSNumber numberWithUnsignedChar_(int value) { - final _ret = _objc_msgSend_1ar9f5m( - _class_NSDecimalNumber, _sel_numberWithUnsignedChar_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithShort: - static objc.NSNumber numberWithShort_(int value) { - final _ret = _objc_msgSend_15di41h( - _class_NSDecimalNumber, _sel_numberWithShort_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedShort: - static objc.NSNumber numberWithUnsignedShort_(int value) { - final _ret = _objc_msgSend_122gbai( - _class_NSDecimalNumber, _sel_numberWithUnsignedShort_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithInt: - static objc.NSNumber numberWithInt_(int value) { - final _ret = _objc_msgSend_105o5we( - _class_NSDecimalNumber, _sel_numberWithInt_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedInt: - static objc.NSNumber numberWithUnsignedInt_(int value) { - final _ret = _objc_msgSend_pxgym4( - _class_NSDecimalNumber, _sel_numberWithUnsignedInt_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithLong: - static objc.NSNumber numberWithLong_(int value) { - final _ret = _objc_msgSend_crtxa9( - _class_NSDecimalNumber, _sel_numberWithLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedLong: - static objc.NSNumber numberWithUnsignedLong_(int value) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSDecimalNumber, _sel_numberWithUnsignedLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithLongLong: - static objc.NSNumber numberWithLongLong_(int value) { - final _ret = _objc_msgSend_yjzv9z( - _class_NSDecimalNumber, _sel_numberWithLongLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedLongLong: - static objc.NSNumber numberWithUnsignedLongLong_(int value) { - final _ret = _objc_msgSend_ybbscc( - _class_NSDecimalNumber, _sel_numberWithUnsignedLongLong_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithFloat: - static objc.NSNumber numberWithFloat_(double value) { - final _ret = _objc_msgSend_1pmj399( - _class_NSDecimalNumber, _sel_numberWithFloat_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithDouble: - static objc.NSNumber numberWithDouble_(double value) { - final _ret = _objc_msgSend_m7jc8y( - _class_NSDecimalNumber, _sel_numberWithDouble_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithBool: - static objc.NSNumber numberWithBool_(bool value) { - final _ret = _objc_msgSend_1upz917( - _class_NSDecimalNumber, _sel_numberWithBool_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithInteger: - static objc.NSNumber numberWithInteger_(int value) { - final _ret = _objc_msgSend_crtxa9( - _class_NSDecimalNumber, _sel_numberWithInteger_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// numberWithUnsignedInteger: - static objc.NSNumber numberWithUnsignedInteger_(int value) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSDecimalNumber, _sel_numberWithUnsignedInteger_, value); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithBytes:objCType: - NSDecimalNumber initWithBytes_objCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g(this.ref.retainAndReturnPointer(), - _sel_initWithBytes_objCType_, value, type); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// valueWithBytes:objCType: - static objc.NSValue valueWithBytes_objCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSDecimalNumber, _sel_valueWithBytes_objCType_, value, type); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// value:withObjCType: - static objc.NSValue value_withObjCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSDecimalNumber, _sel_value_withObjCType_, value, type); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithNonretainedObject: - static objc.NSValue valueWithNonretainedObject_( - objc.ObjCObjectBase? anObject) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumber, - _sel_valueWithNonretainedObject_, anObject?.ref.pointer ?? ffi.nullptr); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithPointer: - static objc.NSValue valueWithPointer_(ffi.Pointer pointer) { - final _ret = _objc_msgSend_1ph8ubj( - _class_NSDecimalNumber, _sel_valueWithPointer_, pointer); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithRange: - static objc.NSValue valueWithRange_(objc.NSRange range) { - final _ret = _objc_msgSend_176f8tz( - _class_NSDecimalNumber, _sel_valueWithRange_, range); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithPoint: - static objc.NSValue valueWithPoint_(CGPoint point) { - final _ret = _objc_msgSend_1xj0srq( - _class_NSDecimalNumber, _sel_valueWithPoint_, point); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithSize: - static objc.NSValue valueWithSize_(CGSize size) { - final _ret = - _objc_msgSend_fnn627(_class_NSDecimalNumber, _sel_valueWithSize_, size); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithRect: - static objc.NSValue valueWithRect_(CGRect rect) { - final _ret = _objc_msgSend_14yq09w( - _class_NSDecimalNumber, _sel_valueWithRect_, rect); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithEdgeInsets: - static objc.NSValue valueWithEdgeInsets_(NSEdgeInsets insets) { - final _ret = _objc_msgSend_12s6yn4( - _class_NSDecimalNumber, _sel_valueWithEdgeInsets_, insets); - return objc.NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSDecimalNumber init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSDecimalNumber new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_new); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSDecimalNumber allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDecimalNumber, _sel_allocWithZone_, zone); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSDecimalNumber alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumber, _sel_alloc); - return NSDecimalNumber.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDecimalNumber, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDecimalNumber, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumber, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSDecimalNumber, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumber, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDecimalNumber, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDecimalNumber, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumber, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumber, _sel_supportsSecureCoding); - } -} - -enum NSCalculationError { - NSCalculationNoError(0), - NSCalculationLossOfPrecision(1), - NSCalculationUnderflow(2), - NSCalculationOverflow(3), - NSCalculationDivideByZero(4); - - final int value; - const NSCalculationError(this.value); - - static NSCalculationError fromValue(int value) => switch (value) { - 0 => NSCalculationNoError, - 1 => NSCalculationLossOfPrecision, - 2 => NSCalculationUnderflow, - 3 => NSCalculationOverflow, - 4 => NSCalculationDivideByZero, - _ => - throw ArgumentError("Unknown value for NSCalculationError: $value"), - }; -} - -late final _sel_exceptionDuringOperation_error_leftOperand_rightOperand_ = objc - .registerName("exceptionDuringOperation:error:leftOperand:rightOperand:"); -final _objc_msgSend_bx1eho = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); -ffi.Pointer _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - int arg2, - ffi.Pointer arg3, - ffi.Pointer arg4) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.UnsignedLong arg2, - ffi.Pointer arg3, - ffi.Pointer arg4)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2, arg3, arg4); -ffi.Pointer - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - int arg2, - ffi.Pointer arg3, - ffi.Pointer arg4) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); -ffi.Pointer - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>`. -abstract final class ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - NSDecimalNumber? Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSDecimalNumber, - NSDecimalNumber?)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - NSDecimalNumber? Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSDecimalNumber, - NSDecimalNumber?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.UnsignedLong arg2, - ffi.Pointer arg3, - ffi.Pointer arg4)>> - ptr) => - objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>( - objc.newPointerBlock(_ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)> - fromFunction(NSDecimalNumber? Function(ffi.Pointer, ffi.Pointer, NSCalculationError, NSDecimalNumber, NSDecimalNumber?) fn) => - objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>( - objc.newClosureBlock( - _ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - int arg2, - ffi.Pointer arg3, - ffi.Pointer arg4) => - fn(arg0, arg1, NSCalculationError.fromValue(arg2), NSDecimalNumber.castFromPointer(arg3, retain: true, release: true), arg4.address == 0 ? null : NSDecimalNumber.castFromPointer(arg4, retain: true, release: true)) - ?.ref - .retainAndAutorelease() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.UnsignedLong, NSDecimalNumber, NSDecimalNumber?)>`. -extension ObjCBlock_NSDecimalNumber_ffiVoid_objcObjCSelector_NSCalculationError_NSDecimalNumber_NSDecimalNumber_CallExtension - on objc.ObjCBlock< - NSDecimalNumber? Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSDecimalNumber, - NSDecimalNumber?)> { - NSDecimalNumber? call( - ffi.Pointer arg0, - ffi.Pointer arg1, - NSCalculationError arg2, - NSDecimalNumber arg3, - NSDecimalNumber? arg4) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.UnsignedLong arg2, - ffi.Pointer arg3, - ffi.Pointer arg4)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>() - (ref.pointer, arg0, arg1, arg2.value, arg3.ref.pointer, arg4?.ref.pointer ?? ffi.nullptr) - .address == - 0 - ? null - : NSDecimalNumber.castFromPointer(ref.pointer.ref.invoke.cast Function(ffi.Pointer block, ffi.Pointer arg0, ffi.Pointer arg1, ffi.UnsignedLong arg2, ffi.Pointer arg3, ffi.Pointer arg4)>>().asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, int, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0, arg1, arg2.value, arg3.ref.pointer, arg4?.ref.pointer ?? ffi.nullptr), retain: true, release: true); -} - -late final _sel_defaultDecimalNumberHandler = - objc.registerName("defaultDecimalNumberHandler"); -late final _sel_initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_ = - objc.registerName( - "initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:"); -final _objc_msgSend_1efxg5u = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Short, - ffi.Bool, - ffi.Bool, - ffi.Bool, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - bool, - bool, - bool, - bool)>(); -late final _sel_decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_ = - objc.registerName( - "decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:"); - -/// NSDecimalNumberHandler -class NSDecimalNumberHandler extends objc.NSObject { - NSDecimalNumberHandler._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDecimalNumberHandler] that points to the same underlying object as [other]. - NSDecimalNumberHandler.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDecimalNumberHandler] that wraps the given raw object pointer. - NSDecimalNumberHandler.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDecimalNumberHandler]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDecimalNumberHandler); - } - - /// defaultDecimalNumberHandler - static NSDecimalNumberHandler getDefaultDecimalNumberHandler() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumberHandler, _sel_defaultDecimalNumberHandler); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero: - NSDecimalNumberHandler - initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_( - NSRoundingMode roundingMode, - int scale, - bool exact, - bool overflow, - bool underflow, - bool divideByZero) { - final _ret = _objc_msgSend_1efxg5u( - this.ref.retainAndReturnPointer(), - _sel_initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_, - roundingMode.value, - scale, - exact, - overflow, - underflow, - divideByZero); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero: - static NSDecimalNumberHandler - decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_( - NSRoundingMode roundingMode, - int scale, - bool exact, - bool overflow, - bool underflow, - bool divideByZero) { - final _ret = _objc_msgSend_1efxg5u( - _class_NSDecimalNumberHandler, - _sel_decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero_, - roundingMode.value, - scale, - exact, - overflow, - underflow, - divideByZero); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSDecimalNumberHandler init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSDecimalNumberHandler new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDecimalNumberHandler, _sel_new); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSDecimalNumberHandler allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSDecimalNumberHandler, _sel_allocWithZone_, zone); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSDecimalNumberHandler alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSDecimalNumberHandler, _sel_alloc); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSDecimalNumberHandler, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSDecimalNumberHandler, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumberHandler, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSDecimalNumberHandler, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDecimalNumberHandler, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSDecimalNumberHandler, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSDecimalNumberHandler, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumberHandler, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSDecimalNumberHandler, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSDecimalNumberHandler self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSDecimalNumberHandler retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSDecimalNumberHandler autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// roundingMode - NSRoundingMode roundingMode() { - final _ret = _objc_msgSend_1iugf7h(this.ref.pointer, _sel_roundingMode); - return NSRoundingMode.fromValue(_ret); - } - - /// scale - int scale() { - return _objc_msgSend_157j54x(this.ref.pointer, _sel_scale); - } - - /// exceptionDuringOperation:error:leftOperand:rightOperand: - NSDecimalNumber? exceptionDuringOperation_error_leftOperand_rightOperand_( - ffi.Pointer operation, - NSCalculationError error, - NSDecimalNumber leftOperand, - NSDecimalNumber? rightOperand) { - final _ret = _objc_msgSend_bx1eho( - this.ref.pointer, - _sel_exceptionDuringOperation_error_leftOperand_rightOperand_, - operation, - error.value, - leftOperand.ref.pointer, - rightOperand?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSDecimalNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSDecimalNumberHandler? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDecimalNumberHandler.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_roundingBehavior = objc.registerName("roundingBehavior"); -late final _sel_setRoundingBehavior_ = - objc.registerName("setRoundingBehavior:"); - -/// NSNumberFormatter -class NSNumberFormatter extends NSFormatter { - NSNumberFormatter._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSNumberFormatter] that points to the same underlying object as [other]. - NSNumberFormatter.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSNumberFormatter] that wraps the given raw object pointer. - NSNumberFormatter.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSNumberFormatter]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSNumberFormatter); - } - - /// formattingContext - NSFormattingContext get formattingContext { - final _ret = - _objc_msgSend_10wicfq(this.ref.pointer, _sel_formattingContext); - return NSFormattingContext.fromValue(_ret); - } - - /// setFormattingContext: - set formattingContext(NSFormattingContext value) { - return _objc_msgSend_1gtwv7x( - this.ref.pointer, _sel_setFormattingContext_, value.value); - } - - /// getObjectValue:forString:range:error: - bool getObjectValue_forString_range_error_( - ffi.Pointer> obj, - objc.NSString string, - ffi.Pointer rangep, - ffi.Pointer> error) { - return _objc_msgSend_bl9kx( - this.ref.pointer, - _sel_getObjectValue_forString_range_error_, - obj, - string.ref.pointer, - rangep, - error); - } - - /// stringFromNumber: - objc.NSString? stringFromNumber_(objc.NSNumber number) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_stringFromNumber_, number.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// numberFromString: - objc.NSNumber? numberFromString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_numberFromString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedStringFromNumber:numberStyle: - static objc.NSString localizedStringFromNumber_numberStyle_( - objc.NSNumber num, NSNumberFormatterStyle nstyle) { - final _ret = _objc_msgSend_1dsaaq7( - _class_NSNumberFormatter, - _sel_localizedStringFromNumber_numberStyle_, - num.ref.pointer, - nstyle.value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultFormatterBehavior - static NSNumberFormatterBehavior defaultFormatterBehavior() { - final _ret = _objc_msgSend_1nvfxwt( - _class_NSNumberFormatter, _sel_defaultFormatterBehavior); - return NSNumberFormatterBehavior.fromValue(_ret); - } - - /// setDefaultFormatterBehavior: - static void setDefaultFormatterBehavior_(NSNumberFormatterBehavior behavior) { - _objc_msgSend_1p18hg0(_class_NSNumberFormatter, - _sel_setDefaultFormatterBehavior_, behavior.value); - } - - /// numberStyle - NSNumberFormatterStyle get numberStyle { - final _ret = _objc_msgSend_1we0qxe(this.ref.pointer, _sel_numberStyle); - return NSNumberFormatterStyle.fromValue(_ret); - } - - /// setNumberStyle: - set numberStyle(NSNumberFormatterStyle value) { - return _objc_msgSend_qp19lh( - this.ref.pointer, _sel_setNumberStyle_, value.value); - } - - /// locale - objc.NSLocale get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return objc.NSLocale.castFromPointer(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.NSLocale value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value.ref.pointer); - } - - /// generatesDecimalNumbers - bool get generatesDecimalNumbers { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_generatesDecimalNumbers); - } - - /// setGeneratesDecimalNumbers: - set generatesDecimalNumbers(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setGeneratesDecimalNumbers_, value); - } - - /// formatterBehavior - NSNumberFormatterBehavior get formatterBehavior { - final _ret = - _objc_msgSend_1nvfxwt(this.ref.pointer, _sel_formatterBehavior); - return NSNumberFormatterBehavior.fromValue(_ret); - } - - /// setFormatterBehavior: - set formatterBehavior(NSNumberFormatterBehavior value) { - return _objc_msgSend_1p18hg0( - this.ref.pointer, _sel_setFormatterBehavior_, value.value); - } - - /// negativeFormat - objc.NSString get negativeFormat { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativeFormat); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativeFormat: - set negativeFormat(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativeFormat_, value.ref.pointer); - } - - /// textAttributesForNegativeValues - objc.NSDictionary? get textAttributesForNegativeValues { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForNegativeValues); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNegativeValues: - set textAttributesForNegativeValues(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForNegativeValues_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// positiveFormat - objc.NSString get positiveFormat { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positiveFormat); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositiveFormat: - set positiveFormat(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositiveFormat_, value.ref.pointer); - } - - /// textAttributesForPositiveValues - objc.NSDictionary? get textAttributesForPositiveValues { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForPositiveValues); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForPositiveValues: - set textAttributesForPositiveValues(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForPositiveValues_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// allowsFloats - bool get allowsFloats { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsFloats); - } - - /// setAllowsFloats: - set allowsFloats(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsFloats_, value); - } - - /// decimalSeparator - objc.NSString get decimalSeparator { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_decimalSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setDecimalSeparator: - set decimalSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDecimalSeparator_, value.ref.pointer); - } - - /// alwaysShowsDecimalSeparator - bool get alwaysShowsDecimalSeparator { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_alwaysShowsDecimalSeparator); - } - - /// setAlwaysShowsDecimalSeparator: - set alwaysShowsDecimalSeparator(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAlwaysShowsDecimalSeparator_, value); - } - - /// currencyDecimalSeparator - objc.NSString get currencyDecimalSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencyDecimalSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencyDecimalSeparator: - set currencyDecimalSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrencyDecimalSeparator_, value.ref.pointer); - } - - /// usesGroupingSeparator - bool get usesGroupingSeparator { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_usesGroupingSeparator); - } - - /// setUsesGroupingSeparator: - set usesGroupingSeparator(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesGroupingSeparator_, value); - } - - /// groupingSeparator - objc.NSString get groupingSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_groupingSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setGroupingSeparator: - set groupingSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setGroupingSeparator_, value.ref.pointer); - } - - /// zeroSymbol - objc.NSString? get zeroSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_zeroSymbol); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setZeroSymbol: - set zeroSymbol(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setZeroSymbol_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// textAttributesForZero - objc.NSDictionary? get textAttributesForZero { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_textAttributesForZero); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForZero: - set textAttributesForZero(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setTextAttributesForZero_, value?.ref.pointer ?? ffi.nullptr); - } - - /// nilSymbol - objc.NSString get nilSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nilSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNilSymbol: - set nilSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNilSymbol_, value.ref.pointer); - } - - /// textAttributesForNil - objc.NSDictionary? get textAttributesForNil { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_textAttributesForNil); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNil: - set textAttributesForNil(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setTextAttributesForNil_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// notANumberSymbol - objc.NSString get notANumberSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_notANumberSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNotANumberSymbol: - set notANumberSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNotANumberSymbol_, value.ref.pointer); - } - - /// textAttributesForNotANumber - objc.NSDictionary? get textAttributesForNotANumber { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForNotANumber); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNotANumber: - set textAttributesForNotANumber(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForNotANumber_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// positiveInfinitySymbol - objc.NSString get positiveInfinitySymbol { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positiveInfinitySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositiveInfinitySymbol: - set positiveInfinitySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositiveInfinitySymbol_, value.ref.pointer); - } - - /// textAttributesForPositiveInfinity - objc.NSDictionary? get textAttributesForPositiveInfinity { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForPositiveInfinity); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForPositiveInfinity: - set textAttributesForPositiveInfinity(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForPositiveInfinity_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// negativeInfinitySymbol - objc.NSString get negativeInfinitySymbol { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativeInfinitySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativeInfinitySymbol: - set negativeInfinitySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativeInfinitySymbol_, value.ref.pointer); - } - - /// textAttributesForNegativeInfinity - objc.NSDictionary? get textAttributesForNegativeInfinity { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_textAttributesForNegativeInfinity); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setTextAttributesForNegativeInfinity: - set textAttributesForNegativeInfinity(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setTextAttributesForNegativeInfinity_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// positivePrefix - objc.NSString get positivePrefix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positivePrefix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositivePrefix: - set positivePrefix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositivePrefix_, value.ref.pointer); - } - - /// positiveSuffix - objc.NSString get positiveSuffix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_positiveSuffix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPositiveSuffix: - set positiveSuffix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPositiveSuffix_, value.ref.pointer); - } - - /// negativePrefix - objc.NSString get negativePrefix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativePrefix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativePrefix: - set negativePrefix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativePrefix_, value.ref.pointer); - } - - /// negativeSuffix - objc.NSString get negativeSuffix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_negativeSuffix); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNegativeSuffix: - set negativeSuffix(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setNegativeSuffix_, value.ref.pointer); - } - - /// currencyCode - objc.NSString get currencyCode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencyCode); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencyCode: - set currencyCode(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrencyCode_, value.ref.pointer); - } - - /// currencySymbol - objc.NSString get currencySymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencySymbol: - set currencySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrencySymbol_, value.ref.pointer); - } - - /// internationalCurrencySymbol - objc.NSString get internationalCurrencySymbol { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_internationalCurrencySymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setInternationalCurrencySymbol: - set internationalCurrencySymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setInternationalCurrencySymbol_, value.ref.pointer); - } - - /// percentSymbol - objc.NSString get percentSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_percentSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPercentSymbol: - set percentSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPercentSymbol_, value.ref.pointer); - } - - /// perMillSymbol - objc.NSString get perMillSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_perMillSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPerMillSymbol: - set perMillSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPerMillSymbol_, value.ref.pointer); - } - - /// minusSign - objc.NSString get minusSign { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_minusSign); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setMinusSign: - set minusSign(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMinusSign_, value.ref.pointer); - } - - /// plusSign - objc.NSString get plusSign { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_plusSign); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPlusSign: - set plusSign(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPlusSign_, value.ref.pointer); - } - - /// exponentSymbol - objc.NSString get exponentSymbol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_exponentSymbol); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setExponentSymbol: - set exponentSymbol(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setExponentSymbol_, value.ref.pointer); - } - - /// groupingSize - int get groupingSize { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_groupingSize); - } - - /// setGroupingSize: - set groupingSize(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setGroupingSize_, value); - } - - /// secondaryGroupingSize - int get secondaryGroupingSize { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_secondaryGroupingSize); - } - - /// setSecondaryGroupingSize: - set secondaryGroupingSize(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setSecondaryGroupingSize_, value); - } - - /// multiplier - objc.NSNumber? get multiplier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_multiplier); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setMultiplier: - set multiplier(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setMultiplier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// formatWidth - int get formatWidth { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_formatWidth); - } - - /// setFormatWidth: - set formatWidth(int value) { - return _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_setFormatWidth_, value); - } - - /// paddingCharacter - objc.NSString get paddingCharacter { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_paddingCharacter); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPaddingCharacter: - set paddingCharacter(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPaddingCharacter_, value.ref.pointer); - } - - /// paddingPosition - NSNumberFormatterPadPosition get paddingPosition { - final _ret = _objc_msgSend_1s69i33(this.ref.pointer, _sel_paddingPosition); - return NSNumberFormatterPadPosition.fromValue(_ret); - } - - /// setPaddingPosition: - set paddingPosition(NSNumberFormatterPadPosition value) { - return _objc_msgSend_gz8txq( - this.ref.pointer, _sel_setPaddingPosition_, value.value); - } - - /// roundingMode - NSNumberFormatterRoundingMode get roundingMode { - final _ret = _objc_msgSend_38d07q(this.ref.pointer, _sel_roundingMode); - return NSNumberFormatterRoundingMode.fromValue(_ret); - } - - /// setRoundingMode: - set roundingMode(NSNumberFormatterRoundingMode value) { - return _objc_msgSend_5krs29( - this.ref.pointer, _sel_setRoundingMode_, value.value); - } - - /// roundingIncrement - objc.NSNumber get roundingIncrement { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_roundingIncrement); - return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setRoundingIncrement: - set roundingIncrement(objc.NSNumber value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setRoundingIncrement_, value.ref.pointer); - } - - /// minimumIntegerDigits - int get minimumIntegerDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_minimumIntegerDigits); - } - - /// setMinimumIntegerDigits: - set minimumIntegerDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumIntegerDigits_, value); - } - - /// maximumIntegerDigits - int get maximumIntegerDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_maximumIntegerDigits); - } - - /// setMaximumIntegerDigits: - set maximumIntegerDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMaximumIntegerDigits_, value); - } - - /// minimumFractionDigits - int get minimumFractionDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_minimumFractionDigits); - } - - /// setMinimumFractionDigits: - set minimumFractionDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumFractionDigits_, value); - } - - /// maximumFractionDigits - int get maximumFractionDigits { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_maximumFractionDigits); - } - - /// setMaximumFractionDigits: - set maximumFractionDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMaximumFractionDigits_, value); - } - - /// minimum - objc.NSNumber? get minimum { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_minimum); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setMinimum: - set minimum(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMinimum_, value?.ref.pointer ?? ffi.nullptr); - } - - /// maximum - objc.NSNumber? get maximum { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_maximum); - return _ret.address == 0 - ? null - : objc.NSNumber.castFromPointer(_ret, retain: true, release: true); - } - - /// setMaximum: - set maximum(objc.NSNumber? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMaximum_, value?.ref.pointer ?? ffi.nullptr); - } - - /// currencyGroupingSeparator - objc.NSString get currencyGroupingSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currencyGroupingSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrencyGroupingSeparator: - set currencyGroupingSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setCurrencyGroupingSeparator_, value.ref.pointer); - } - - /// isLenient - bool get lenient { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLenient); - } - - /// setLenient: - set lenient(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setLenient_, value); - } - - /// usesSignificantDigits - bool get usesSignificantDigits { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_usesSignificantDigits); - } - - /// setUsesSignificantDigits: - set usesSignificantDigits(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesSignificantDigits_, value); - } - - /// minimumSignificantDigits - int get minimumSignificantDigits { - return _objc_msgSend_eldhrq( - this.ref.pointer, _sel_minimumSignificantDigits); - } - - /// setMinimumSignificantDigits: - set minimumSignificantDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMinimumSignificantDigits_, value); - } - - /// maximumSignificantDigits - int get maximumSignificantDigits { - return _objc_msgSend_eldhrq( - this.ref.pointer, _sel_maximumSignificantDigits); - } - - /// setMaximumSignificantDigits: - set maximumSignificantDigits(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMaximumSignificantDigits_, value); - } - - /// isPartialStringValidationEnabled - bool get partialStringValidationEnabled { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_isPartialStringValidationEnabled); - } - - /// setPartialStringValidationEnabled: - set partialStringValidationEnabled(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setPartialStringValidationEnabled_, value); - } - - /// hasThousandSeparators - bool get hasThousandSeparators { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasThousandSeparators); - } - - /// setHasThousandSeparators: - set hasThousandSeparators(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHasThousandSeparators_, value); - } - - /// thousandSeparator - objc.NSString get thousandSeparator { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_thousandSeparator); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setThousandSeparator: - set thousandSeparator(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setThousandSeparator_, value.ref.pointer); - } - - /// localizesFormat - bool get localizesFormat { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_localizesFormat); - } - - /// setLocalizesFormat: - set localizesFormat(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setLocalizesFormat_, value); - } - - /// format - objc.NSString get format { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_format); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setFormat: - set format(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFormat_, value.ref.pointer); - } - - /// attributedStringForZero - NSAttributedString get attributedStringForZero { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributedStringForZero); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAttributedStringForZero: - set attributedStringForZero(NSAttributedString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAttributedStringForZero_, value.ref.pointer); - } - - /// attributedStringForNil - NSAttributedString get attributedStringForNil { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributedStringForNil); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAttributedStringForNil: - set attributedStringForNil(NSAttributedString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setAttributedStringForNil_, value.ref.pointer); - } - - /// attributedStringForNotANumber - NSAttributedString get attributedStringForNotANumber { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_attributedStringForNotANumber); - return NSAttributedString.castFromPointer(_ret, - retain: true, release: true); - } - - /// setAttributedStringForNotANumber: - set attributedStringForNotANumber(NSAttributedString value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setAttributedStringForNotANumber_, value.ref.pointer); - } - - /// roundingBehavior - NSDecimalNumberHandler get roundingBehavior { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_roundingBehavior); - return NSDecimalNumberHandler.castFromPointer(_ret, - retain: true, release: true); - } - - /// setRoundingBehavior: - set roundingBehavior(NSDecimalNumberHandler value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setRoundingBehavior_, value.ref.pointer); - } - - /// init - NSNumberFormatter init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSNumberFormatter new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNumberFormatter, _sel_new); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSNumberFormatter allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSNumberFormatter, _sel_allocWithZone_, zone); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSNumberFormatter alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNumberFormatter, _sel_alloc); - return NSNumberFormatter.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSNumberFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSNumberFormatter, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSNumberFormatter, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSNumberFormatter, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSNumberFormatter, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSNumberFormatter, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSNumberFormatter, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNumberFormatter, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNumberFormatter, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSNumberFormatter self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSNumberFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSNumberFormatter retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSNumberFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSNumberFormatter autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSNumberFormatter.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithCoder: - NSNumberFormatter? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSNumberFormatter.castFromPointer(_ret, retain: false, release: true); - } -} - -enum NSLocaleLanguageDirection { - NSLocaleLanguageDirectionUnknown(0), - NSLocaleLanguageDirectionLeftToRight(1), - NSLocaleLanguageDirectionRightToLeft(2), - NSLocaleLanguageDirectionTopToBottom(3), - NSLocaleLanguageDirectionBottomToTop(4); - - final int value; - const NSLocaleLanguageDirection(this.value); - - static NSLocaleLanguageDirection fromValue(int value) => switch (value) { - 0 => NSLocaleLanguageDirectionUnknown, - 1 => NSLocaleLanguageDirectionLeftToRight, - 2 => NSLocaleLanguageDirectionRightToLeft, - 3 => NSLocaleLanguageDirectionTopToBottom, - 4 => NSLocaleLanguageDirectionBottomToTop, - _ => throw ArgumentError( - "Unknown value for NSLocaleLanguageDirection: $value"), - }; -} - -final class NSDecimal extends ffi.Opaque {} - -late final _class_NSScanner = objc.getClass("NSScanner"); -late final _sel_scanLocation = objc.registerName("scanLocation"); -late final _sel_setScanLocation_ = objc.registerName("setScanLocation:"); -late final _sel_charactersToBeSkipped = - objc.registerName("charactersToBeSkipped"); -late final _sel_setCharactersToBeSkipped_ = - objc.registerName("setCharactersToBeSkipped:"); -late final _sel_caseSensitive = objc.registerName("caseSensitive"); -late final _sel_setCaseSensitive_ = objc.registerName("setCaseSensitive:"); -late final _sel_scanInt_ = objc.registerName("scanInt:"); -final _objc_msgSend_tke0i3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanInteger_ = objc.registerName("scanInteger:"); -final _objc_msgSend_1m3j5r2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanLongLong_ = objc.registerName("scanLongLong:"); -final _objc_msgSend_litvm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanUnsignedLongLong_ = - objc.registerName("scanUnsignedLongLong:"); -final _objc_msgSend_1uz3cj3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_scanFloat_ = objc.registerName("scanFloat:"); -final _objc_msgSend_1qkfxp0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanDouble_ = objc.registerName("scanDouble:"); -final _objc_msgSend_2un1vl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanHexInt_ = objc.registerName("scanHexInt:"); -final _objc_msgSend_5fep2j = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_scanHexLongLong_ = objc.registerName("scanHexLongLong:"); -late final _sel_scanHexFloat_ = objc.registerName("scanHexFloat:"); -late final _sel_scanHexDouble_ = objc.registerName("scanHexDouble:"); -late final _sel_scanString_intoString_ = - objc.registerName("scanString:intoString:"); -final _objc_msgSend_p02k6o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_scanCharactersFromSet_intoString_ = - objc.registerName("scanCharactersFromSet:intoString:"); -late final _sel_scanUpToString_intoString_ = - objc.registerName("scanUpToString:intoString:"); -late final _sel_scanUpToCharactersFromSet_intoString_ = - objc.registerName("scanUpToCharactersFromSet:intoString:"); -late final _sel_isAtEnd = objc.registerName("isAtEnd"); -late final _sel_scannerWithString_ = objc.registerName("scannerWithString:"); -late final _sel_localizedScannerWithString_ = - objc.registerName("localizedScannerWithString:"); -late final _sel_scanDecimal_ = objc.registerName("scanDecimal:"); -final _objc_msgSend_wap63g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - -/// NSScanner -class NSScanner extends objc.NSObject { - NSScanner._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScanner] that points to the same underlying object as [other]. - NSScanner.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScanner] that wraps the given raw object pointer. - NSScanner.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScanner]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScanner); - } - - /// string - objc.NSString get string { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_string); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// scanLocation - int get scanLocation { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_scanLocation); - } - - /// setScanLocation: - set scanLocation(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setScanLocation_, value); - } - - /// charactersToBeSkipped - objc.NSCharacterSet? get charactersToBeSkipped { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_charactersToBeSkipped); - return _ret.address == 0 - ? null - : objc.NSCharacterSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// setCharactersToBeSkipped: - set charactersToBeSkipped(objc.NSCharacterSet? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setCharactersToBeSkipped_, value?.ref.pointer ?? ffi.nullptr); - } - - /// caseSensitive - bool get caseSensitive { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_caseSensitive); - } - - /// setCaseSensitive: - set caseSensitive(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setCaseSensitive_, value); - } - - /// locale - objc.ObjCObjectBase? get locale { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_locale); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setLocale: - set locale(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setLocale_, value?.ref.pointer ?? ffi.nullptr); - } - - /// initWithString: - NSScanner initWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, string.ref.pointer); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// scanInt: - bool scanInt_(ffi.Pointer result) { - return _objc_msgSend_tke0i3(this.ref.pointer, _sel_scanInt_, result); - } - - /// scanInteger: - bool scanInteger_(ffi.Pointer result) { - return _objc_msgSend_1m3j5r2(this.ref.pointer, _sel_scanInteger_, result); - } - - /// scanLongLong: - bool scanLongLong_(ffi.Pointer result) { - return _objc_msgSend_litvm(this.ref.pointer, _sel_scanLongLong_, result); - } - - /// scanUnsignedLongLong: - bool scanUnsignedLongLong_(ffi.Pointer result) { - return _objc_msgSend_1uz3cj3( - this.ref.pointer, _sel_scanUnsignedLongLong_, result); - } - - /// scanFloat: - bool scanFloat_(ffi.Pointer result) { - return _objc_msgSend_1qkfxp0(this.ref.pointer, _sel_scanFloat_, result); - } - - /// scanDouble: - bool scanDouble_(ffi.Pointer result) { - return _objc_msgSend_2un1vl(this.ref.pointer, _sel_scanDouble_, result); - } - - /// scanHexInt: - bool scanHexInt_(ffi.Pointer result) { - return _objc_msgSend_5fep2j(this.ref.pointer, _sel_scanHexInt_, result); - } - - /// scanHexLongLong: - bool scanHexLongLong_(ffi.Pointer result) { - return _objc_msgSend_1uz3cj3( - this.ref.pointer, _sel_scanHexLongLong_, result); - } - - /// scanHexFloat: - bool scanHexFloat_(ffi.Pointer result) { - return _objc_msgSend_1qkfxp0(this.ref.pointer, _sel_scanHexFloat_, result); - } - - /// scanHexDouble: - bool scanHexDouble_(ffi.Pointer result) { - return _objc_msgSend_2un1vl(this.ref.pointer, _sel_scanHexDouble_, result); - } - - /// scanString:intoString: - bool scanString_intoString_( - objc.NSString string, ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_scanString_intoString_, - string.ref.pointer, result); - } - - /// scanCharactersFromSet:intoString: - bool scanCharactersFromSet_intoString_(objc.NSCharacterSet set, - ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_scanCharactersFromSet_intoString_, set.ref.pointer, result); - } - - /// scanUpToString:intoString: - bool scanUpToString_intoString_( - objc.NSString string, ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_scanUpToString_intoString_, string.ref.pointer, result); - } - - /// scanUpToCharactersFromSet:intoString: - bool scanUpToCharactersFromSet_intoString_(objc.NSCharacterSet set, - ffi.Pointer> result) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_scanUpToCharactersFromSet_intoString_, set.ref.pointer, result); - } - - /// isAtEnd - bool get atEnd { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isAtEnd); - } - - /// scannerWithString: - static NSScanner scannerWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSScanner, _sel_scannerWithString_, string.ref.pointer); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedScannerWithString: - static objc.ObjCObjectBase localizedScannerWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSScanner, _sel_localizedScannerWithString_, string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// scanDecimal: - bool scanDecimal_(ffi.Pointer dcm) { - return _objc_msgSend_wap63g(this.ref.pointer, _sel_scanDecimal_, dcm); - } - - /// init - NSScanner init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSScanner new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScanner, _sel_new); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSScanner allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSScanner, _sel_allocWithZone_, zone); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSScanner alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScanner, _sel_alloc); - return NSScanner.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScanner, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScanner, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScanner, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSScanner, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScanner, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScanner, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScanner, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScanner, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScanner, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSScanner self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSScanner retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSScanner autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSScanner.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSException = objc.getClass("NSException"); -late final _sel_exceptionWithName_reason_userInfo_ = - objc.registerName("exceptionWithName:reason:userInfo:"); -late final _sel_initWithName_reason_userInfo_ = - objc.registerName("initWithName:reason:userInfo:"); -late final _sel_reason = objc.registerName("reason"); -late final _sel_callStackReturnAddresses = - objc.registerName("callStackReturnAddresses"); -late final _sel_callStackSymbols = objc.registerName("callStackSymbols"); -late final _sel_raise = objc.registerName("raise"); -late final _sel_raise_format_ = objc.registerName("raise:format:"); - -/// NSException -class NSException extends objc.NSObject { - NSException._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSException] that points to the same underlying object as [other]. - NSException.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSException] that wraps the given raw object pointer. - NSException.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSException]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSException); - } - - /// exceptionWithName:reason:userInfo: - static NSException exceptionWithName_reason_userInfo_( - objc.NSString name, objc.NSString? reason, objc.NSDictionary? userInfo) { - final _ret = _objc_msgSend_aud7dn( - _class_NSException, - _sel_exceptionWithName_reason_userInfo_, - name.ref.pointer, - reason?.ref.pointer ?? ffi.nullptr, - userInfo?.ref.pointer ?? ffi.nullptr); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithName:reason:userInfo: - NSException initWithName_reason_userInfo_(objc.NSString aName, - objc.NSString? aReason, objc.NSDictionary? aUserInfo) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithName_reason_userInfo_, - aName.ref.pointer, - aReason?.ref.pointer ?? ffi.nullptr, - aUserInfo?.ref.pointer ?? ffi.nullptr); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// reason - objc.NSString? get reason { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reason); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// userInfo - objc.NSDictionary? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// callStackReturnAddresses - objc.NSArray get callStackReturnAddresses { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_callStackReturnAddresses); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// callStackSymbols - objc.NSArray get callStackSymbols { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_callStackSymbols); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// raise - void raise() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_raise); - } - - /// raise:format: - static void raise_format_(objc.NSString name, objc.NSString format) { - _objc_msgSend_1tjlcwl(_class_NSException, _sel_raise_format_, - name.ref.pointer, format.ref.pointer); - } - - /// init - NSException init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSException new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSException, _sel_new); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSException allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSException, _sel_allocWithZone_, zone); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSException alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSException, _sel_alloc); - return NSException.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSException, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSException, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSException, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSException, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSException, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSException, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSException, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSException, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSException, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSException self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSException retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSException autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSException.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSException, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSException? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSException.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSFileHandle = objc.getClass("NSFileHandle"); -late final _sel_availableData = objc.registerName("availableData"); -late final _sel_initWithFileDescriptor_closeOnDealloc_ = - objc.registerName("initWithFileDescriptor:closeOnDealloc:"); -final _objc_msgSend_1jumayh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Int, ffi.Bool)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, bool)>(); -late final _sel_readDataToEndOfFileAndReturnError_ = - objc.registerName("readDataToEndOfFileAndReturnError:"); -final _objc_msgSend_13z4cgc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_readDataUpToLength_error_ = - objc.registerName("readDataUpToLength:error:"); -final _objc_msgSend_5h0ois = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_writeData_error_ = objc.registerName("writeData:error:"); -late final _sel_getOffset_error_ = objc.registerName("getOffset:error:"); -final _objc_msgSend_gp32qh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_seekToEndReturningOffset_error_ = - objc.registerName("seekToEndReturningOffset:error:"); -late final _sel_seekToOffset_error_ = objc.registerName("seekToOffset:error:"); -final _objc_msgSend_57fjbb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLongLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_truncateAtOffset_error_ = - objc.registerName("truncateAtOffset:error:"); -late final _sel_synchronizeAndReturnError_ = - objc.registerName("synchronizeAndReturnError:"); -late final _sel_closeAndReturnError_ = - objc.registerName("closeAndReturnError:"); -late final _sel_fileHandleWithStandardInput = - objc.registerName("fileHandleWithStandardInput"); -late final _sel_fileHandleWithStandardOutput = - objc.registerName("fileHandleWithStandardOutput"); -late final _sel_fileHandleWithStandardError = - objc.registerName("fileHandleWithStandardError"); -late final _sel_fileHandleWithNullDevice = - objc.registerName("fileHandleWithNullDevice"); -late final _sel_fileHandleForReadingAtPath_ = - objc.registerName("fileHandleForReadingAtPath:"); -late final _sel_fileHandleForWritingAtPath_ = - objc.registerName("fileHandleForWritingAtPath:"); -late final _sel_fileHandleForUpdatingAtPath_ = - objc.registerName("fileHandleForUpdatingAtPath:"); -late final _sel_fileHandleForReadingFromURL_error_ = - objc.registerName("fileHandleForReadingFromURL:error:"); -final _objc_msgSend_1y425zh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_fileHandleForWritingToURL_error_ = - objc.registerName("fileHandleForWritingToURL:error:"); -late final _sel_fileHandleForUpdatingURL_error_ = - objc.registerName("fileHandleForUpdatingURL:error:"); -late final _sel_readInBackgroundAndNotifyForModes_ = - objc.registerName("readInBackgroundAndNotifyForModes:"); -late final _sel_readInBackgroundAndNotify = - objc.registerName("readInBackgroundAndNotify"); -late final _sel_readToEndOfFileInBackgroundAndNotifyForModes_ = - objc.registerName("readToEndOfFileInBackgroundAndNotifyForModes:"); -late final _sel_readToEndOfFileInBackgroundAndNotify = - objc.registerName("readToEndOfFileInBackgroundAndNotify"); -late final _sel_acceptConnectionInBackgroundAndNotifyForModes_ = - objc.registerName("acceptConnectionInBackgroundAndNotifyForModes:"); -late final _sel_acceptConnectionInBackgroundAndNotify = - objc.registerName("acceptConnectionInBackgroundAndNotify"); -late final _sel_waitForDataInBackgroundAndNotifyForModes_ = - objc.registerName("waitForDataInBackgroundAndNotifyForModes:"); -late final _sel_waitForDataInBackgroundAndNotify = - objc.registerName("waitForDataInBackgroundAndNotify"); -void _ObjCBlock_ffiVoid_NSFileHandle_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSFileHandle_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSFileHandle_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSFileHandle_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSFileHandle_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSFileHandle_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSFileHandle_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSFileHandle_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSFileHandle_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSFileHandle { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSFileHandle_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSFileHandle) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSFileHandle_closureCallable, - (ffi.Pointer arg0) => fn( - NSFileHandle.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSFileHandle) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSFileHandle_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn( - NSFileHandle.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSFileHandle_CallExtension - on objc.ObjCBlock { - void call(NSFileHandle arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_readabilityHandler = objc.registerName("readabilityHandler"); -late final _sel_setReadabilityHandler_ = - objc.registerName("setReadabilityHandler:"); -late final _sel_writeabilityHandler = objc.registerName("writeabilityHandler"); -late final _sel_setWriteabilityHandler_ = - objc.registerName("setWriteabilityHandler:"); -late final _sel_initWithFileDescriptor_ = - objc.registerName("initWithFileDescriptor:"); -late final _sel_fileDescriptor = objc.registerName("fileDescriptor"); -final _objc_msgSend_1tf0yjs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_readDataToEndOfFile = objc.registerName("readDataToEndOfFile"); -late final _sel_readDataOfLength_ = objc.registerName("readDataOfLength:"); -late final _sel_writeData_ = objc.registerName("writeData:"); -late final _sel_offsetInFile = objc.registerName("offsetInFile"); -final _objc_msgSend_1cirwn8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLongLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_seekToEndOfFile = objc.registerName("seekToEndOfFile"); -late final _sel_seekToFileOffset_ = objc.registerName("seekToFileOffset:"); -final _objc_msgSend_10wkxl3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLongLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_truncateFileAtOffset_ = - objc.registerName("truncateFileAtOffset:"); -late final _sel_synchronizeFile = objc.registerName("synchronizeFile"); -late final _sel_closeFile = objc.registerName("closeFile"); - -/// NSFileHandle -class NSFileHandle extends objc.NSObject { - NSFileHandle._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFileHandle] that points to the same underlying object as [other]. - NSFileHandle.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFileHandle] that wraps the given raw object pointer. - NSFileHandle.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFileHandle]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFileHandle); - } - - /// availableData - objc.NSData get availableData { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_availableData); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithFileDescriptor:closeOnDealloc: - NSFileHandle initWithFileDescriptor_closeOnDealloc_(int fd, bool closeopt) { - final _ret = _objc_msgSend_1jumayh(this.ref.retainAndReturnPointer(), - _sel_initWithFileDescriptor_closeOnDealloc_, fd, closeopt); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSFileHandle? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// readDataToEndOfFileAndReturnError: - objc.NSData? readDataToEndOfFileAndReturnError_( - ffi.Pointer> error) { - final _ret = _objc_msgSend_13z4cgc( - this.ref.pointer, _sel_readDataToEndOfFileAndReturnError_, error); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// readDataUpToLength:error: - objc.NSData? readDataUpToLength_error_( - int length, ffi.Pointer> error) { - final _ret = _objc_msgSend_5h0ois( - this.ref.pointer, _sel_readDataUpToLength_error_, length, error); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// writeData:error: - bool writeData_error_( - objc.NSData data, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_writeData_error_, data.ref.pointer, error); - } - - /// getOffset:error: - bool getOffset_error_(ffi.Pointer offsetInFile, - ffi.Pointer> error) { - return _objc_msgSend_gp32qh( - this.ref.pointer, _sel_getOffset_error_, offsetInFile, error); - } - - /// seekToEndReturningOffset:error: - bool seekToEndReturningOffset_error_( - ffi.Pointer offsetInFile, - ffi.Pointer> error) { - return _objc_msgSend_gp32qh(this.ref.pointer, - _sel_seekToEndReturningOffset_error_, offsetInFile, error); - } - - /// seekToOffset:error: - bool seekToOffset_error_( - int offset, ffi.Pointer> error) { - return _objc_msgSend_57fjbb( - this.ref.pointer, _sel_seekToOffset_error_, offset, error); - } - - /// truncateAtOffset:error: - bool truncateAtOffset_error_( - int offset, ffi.Pointer> error) { - return _objc_msgSend_57fjbb( - this.ref.pointer, _sel_truncateAtOffset_error_, offset, error); - } - - /// synchronizeAndReturnError: - bool synchronizeAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_synchronizeAndReturnError_, error); - } - - /// closeAndReturnError: - bool closeAndReturnError_(ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_closeAndReturnError_, error); - } - - /// fileHandleWithStandardInput - static NSFileHandle getFileHandleWithStandardInput() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithStandardInput); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleWithStandardOutput - static NSFileHandle getFileHandleWithStandardOutput() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithStandardOutput); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleWithStandardError - static NSFileHandle getFileHandleWithStandardError() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithStandardError); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleWithNullDevice - static NSFileHandle getFileHandleWithNullDevice() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_fileHandleWithNullDevice); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForReadingAtPath: - static NSFileHandle? fileHandleForReadingAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_fileHandleForReadingAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForWritingAtPath: - static NSFileHandle? fileHandleForWritingAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_fileHandleForWritingAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForUpdatingAtPath: - static NSFileHandle? fileHandleForUpdatingAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_fileHandleForUpdatingAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForReadingFromURL:error: - static NSFileHandle? fileHandleForReadingFromURL_error_( - objc.NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSFileHandle, - _sel_fileHandleForReadingFromURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForWritingToURL:error: - static NSFileHandle? fileHandleForWritingToURL_error_( - objc.NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSFileHandle, - _sel_fileHandleForWritingToURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// fileHandleForUpdatingURL:error: - static NSFileHandle? fileHandleForUpdatingURL_error_( - objc.NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSFileHandle, - _sel_fileHandleForUpdatingURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// readInBackgroundAndNotifyForModes: - void readInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_readInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// readInBackgroundAndNotify - void readInBackgroundAndNotify() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_readInBackgroundAndNotify); - } - - /// readToEndOfFileInBackgroundAndNotifyForModes: - void readToEndOfFileInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_readToEndOfFileInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// readToEndOfFileInBackgroundAndNotify - void readToEndOfFileInBackgroundAndNotify() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_readToEndOfFileInBackgroundAndNotify); - } - - /// acceptConnectionInBackgroundAndNotifyForModes: - void acceptConnectionInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_acceptConnectionInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// acceptConnectionInBackgroundAndNotify - void acceptConnectionInBackgroundAndNotify() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_acceptConnectionInBackgroundAndNotify); - } - - /// waitForDataInBackgroundAndNotifyForModes: - void waitForDataInBackgroundAndNotifyForModes_(objc.NSArray? modes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_waitForDataInBackgroundAndNotifyForModes_, - modes?.ref.pointer ?? ffi.nullptr); - } - - /// waitForDataInBackgroundAndNotify - void waitForDataInBackgroundAndNotify() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_waitForDataInBackgroundAndNotify); - } - - /// readabilityHandler - objc.ObjCBlock? get readabilityHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_readabilityHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid_NSFileHandle.castFromPointer(_ret, - retain: true, release: true); - } - - /// setReadabilityHandler: - set readabilityHandler( - objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setReadabilityHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// writeabilityHandler - objc.ObjCBlock? get writeabilityHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_writeabilityHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid_NSFileHandle.castFromPointer(_ret, - retain: true, release: true); - } - - /// setWriteabilityHandler: - set writeabilityHandler( - objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setWriteabilityHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// initWithFileDescriptor: - NSFileHandle initWithFileDescriptor_(int fd) { - final _ret = _objc_msgSend_105o5we( - this.ref.retainAndReturnPointer(), _sel_initWithFileDescriptor_, fd); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// fileDescriptor - int get fileDescriptor { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_fileDescriptor); - } - - /// readDataToEndOfFile - objc.NSData readDataToEndOfFile() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_readDataToEndOfFile); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// readDataOfLength: - objc.NSData readDataOfLength_(int length) { - final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_readDataOfLength_, length); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// writeData: - void writeData_(objc.NSData data) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_writeData_, data.ref.pointer); - } - - /// offsetInFile - int get offsetInFile { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_offsetInFile); - } - - /// seekToEndOfFile - int seekToEndOfFile() { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_seekToEndOfFile); - } - - /// seekToFileOffset: - void seekToFileOffset_(int offset) { - _objc_msgSend_10wkxl3(this.ref.pointer, _sel_seekToFileOffset_, offset); - } - - /// truncateFileAtOffset: - void truncateFileAtOffset_(int offset) { - _objc_msgSend_10wkxl3(this.ref.pointer, _sel_truncateFileAtOffset_, offset); - } - - /// synchronizeFile - void synchronizeFile() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_synchronizeFile); - } - - /// closeFile - void closeFile() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_closeFile); - } - - /// init - NSFileHandle init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFileHandle new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileHandle, _sel_new); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFileHandle allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFileHandle, _sel_allocWithZone_, zone); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFileHandle alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileHandle, _sel_alloc); - return NSFileHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFileHandle, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFileHandle, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFileHandle, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFileHandle, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFileHandle, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFileHandle, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFileHandle, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileHandle, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSFileHandle self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSFileHandle retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSFileHandle autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSFileHandle.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSFileHandle, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _class_NSFileManager = objc.getClass("NSFileManager"); -late final _sel_defaultManager = objc.registerName("defaultManager"); - -enum NSVolumeEnumerationOptions { - NSVolumeEnumerationSkipHiddenVolumes(2), - NSVolumeEnumerationProduceFileReferenceURLs(4); - - final int value; - const NSVolumeEnumerationOptions(this.value); - - static NSVolumeEnumerationOptions fromValue(int value) => switch (value) { - 2 => NSVolumeEnumerationSkipHiddenVolumes, - 4 => NSVolumeEnumerationProduceFileReferenceURLs, - _ => throw ArgumentError( - "Unknown value for NSVolumeEnumerationOptions: $value"), - }; -} - -late final _sel_mountedVolumeURLsIncludingResourceValuesForKeys_options_ = objc - .registerName("mountedVolumeURLsIncludingResourceValuesForKeys:options:"); -final _objc_msgSend_gyiq9w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); - -enum NSFileManagerUnmountOptions { - NSFileManagerUnmountAllPartitionsAndEjectDisk(1), - NSFileManagerUnmountWithoutUI(2); - - final int value; - const NSFileManagerUnmountOptions(this.value); - - static NSFileManagerUnmountOptions fromValue(int value) => switch (value) { - 1 => NSFileManagerUnmountAllPartitionsAndEjectDisk, - 2 => NSFileManagerUnmountWithoutUI, - _ => throw ArgumentError( - "Unknown value for NSFileManagerUnmountOptions: $value"), - }; -} - -void _ObjCBlock_ffiVoid_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSError_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSError_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSError_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSError.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSError_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSError.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSError_CallExtension - on objc.ObjCBlock { - void call(objc.NSError? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_unmountVolumeAtURL_options_completionHandler_ = - objc.registerName("unmountVolumeAtURL:options:completionHandler:"); -final _objc_msgSend_yuugcv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - -enum NSDirectoryEnumerationOptions { - NSDirectoryEnumerationSkipsSubdirectoryDescendants(1), - NSDirectoryEnumerationSkipsPackageDescendants(2), - NSDirectoryEnumerationSkipsHiddenFiles(4), - NSDirectoryEnumerationIncludesDirectoriesPostOrder(8), - NSDirectoryEnumerationProducesRelativePathURLs(16); - - final int value; - const NSDirectoryEnumerationOptions(this.value); - - static NSDirectoryEnumerationOptions fromValue(int value) => switch (value) { - 1 => NSDirectoryEnumerationSkipsSubdirectoryDescendants, - 2 => NSDirectoryEnumerationSkipsPackageDescendants, - 4 => NSDirectoryEnumerationSkipsHiddenFiles, - 8 => NSDirectoryEnumerationIncludesDirectoriesPostOrder, - 16 => NSDirectoryEnumerationProducesRelativePathURLs, - _ => throw ArgumentError( - "Unknown value for NSDirectoryEnumerationOptions: $value"), - }; -} - -late final _sel_contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error_ = - objc.registerName( - "contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:"); -final _objc_msgSend_1rn5oli = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); - -enum NSSearchPathDirectory { - NSApplicationDirectory(1), - NSDemoApplicationDirectory(2), - NSDeveloperApplicationDirectory(3), - NSAdminApplicationDirectory(4), - NSLibraryDirectory(5), - NSDeveloperDirectory(6), - NSUserDirectory(7), - NSDocumentationDirectory(8), - NSDocumentDirectory(9), - NSCoreServiceDirectory(10), - NSAutosavedInformationDirectory(11), - NSDesktopDirectory(12), - NSCachesDirectory(13), - NSApplicationSupportDirectory(14), - NSDownloadsDirectory(15), - NSInputMethodsDirectory(16), - NSMoviesDirectory(17), - NSMusicDirectory(18), - NSPicturesDirectory(19), - NSPrinterDescriptionDirectory(20), - NSSharedPublicDirectory(21), - NSPreferencePanesDirectory(22), - NSApplicationScriptsDirectory(23), - NSItemReplacementDirectory(99), - NSAllApplicationsDirectory(100), - NSAllLibrariesDirectory(101), - NSTrashDirectory(102); - - final int value; - const NSSearchPathDirectory(this.value); - - static NSSearchPathDirectory fromValue(int value) => switch (value) { - 1 => NSApplicationDirectory, - 2 => NSDemoApplicationDirectory, - 3 => NSDeveloperApplicationDirectory, - 4 => NSAdminApplicationDirectory, - 5 => NSLibraryDirectory, - 6 => NSDeveloperDirectory, - 7 => NSUserDirectory, - 8 => NSDocumentationDirectory, - 9 => NSDocumentDirectory, - 10 => NSCoreServiceDirectory, - 11 => NSAutosavedInformationDirectory, - 12 => NSDesktopDirectory, - 13 => NSCachesDirectory, - 14 => NSApplicationSupportDirectory, - 15 => NSDownloadsDirectory, - 16 => NSInputMethodsDirectory, - 17 => NSMoviesDirectory, - 18 => NSMusicDirectory, - 19 => NSPicturesDirectory, - 20 => NSPrinterDescriptionDirectory, - 21 => NSSharedPublicDirectory, - 22 => NSPreferencePanesDirectory, - 23 => NSApplicationScriptsDirectory, - 99 => NSItemReplacementDirectory, - 100 => NSAllApplicationsDirectory, - 101 => NSAllLibrariesDirectory, - 102 => NSTrashDirectory, - _ => throw ArgumentError( - "Unknown value for NSSearchPathDirectory: $value"), - }; -} - -enum NSSearchPathDomainMask { - NSUserDomainMask(1), - NSLocalDomainMask(2), - NSNetworkDomainMask(4), - NSSystemDomainMask(8), - NSAllDomainsMask(65535); - - final int value; - const NSSearchPathDomainMask(this.value); - - static NSSearchPathDomainMask fromValue(int value) => switch (value) { - 1 => NSUserDomainMask, - 2 => NSLocalDomainMask, - 4 => NSNetworkDomainMask, - 8 => NSSystemDomainMask, - 65535 => NSAllDomainsMask, - _ => throw ArgumentError( - "Unknown value for NSSearchPathDomainMask: $value"), - }; -} - -late final _sel_URLsForDirectory_inDomains_ = - objc.registerName("URLsForDirectory:inDomains:"); -final _objc_msgSend_1llbjq7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -late final _sel_URLForDirectory_inDomain_appropriateForURL_create_error_ = objc - .registerName("URLForDirectory:inDomain:appropriateForURL:create:error:"); -final _objc_msgSend_46p27t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Bool, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - bool, - ffi.Pointer>)>(); - -enum NSURLRelationship { - NSURLRelationshipContains(0), - NSURLRelationshipSame(1), - NSURLRelationshipOther(2); - - final int value; - const NSURLRelationship(this.value); - - static NSURLRelationship fromValue(int value) => switch (value) { - 0 => NSURLRelationshipContains, - 1 => NSURLRelationshipSame, - 2 => NSURLRelationshipOther, - _ => throw ArgumentError("Unknown value for NSURLRelationship: $value"), - }; -} - -late final _sel_getRelationship_ofDirectoryAtURL_toItemAtURL_error_ = - objc.registerName("getRelationship:ofDirectoryAtURL:toItemAtURL:error:"); -final _objc_msgSend_17s8ocw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_getRelationship_ofDirectory_inDomain_toItemAtURL_error_ = objc - .registerName("getRelationship:ofDirectory:inDomain:toItemAtURL:error:"); -final _objc_msgSend_9p3pl8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_createDirectoryAtURL_withIntermediateDirectories_attributes_error_ = - objc.registerName( - "createDirectoryAtURL:withIntermediateDirectories:attributes:error:"); -final _objc_msgSend_16o5u5c = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_createSymbolicLinkAtURL_withDestinationURL_error_ = - objc.registerName("createSymbolicLinkAtURL:withDestinationURL:error:"); -final _objc_msgSend_6toz8x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_delegate = objc.registerName("delegate"); -late final _sel_setDelegate_ = objc.registerName("setDelegate:"); -late final _sel_setAttributes_ofItemAtPath_error_ = - objc.registerName("setAttributes:ofItemAtPath:error:"); -late final _sel_createDirectoryAtPath_withIntermediateDirectories_attributes_error_ = - objc.registerName( - "createDirectoryAtPath:withIntermediateDirectories:attributes:error:"); -late final _sel_contentsOfDirectoryAtPath_error_ = - objc.registerName("contentsOfDirectoryAtPath:error:"); -late final _sel_subpathsOfDirectoryAtPath_error_ = - objc.registerName("subpathsOfDirectoryAtPath:error:"); -late final _sel_attributesOfItemAtPath_error_ = - objc.registerName("attributesOfItemAtPath:error:"); -late final _sel_attributesOfFileSystemForPath_error_ = - objc.registerName("attributesOfFileSystemForPath:error:"); -late final _sel_createSymbolicLinkAtPath_withDestinationPath_error_ = - objc.registerName("createSymbolicLinkAtPath:withDestinationPath:error:"); -late final _sel_destinationOfSymbolicLinkAtPath_error_ = - objc.registerName("destinationOfSymbolicLinkAtPath:error:"); -late final _sel_copyItemAtPath_toPath_error_ = - objc.registerName("copyItemAtPath:toPath:error:"); -late final _sel_moveItemAtPath_toPath_error_ = - objc.registerName("moveItemAtPath:toPath:error:"); -late final _sel_linkItemAtPath_toPath_error_ = - objc.registerName("linkItemAtPath:toPath:error:"); -late final _sel_removeItemAtPath_error_ = - objc.registerName("removeItemAtPath:error:"); -late final _sel_copyItemAtURL_toURL_error_ = - objc.registerName("copyItemAtURL:toURL:error:"); -late final _sel_moveItemAtURL_toURL_error_ = - objc.registerName("moveItemAtURL:toURL:error:"); -late final _sel_linkItemAtURL_toURL_error_ = - objc.registerName("linkItemAtURL:toURL:error:"); -late final _sel_removeItemAtURL_error_ = - objc.registerName("removeItemAtURL:error:"); -late final _sel_trashItemAtURL_resultingItemURL_error_ = - objc.registerName("trashItemAtURL:resultingItemURL:error:"); -late final _sel_fileAttributesAtPath_traverseLink_ = - objc.registerName("fileAttributesAtPath:traverseLink:"); -late final _sel_changeFileAttributes_atPath_ = - objc.registerName("changeFileAttributes:atPath:"); -late final _sel_directoryContentsAtPath_ = - objc.registerName("directoryContentsAtPath:"); -late final _sel_fileSystemAttributesAtPath_ = - objc.registerName("fileSystemAttributesAtPath:"); -late final _sel_pathContentOfSymbolicLinkAtPath_ = - objc.registerName("pathContentOfSymbolicLinkAtPath:"); -late final _sel_createSymbolicLinkAtPath_pathContent_ = - objc.registerName("createSymbolicLinkAtPath:pathContent:"); -late final _sel_createDirectoryAtPath_attributes_ = - objc.registerName("createDirectoryAtPath:attributes:"); -late final _sel_linkPath_toPath_handler_ = - objc.registerName("linkPath:toPath:handler:"); -final _objc_msgSend_hukaf0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_copyPath_toPath_handler_ = - objc.registerName("copyPath:toPath:handler:"); -late final _sel_movePath_toPath_handler_ = - objc.registerName("movePath:toPath:handler:"); -late final _sel_removeFileAtPath_handler_ = - objc.registerName("removeFileAtPath:handler:"); -late final _sel_currentDirectoryPath = - objc.registerName("currentDirectoryPath"); -late final _sel_changeCurrentDirectoryPath_ = - objc.registerName("changeCurrentDirectoryPath:"); -late final _sel_fileExistsAtPath_ = objc.registerName("fileExistsAtPath:"); -late final _sel_fileExistsAtPath_isDirectory_ = - objc.registerName("fileExistsAtPath:isDirectory:"); -final _objc_msgSend_rtz5p9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_isReadableFileAtPath_ = - objc.registerName("isReadableFileAtPath:"); -late final _sel_isWritableFileAtPath_ = - objc.registerName("isWritableFileAtPath:"); -late final _sel_isExecutableFileAtPath_ = - objc.registerName("isExecutableFileAtPath:"); -late final _sel_isDeletableFileAtPath_ = - objc.registerName("isDeletableFileAtPath:"); -late final _sel_contentsEqualAtPath_andPath_ = - objc.registerName("contentsEqualAtPath:andPath:"); -late final _sel_displayNameAtPath_ = objc.registerName("displayNameAtPath:"); -late final _sel_componentsToDisplayForPath_ = - objc.registerName("componentsToDisplayForPath:"); -late final _sel_enumeratorAtPath_ = objc.registerName("enumeratorAtPath:"); -bool _ObjCBlock_bool_NSURL_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_NSURL_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_bool_NSURL_NSError_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_NSURL_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_NSURL_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_bool_NSURL_NSError_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_bool_NSURL_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_bool_NSURL_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - bool Function(objc.NSURL, objc.NSError) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_bool_NSURL_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - objc.NSURL - .castFromPointer(arg0, retain: true, release: true), - objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_bool_NSURL_NSError_CallExtension - on objc.ObjCBlock { - bool call(objc.NSURL arg0, objc.NSError arg1) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1.ref.pointer); -} - -late final _sel_enumeratorAtURL_includingPropertiesForKeys_options_errorHandler_ = - objc.registerName( - "enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:"); -final _objc_msgSend_40k0lk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_subpathsAtPath_ = objc.registerName("subpathsAtPath:"); -late final _sel_contentsAtPath_ = objc.registerName("contentsAtPath:"); -late final _sel_createFileAtPath_contents_attributes_ = - objc.registerName("createFileAtPath:contents:attributes:"); -late final _sel_fileSystemRepresentationWithPath_ = - objc.registerName("fileSystemRepresentationWithPath:"); -final _objc_msgSend_t1v5su = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_stringWithFileSystemRepresentation_length_ = - objc.registerName("stringWithFileSystemRepresentation:length:"); -final _objc_msgSend_1t5rcq1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); - -enum NSFileManagerItemReplacementOptions { - NSFileManagerItemReplacementUsingNewMetadataOnly(1), - NSFileManagerItemReplacementWithoutDeletingBackupItem(2); - - final int value; - const NSFileManagerItemReplacementOptions(this.value); - - static NSFileManagerItemReplacementOptions fromValue(int value) => - switch (value) { - 1 => NSFileManagerItemReplacementUsingNewMetadataOnly, - 2 => NSFileManagerItemReplacementWithoutDeletingBackupItem, - _ => throw ArgumentError( - "Unknown value for NSFileManagerItemReplacementOptions: $value"), - }; -} - -late final _sel_replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error_ = - objc.registerName( - "replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:"); -final _objc_msgSend_1cu34v2 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_setUbiquitous_itemAtURL_destinationURL_error_ = - objc.registerName("setUbiquitous:itemAtURL:destinationURL:error:"); -final _objc_msgSend_191cxmu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_isUbiquitousItemAtURL_ = - objc.registerName("isUbiquitousItemAtURL:"); -late final _sel_startDownloadingUbiquitousItemAtURL_error_ = - objc.registerName("startDownloadingUbiquitousItemAtURL:error:"); -late final _sel_evictUbiquitousItemAtURL_error_ = - objc.registerName("evictUbiquitousItemAtURL:error:"); -late final _sel_URLForUbiquityContainerIdentifier_ = - objc.registerName("URLForUbiquityContainerIdentifier:"); -late final _sel_URLForPublishingUbiquitousItemAtURL_expirationDate_error_ = objc - .registerName("URLForPublishingUbiquitousItemAtURL:expirationDate:error:"); -final _objc_msgSend_1dca44n = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_ubiquityIdentityToken = - objc.registerName("ubiquityIdentityToken"); -void _ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSDictionary_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSDictionary_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSDictionary?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSError_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: true, release: true), - arg1.address == 0 ? null : objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock - listener(void Function(objc.NSDictionary?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_NSError_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock( - wrapper, - retain: false, - release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSDictionary_NSError_CallExtension - on objc.ObjCBlock { - void call(objc.NSDictionary? arg0, objc.NSError? arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, arg1?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getFileProviderServicesForItemAtURL_completionHandler_ = - objc.registerName("getFileProviderServicesForItemAtURL:completionHandler:"); -ffi.Pointer - _ObjCBlock_objcObjCObject_NSError_NSString_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi - .NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_NSError_NSString_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_NSError_NSString_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_NSError_NSString_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_objcObjCObject_NSError_NSString_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_NSError_NSString_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock? Function(objc.NSError, objc.NSString)>`. -abstract final class ObjCBlock_objcObjCObject_NSError_NSString { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer? Function(objc.NSError, objc.NSString)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer? Function(objc.NSError, - objc.NSString)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock? Function(objc.NSError, objc.NSString)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock? Function(objc.NSError, objc.NSString)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_NSError_NSString_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock? Function(objc.NSError, objc.NSString)> - fromFunction( - objc.ObjCObjectBase? Function(objc.NSError, objc.NSString) fn) => - objc.ObjCBlock? Function(objc.NSError, objc.NSString)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_NSError_NSString_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn(objc.NSError.castFromPointer(arg0, retain: true, release: true), objc.NSString.castFromPointer(arg1, retain: true, release: true)) - ?.ref - .retainAndAutorelease() ?? - ffi.nullptr), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock? Function(objc.NSError, objc.NSString)>`. -extension ObjCBlock_objcObjCObject_NSError_NSString_CallExtension - on objc.ObjCBlock< - ffi.Pointer? Function(objc.NSError, objc.NSString)> { - objc.ObjCObjectBase? call(objc.NSError arg0, objc.NSString arg1) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>() - (ref.pointer, arg0.ref.pointer, arg1.ref.pointer) - .address == - 0 - ? null - : objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast Function(ffi.Pointer block, ffi.Pointer arg0, ffi.Pointer arg1)>>() - .asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0.ref.pointer, arg1.ref.pointer), - retain: true, - release: true); -} - -final _objc_msgSend_cmbt6k = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_containerURLForSecurityApplicationGroupIdentifier_ = - objc.registerName("containerURLForSecurityApplicationGroupIdentifier:"); -late final _sel_homeDirectoryForCurrentUser = - objc.registerName("homeDirectoryForCurrentUser"); -late final _sel_temporaryDirectory = objc.registerName("temporaryDirectory"); -late final _sel_homeDirectoryForUser_ = - objc.registerName("homeDirectoryForUser:"); - -/// NSFileManager -class NSFileManager extends objc.NSObject { - NSFileManager._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFileManager] that points to the same underlying object as [other]. - NSFileManager.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFileManager] that wraps the given raw object pointer. - NSFileManager.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFileManager]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFileManager); - } - - /// defaultManager - static NSFileManager getDefaultManager() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSFileManager, _sel_defaultManager); - return NSFileManager.castFromPointer(_ret, retain: true, release: true); - } - - /// mountedVolumeURLsIncludingResourceValuesForKeys:options: - objc.NSArray? mountedVolumeURLsIncludingResourceValuesForKeys_options_( - objc.NSArray? propertyKeys, NSVolumeEnumerationOptions options) { - final _ret = _objc_msgSend_gyiq9w( - this.ref.pointer, - _sel_mountedVolumeURLsIncludingResourceValuesForKeys_options_, - propertyKeys?.ref.pointer ?? ffi.nullptr, - options.value); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// unmountVolumeAtURL:options:completionHandler: - void unmountVolumeAtURL_options_completionHandler_( - objc.NSURL url, - NSFileManagerUnmountOptions mask, - objc.ObjCBlock completionHandler) { - _objc_msgSend_yuugcv( - this.ref.pointer, - _sel_unmountVolumeAtURL_options_completionHandler_, - url.ref.pointer, - mask.value, - completionHandler.ref.pointer); - } - - /// contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: - objc.NSArray? - contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error_( - objc.NSURL url, - objc.NSArray? keys, - NSDirectoryEnumerationOptions mask, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1rn5oli( - this.ref.pointer, - _sel_contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error_, - url.ref.pointer, - keys?.ref.pointer ?? ffi.nullptr, - mask.value, - error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLsForDirectory:inDomains: - objc.NSArray URLsForDirectory_inDomains_( - NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask) { - final _ret = _objc_msgSend_1llbjq7(this.ref.pointer, - _sel_URLsForDirectory_inDomains_, directory.value, domainMask.value); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForDirectory:inDomain:appropriateForURL:create:error: - objc.NSURL? URLForDirectory_inDomain_appropriateForURL_create_error_( - NSSearchPathDirectory directory, - NSSearchPathDomainMask domain, - objc.NSURL? url, - bool shouldCreate, - ffi.Pointer> error) { - final _ret = _objc_msgSend_46p27t( - this.ref.pointer, - _sel_URLForDirectory_inDomain_appropriateForURL_create_error_, - directory.value, - domain.value, - url?.ref.pointer ?? ffi.nullptr, - shouldCreate, - error); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// getRelationship:ofDirectoryAtURL:toItemAtURL:error: - bool getRelationship_ofDirectoryAtURL_toItemAtURL_error_( - ffi.Pointer outRelationship, - objc.NSURL directoryURL, - objc.NSURL otherURL, - ffi.Pointer> error) { - return _objc_msgSend_17s8ocw( - this.ref.pointer, - _sel_getRelationship_ofDirectoryAtURL_toItemAtURL_error_, - outRelationship, - directoryURL.ref.pointer, - otherURL.ref.pointer, - error); - } - - /// getRelationship:ofDirectory:inDomain:toItemAtURL:error: - bool getRelationship_ofDirectory_inDomain_toItemAtURL_error_( - ffi.Pointer outRelationship, - NSSearchPathDirectory directory, - NSSearchPathDomainMask domainMask, - objc.NSURL url, - ffi.Pointer> error) { - return _objc_msgSend_9p3pl8( - this.ref.pointer, - _sel_getRelationship_ofDirectory_inDomain_toItemAtURL_error_, - outRelationship, - directory.value, - domainMask.value, - url.ref.pointer, - error); - } - - /// createDirectoryAtURL:withIntermediateDirectories:attributes:error: - bool createDirectoryAtURL_withIntermediateDirectories_attributes_error_( - objc.NSURL url, - bool createIntermediates, - objc.NSDictionary? attributes, - ffi.Pointer> error) { - return _objc_msgSend_16o5u5c( - this.ref.pointer, - _sel_createDirectoryAtURL_withIntermediateDirectories_attributes_error_, - url.ref.pointer, - createIntermediates, - attributes?.ref.pointer ?? ffi.nullptr, - error); - } - - /// createSymbolicLinkAtURL:withDestinationURL:error: - bool createSymbolicLinkAtURL_withDestinationURL_error_(objc.NSURL url, - objc.NSURL destURL, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_createSymbolicLinkAtURL_withDestinationURL_error_, - url.ref.pointer, - destURL.ref.pointer, - error); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// setAttributes:ofItemAtPath:error: - bool setAttributes_ofItemAtPath_error_(objc.NSDictionary attributes, - objc.NSString path, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_setAttributes_ofItemAtPath_error_, - attributes.ref.pointer, - path.ref.pointer, - error); - } - - /// createDirectoryAtPath:withIntermediateDirectories:attributes:error: - bool createDirectoryAtPath_withIntermediateDirectories_attributes_error_( - objc.NSString path, - bool createIntermediates, - objc.NSDictionary? attributes, - ffi.Pointer> error) { - return _objc_msgSend_16o5u5c( - this.ref.pointer, - _sel_createDirectoryAtPath_withIntermediateDirectories_attributes_error_, - path.ref.pointer, - createIntermediates, - attributes?.ref.pointer ?? ffi.nullptr, - error); - } - - /// contentsOfDirectoryAtPath:error: - objc.NSArray? contentsOfDirectoryAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_contentsOfDirectoryAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// subpathsOfDirectoryAtPath:error: - objc.NSArray? subpathsOfDirectoryAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_subpathsOfDirectoryAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// attributesOfItemAtPath:error: - objc.NSDictionary? attributesOfItemAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_attributesOfItemAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// attributesOfFileSystemForPath:error: - objc.NSDictionary? attributesOfFileSystemForPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_attributesOfFileSystemForPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// createSymbolicLinkAtPath:withDestinationPath:error: - bool createSymbolicLinkAtPath_withDestinationPath_error_(objc.NSString path, - objc.NSString destPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_createSymbolicLinkAtPath_withDestinationPath_error_, - path.ref.pointer, - destPath.ref.pointer, - error); - } - - /// destinationOfSymbolicLinkAtPath:error: - objc.NSString? destinationOfSymbolicLinkAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_destinationOfSymbolicLinkAtPath_error_, path.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// copyItemAtPath:toPath:error: - bool copyItemAtPath_toPath_error_(objc.NSString srcPath, - objc.NSString dstPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_copyItemAtPath_toPath_error_, - srcPath.ref.pointer, - dstPath.ref.pointer, - error); - } - - /// moveItemAtPath:toPath:error: - bool moveItemAtPath_toPath_error_(objc.NSString srcPath, - objc.NSString dstPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_moveItemAtPath_toPath_error_, - srcPath.ref.pointer, - dstPath.ref.pointer, - error); - } - - /// linkItemAtPath:toPath:error: - bool linkItemAtPath_toPath_error_(objc.NSString srcPath, - objc.NSString dstPath, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_linkItemAtPath_toPath_error_, - srcPath.ref.pointer, - dstPath.ref.pointer, - error); - } - - /// removeItemAtPath:error: - bool removeItemAtPath_error_( - objc.NSString path, ffi.Pointer> error) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_removeItemAtPath_error_, - path.ref.pointer, error); - } - - /// copyItemAtURL:toURL:error: - bool copyItemAtURL_toURL_error_(objc.NSURL srcURL, objc.NSURL dstURL, - ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_copyItemAtURL_toURL_error_, - srcURL.ref.pointer, - dstURL.ref.pointer, - error); - } - - /// moveItemAtURL:toURL:error: - bool moveItemAtURL_toURL_error_(objc.NSURL srcURL, objc.NSURL dstURL, - ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_moveItemAtURL_toURL_error_, - srcURL.ref.pointer, - dstURL.ref.pointer, - error); - } - - /// linkItemAtURL:toURL:error: - bool linkItemAtURL_toURL_error_(objc.NSURL srcURL, objc.NSURL dstURL, - ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_linkItemAtURL_toURL_error_, - srcURL.ref.pointer, - dstURL.ref.pointer, - error); - } - - /// removeItemAtURL:error: - bool removeItemAtURL_error_( - objc.NSURL URL, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_removeItemAtURL_error_, URL.ref.pointer, error); - } - - /// trashItemAtURL:resultingItemURL:error: - bool trashItemAtURL_resultingItemURL_error_( - objc.NSURL url, - ffi.Pointer> outResultingURL, - ffi.Pointer> error) { - return _objc_msgSend_to8xlo( - this.ref.pointer, - _sel_trashItemAtURL_resultingItemURL_error_, - url.ref.pointer, - outResultingURL, - error); - } - - /// fileAttributesAtPath:traverseLink: - objc.NSDictionary? fileAttributesAtPath_traverseLink_( - objc.NSString path, bool yorn) { - final _ret = _objc_msgSend_qqbb5y(this.ref.pointer, - _sel_fileAttributesAtPath_traverseLink_, path.ref.pointer, yorn); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// changeFileAttributes:atPath: - bool changeFileAttributes_atPath_( - objc.NSDictionary attributes, objc.NSString path) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_changeFileAttributes_atPath_, - attributes.ref.pointer, - path.ref.pointer); - } - - /// directoryContentsAtPath: - objc.NSArray? directoryContentsAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_directoryContentsAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// fileSystemAttributesAtPath: - objc.NSDictionary? fileSystemAttributesAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_fileSystemAttributesAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// pathContentOfSymbolicLinkAtPath: - objc.NSString? pathContentOfSymbolicLinkAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_pathContentOfSymbolicLinkAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// createSymbolicLinkAtPath:pathContent: - bool createSymbolicLinkAtPath_pathContent_( - objc.NSString path, objc.NSString otherpath) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_createSymbolicLinkAtPath_pathContent_, - path.ref.pointer, - otherpath.ref.pointer); - } - - /// createDirectoryAtPath:attributes: - bool createDirectoryAtPath_attributes_( - objc.NSString path, objc.NSDictionary attributes) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_createDirectoryAtPath_attributes_, - path.ref.pointer, - attributes.ref.pointer); - } - - /// linkPath:toPath:handler: - bool linkPath_toPath_handler_( - objc.NSString src, objc.NSString dest, objc.ObjCObjectBase? handler) { - return _objc_msgSend_hukaf0(this.ref.pointer, _sel_linkPath_toPath_handler_, - src.ref.pointer, dest.ref.pointer, handler?.ref.pointer ?? ffi.nullptr); - } - - /// copyPath:toPath:handler: - bool copyPath_toPath_handler_( - objc.NSString src, objc.NSString dest, objc.ObjCObjectBase? handler) { - return _objc_msgSend_hukaf0(this.ref.pointer, _sel_copyPath_toPath_handler_, - src.ref.pointer, dest.ref.pointer, handler?.ref.pointer ?? ffi.nullptr); - } - - /// movePath:toPath:handler: - bool movePath_toPath_handler_( - objc.NSString src, objc.NSString dest, objc.ObjCObjectBase? handler) { - return _objc_msgSend_hukaf0(this.ref.pointer, _sel_movePath_toPath_handler_, - src.ref.pointer, dest.ref.pointer, handler?.ref.pointer ?? ffi.nullptr); - } - - /// removeFileAtPath:handler: - bool removeFileAtPath_handler_( - objc.NSString path, objc.ObjCObjectBase? handler) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_removeFileAtPath_handler_, - path.ref.pointer, - handler?.ref.pointer ?? ffi.nullptr); - } - - /// currentDirectoryPath - objc.NSString get currentDirectoryPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDirectoryPath); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// changeCurrentDirectoryPath: - bool changeCurrentDirectoryPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_changeCurrentDirectoryPath_, path.ref.pointer); - } - - /// fileExistsAtPath: - bool fileExistsAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_fileExistsAtPath_, path.ref.pointer); - } - - /// fileExistsAtPath:isDirectory: - bool fileExistsAtPath_isDirectory_( - objc.NSString path, ffi.Pointer isDirectory) { - return _objc_msgSend_rtz5p9(this.ref.pointer, - _sel_fileExistsAtPath_isDirectory_, path.ref.pointer, isDirectory); - } - - /// isReadableFileAtPath: - bool isReadableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isReadableFileAtPath_, path.ref.pointer); - } - - /// isWritableFileAtPath: - bool isWritableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isWritableFileAtPath_, path.ref.pointer); - } - - /// isExecutableFileAtPath: - bool isExecutableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isExecutableFileAtPath_, path.ref.pointer); - } - - /// isDeletableFileAtPath: - bool isDeletableFileAtPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isDeletableFileAtPath_, path.ref.pointer); - } - - /// contentsEqualAtPath:andPath: - bool contentsEqualAtPath_andPath_(objc.NSString path1, objc.NSString path2) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_contentsEqualAtPath_andPath_, - path1.ref.pointer, - path2.ref.pointer); - } - - /// displayNameAtPath: - objc.NSString displayNameAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_displayNameAtPath_, path.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// componentsToDisplayForPath: - objc.NSArray? componentsToDisplayForPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_componentsToDisplayForPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// enumeratorAtPath: - objc.ObjCObjectBase? enumeratorAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_enumeratorAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: - objc.ObjCObjectBase? - enumeratorAtURL_includingPropertiesForKeys_options_errorHandler_( - objc.NSURL url, - objc.NSArray? keys, - NSDirectoryEnumerationOptions mask, - objc.ObjCBlock? - handler) { - final _ret = _objc_msgSend_40k0lk( - this.ref.pointer, - _sel_enumeratorAtURL_includingPropertiesForKeys_options_errorHandler_, - url.ref.pointer, - keys?.ref.pointer ?? ffi.nullptr, - mask.value, - handler?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// subpathsAtPath: - objc.NSArray? subpathsAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_subpathsAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// contentsAtPath: - objc.NSData? contentsAtPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_contentsAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// createFileAtPath:contents:attributes: - bool createFileAtPath_contents_attributes_( - objc.NSString path, objc.NSData? data, objc.NSDictionary? attr) { - return _objc_msgSend_hukaf0( - this.ref.pointer, - _sel_createFileAtPath_contents_attributes_, - path.ref.pointer, - data?.ref.pointer ?? ffi.nullptr, - attr?.ref.pointer ?? ffi.nullptr); - } - - /// fileSystemRepresentationWithPath: - ffi.Pointer fileSystemRepresentationWithPath_(objc.NSString path) { - return _objc_msgSend_t1v5su(this.ref.pointer, - _sel_fileSystemRepresentationWithPath_, path.ref.pointer); - } - - /// stringWithFileSystemRepresentation:length: - objc.NSString stringWithFileSystemRepresentation_length_( - ffi.Pointer str, int len) { - final _ret = _objc_msgSend_1t5rcq1(this.ref.pointer, - _sel_stringWithFileSystemRepresentation_length_, str, len); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error: - bool - replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error_( - objc.NSURL originalItemURL, - objc.NSURL newItemURL, - objc.NSString? backupItemName, - NSFileManagerItemReplacementOptions options, - ffi.Pointer> resultingURL, - ffi.Pointer> error) { - return _objc_msgSend_1cu34v2( - this.ref.pointer, - _sel_replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error_, - originalItemURL.ref.pointer, - newItemURL.ref.pointer, - backupItemName?.ref.pointer ?? ffi.nullptr, - options.value, - resultingURL, - error); - } - - /// setUbiquitous:itemAtURL:destinationURL:error: - bool setUbiquitous_itemAtURL_destinationURL_error_( - bool flag, - objc.NSURL url, - objc.NSURL destinationURL, - ffi.Pointer> error) { - return _objc_msgSend_191cxmu( - this.ref.pointer, - _sel_setUbiquitous_itemAtURL_destinationURL_error_, - flag, - url.ref.pointer, - destinationURL.ref.pointer, - error); - } - - /// isUbiquitousItemAtURL: - bool isUbiquitousItemAtURL_(objc.NSURL url) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isUbiquitousItemAtURL_, url.ref.pointer); - } - - /// startDownloadingUbiquitousItemAtURL:error: - bool startDownloadingUbiquitousItemAtURL_error_( - objc.NSURL url, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, - _sel_startDownloadingUbiquitousItemAtURL_error_, - url.ref.pointer, - error); - } - - /// evictUbiquitousItemAtURL:error: - bool evictUbiquitousItemAtURL_error_( - objc.NSURL url, ffi.Pointer> error) { - return _objc_msgSend_p02k6o(this.ref.pointer, - _sel_evictUbiquitousItemAtURL_error_, url.ref.pointer, error); - } - - /// URLForUbiquityContainerIdentifier: - objc.NSURL? URLForUbiquityContainerIdentifier_( - objc.NSString? containerIdentifier) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_URLForUbiquityContainerIdentifier_, - containerIdentifier?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLForPublishingUbiquitousItemAtURL:expirationDate:error: - objc.NSURL? URLForPublishingUbiquitousItemAtURL_expirationDate_error_( - objc.NSURL url, - ffi.Pointer> outDate, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1dca44n( - this.ref.pointer, - _sel_URLForPublishingUbiquitousItemAtURL_expirationDate_error_, - url.ref.pointer, - outDate, - error); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// ubiquityIdentityToken - objc.ObjCObjectBase? get ubiquityIdentityToken { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_ubiquityIdentityToken); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// getFileProviderServicesForItemAtURL:completionHandler: - void getFileProviderServicesForItemAtURL_completionHandler_( - objc.NSURL url, - objc.ObjCBlock - completionHandler) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_getFileProviderServicesForItemAtURL_completionHandler_, - url.ref.pointer, - completionHandler.ref.pointer); - } - - /// containerURLForSecurityApplicationGroupIdentifier: - objc.NSURL? containerURLForSecurityApplicationGroupIdentifier_( - objc.NSString groupIdentifier) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_containerURLForSecurityApplicationGroupIdentifier_, - groupIdentifier.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// homeDirectoryForCurrentUser - objc.NSURL get homeDirectoryForCurrentUser { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_homeDirectoryForCurrentUser); - return objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// temporaryDirectory - objc.NSURL get temporaryDirectory { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_temporaryDirectory); - return objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// homeDirectoryForUser: - objc.NSURL? homeDirectoryForUser_(objc.NSString userName) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_homeDirectoryForUser_, userName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSFileManager init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFileManager new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileManager, _sel_new); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFileManager allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFileManager, _sel_allocWithZone_, zone); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFileManager alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileManager, _sel_alloc); - return NSFileManager.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFileManager, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFileManager, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFileManager, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFileManager, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFileManager, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFileManager, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFileManager, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileManager, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileManager, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSHTTPCookieStorage = objc.getClass("NSHTTPCookieStorage"); -late final _sel_sharedHTTPCookieStorage = - objc.registerName("sharedHTTPCookieStorage"); -late final _sel_sharedCookieStorageForGroupContainerIdentifier_ = - objc.registerName("sharedCookieStorageForGroupContainerIdentifier:"); -late final _sel_cookies = objc.registerName("cookies"); -late final _class_NSHTTPCookie = objc.getClass("NSHTTPCookie"); -late final _sel_initWithProperties_ = objc.registerName("initWithProperties:"); -late final _sel_cookieWithProperties_ = - objc.registerName("cookieWithProperties:"); -late final _sel_requestHeaderFieldsWithCookies_ = - objc.registerName("requestHeaderFieldsWithCookies:"); -late final _sel_cookiesWithResponseHeaderFields_forURL_ = - objc.registerName("cookiesWithResponseHeaderFields:forURL:"); -late final _sel_properties = objc.registerName("properties"); -late final _sel_version = objc.registerName("version"); -late final _sel_value = objc.registerName("value"); -late final _sel_expiresDate = objc.registerName("expiresDate"); -late final _sel_isSessionOnly = objc.registerName("isSessionOnly"); -late final _sel_domain = objc.registerName("domain"); -late final _sel_path = objc.registerName("path"); -late final _sel_isSecure = objc.registerName("isSecure"); -late final _sel_isHTTPOnly = objc.registerName("isHTTPOnly"); -late final _sel_comment = objc.registerName("comment"); -late final _sel_commentURL = objc.registerName("commentURL"); -late final _sel_portList = objc.registerName("portList"); -late final _sel_sameSitePolicy = objc.registerName("sameSitePolicy"); - -/// NSHTTPCookie -class NSHTTPCookie extends objc.NSObject { - NSHTTPCookie._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSHTTPCookie] that points to the same underlying object as [other]. - NSHTTPCookie.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSHTTPCookie] that wraps the given raw object pointer. - NSHTTPCookie.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSHTTPCookie]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSHTTPCookie); - } - - /// initWithProperties: - NSHTTPCookie? initWithProperties_(objc.NSDictionary properties) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithProperties_, properties.ref.pointer); - return _ret.address == 0 - ? null - : NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// cookieWithProperties: - static NSHTTPCookie? cookieWithProperties_(objc.NSDictionary properties) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookie, - _sel_cookieWithProperties_, properties.ref.pointer); - return _ret.address == 0 - ? null - : NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } - - /// requestHeaderFieldsWithCookies: - static objc.NSDictionary requestHeaderFieldsWithCookies_( - objc.NSArray cookies) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookie, - _sel_requestHeaderFieldsWithCookies_, cookies.ref.pointer); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// cookiesWithResponseHeaderFields:forURL: - static objc.NSArray cookiesWithResponseHeaderFields_forURL_( - objc.NSDictionary headerFields, objc.NSURL URL) { - final _ret = _objc_msgSend_iq11qg( - _class_NSHTTPCookie, - _sel_cookiesWithResponseHeaderFields_forURL_, - headerFields.ref.pointer, - URL.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// properties - objc.NSDictionary? get properties { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_properties); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// version - int get version { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_version); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// value - objc.NSString get value { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// expiresDate - objc.NSDate? get expiresDate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_expiresDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// isSessionOnly - bool get sessionOnly { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSessionOnly); - } - - /// domain - objc.NSString get domain { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_domain); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// path - objc.NSString get path { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_path); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isSecure - bool get secure { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSecure); - } - - /// isHTTPOnly - bool get HTTPOnly { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isHTTPOnly); - } - - /// comment - objc.NSString? get comment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_comment); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// commentURL - objc.NSURL? get commentURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commentURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// portList - objc.NSArray? get portList { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_portList); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// sameSitePolicy - objc.NSString? get sameSitePolicy { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sameSitePolicy); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSHTTPCookie init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSHTTPCookie new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookie, _sel_new); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSHTTPCookie allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSHTTPCookie, _sel_allocWithZone_, zone); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSHTTPCookie alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookie, _sel_alloc); - return NSHTTPCookie.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSHTTPCookie, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSHTTPCookie, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSHTTPCookie, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSHTTPCookie, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookie, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSHTTPCookie, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSHTTPCookie, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookie, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookie, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSHTTPCookie self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSHTTPCookie retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSHTTPCookie autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSHTTPCookie.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_setCookie_ = objc.registerName("setCookie:"); -late final _sel_deleteCookie_ = objc.registerName("deleteCookie:"); -late final _sel_removeCookiesSinceDate_ = - objc.registerName("removeCookiesSinceDate:"); -late final _sel_cookiesForURL_ = objc.registerName("cookiesForURL:"); -late final _sel_setCookies_forURL_mainDocumentURL_ = - objc.registerName("setCookies:forURL:mainDocumentURL:"); -final _objc_msgSend_tenbla = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); - -enum NSHTTPCookieAcceptPolicy { - NSHTTPCookieAcceptPolicyAlways(0), - NSHTTPCookieAcceptPolicyNever(1), - NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain(2); - - final int value; - const NSHTTPCookieAcceptPolicy(this.value); - - static NSHTTPCookieAcceptPolicy fromValue(int value) => switch (value) { - 0 => NSHTTPCookieAcceptPolicyAlways, - 1 => NSHTTPCookieAcceptPolicyNever, - 2 => NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain, - _ => throw ArgumentError( - "Unknown value for NSHTTPCookieAcceptPolicy: $value"), - }; -} - -late final _sel_cookieAcceptPolicy = objc.registerName("cookieAcceptPolicy"); -final _objc_msgSend_1jpuqgg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setCookieAcceptPolicy_ = - objc.registerName("setCookieAcceptPolicy:"); -final _objc_msgSend_199e8fv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_sortedCookiesUsingDescriptors_ = - objc.registerName("sortedCookiesUsingDescriptors:"); -late final _class_NSURLSessionTask = objc.getClass("NSURLSessionTask"); -late final _sel_isEqual_ = objc.registerName("isEqual:"); -bool _ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_objcObjCObject_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCObject_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCObject_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. -abstract final class ObjCBlock_bool_ffiVoid_objcObjCObject { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_objcObjCObject_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer)> - fromFunction( - bool Function(ffi.Pointer, objc.ObjCObjectBase) fn) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_bool_ffiVoid_objcObjCObject_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, objc.ObjCObjectBase(arg1, retain: true, release: true))), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. -extension ObjCBlock_bool_ffiVoid_objcObjCObject_CallExtension on objc.ObjCBlock< - ffi.Bool Function(ffi.Pointer, ffi.Pointer)> { - bool call(ffi.Pointer arg0, objc.ObjCObjectBase arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer); -} - -late final _sel_class = objc.registerName("class"); -late final _sel_performSelector_ = objc.registerName("performSelector:"); -final _objc_msgSend_12790oz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer) fn) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, arg1).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_CallExtension - on objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, ffi.Pointer arg1) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0, arg1), - retain: true, - release: true); -} - -late final _sel_performSelector_withObject_ = - objc.registerName("performSelector:withObject:"); -final _objc_msgSend_1g3ang8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer, objc.ObjCObjectBase) fn) => - objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn(arg0, arg1, objc.ObjCObjectBase(arg2, retain: true, release: true)) - .ref - .retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_CallExtension - on objc.ObjCBlock< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> { - objc.ObjCObjectBase call(ffi.Pointer arg0, - ffi.Pointer arg1, objc.ObjCObjectBase arg2) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0, arg1, arg2.ref.pointer), - retain: true, - release: true); -} - -late final _sel_performSelector_withObject_withObject_ = - objc.registerName("performSelector:withObject:withObject:"); -final _objc_msgSend_1f2tuqz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => - objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer, objc.ObjCObjectBase, objc.ObjCObjectBase) fn) => - objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3) => - fn(arg0, arg1, objc.ObjCObjectBase(arg2, retain: true, release: true), objc.ObjCObjectBase(arg3, retain: true, release: true)) - .ref - .retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_objcObjCObject_objcObjCObject_CallExtension - on objc.ObjCBlock< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, - ffi.Pointer arg1, - objc.ObjCObjectBase arg2, - objc.ObjCObjectBase arg3) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2, - ffi.Pointer arg3)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0, arg1, arg2.ref.pointer, arg3.ref.pointer), - retain: true, - release: true); -} - -late final _sel_isProxy = objc.registerName("isProxy"); -late final _sel_isMemberOfClass_ = objc.registerName("isMemberOfClass:"); -late final _sel_conformsToProtocol_ = objc.registerName("conformsToProtocol:"); -bool _ObjCBlock_bool_ffiVoid_Protocol_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_Protocol_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_Protocol_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_Protocol_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_Protocol_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_Protocol_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock, objc.Protocol)>`. -abstract final class ObjCBlock_bool_ffiVoid_Protocol { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock, objc.Protocol)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Bool Function(ffi.Pointer, - objc.Protocol)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.Protocol)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, objc.Protocol)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_Protocol_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, objc.Protocol)> - fromFunction(bool Function(ffi.Pointer, objc.Protocol) fn) => - objc.ObjCBlock, objc.Protocol)>( - objc.newClosureBlock( - _ObjCBlock_bool_ffiVoid_Protocol_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn( - arg0, - objc.Protocol.castFromPointer(arg1, - retain: true, release: true))), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, objc.Protocol)>`. -extension ObjCBlock_bool_ffiVoid_Protocol_CallExtension - on objc.ObjCBlock, objc.Protocol)> { - bool call(ffi.Pointer arg0, objc.Protocol arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer); -} - -late final _sel_respondsToSelector_ = objc.registerName("respondsToSelector:"); -final _objc_msgSend_8d7dvc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -bool _ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrTrampoline, false) - .cast(); -bool _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as bool Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureCallable = - ffi.Pointer.fromFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureTrampoline, false) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. -abstract final class ObjCBlock_bool_ffiVoid_objcObjCSelector { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_objcObjCSelector_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock, ffi.Pointer)> - fromFunction(bool Function(ffi.Pointer, ffi.Pointer) fn) => - objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>( - objc.newClosureBlock( - _ObjCBlock_bool_ffiVoid_objcObjCSelector_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, arg1)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. -extension ObjCBlock_bool_ffiVoid_objcObjCSelector_CallExtension - on objc.ObjCBlock< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)> { - bool call(ffi.Pointer arg0, ffi.Pointer arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0, arg1); -} - -late final _sel_release = objc.registerName("release"); -void _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiVoid_ffiVoid_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_ffiVoid_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_ffiVoid_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_ffiVoid_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - void Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock(_ObjCBlock_ffiVoid_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock)> listener( - void Function(ffi.Pointer) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_ffiVoid_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_hepzs(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock)>(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_ffiVoid_CallExtension - on objc.ObjCBlock)> { - void call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_retainCount = objc.registerName("retainCount"); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrTrampoline, 0) - .cast(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiUnsignedLong_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(int Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiUnsignedLong_ffiVoid_CallExtension - on objc.ObjCBlock)> { - int call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_zone = objc.registerName("zone"); -final _objc_msgSend_j04r6g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>(); -ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSZone_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer<_NSZone> Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSZone_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSZone_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. -abstract final class ObjCBlock_NSZone_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock Function(ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock Function(ffi.Pointer)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_NSZone_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunction(ffi.Pointer<_NSZone> Function(ffi.Pointer) fn) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newClosureBlock(_ObjCBlock_NSZone_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. -extension ObjCBlock_NSZone_ffiVoid_CallExtension - on objc.ObjCBlock Function(ffi.Pointer)> { - ffi.Pointer<_NSZone> call(ffi.Pointer arg0) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -late final _sel_hash = objc.registerName("hash"); -late final _sel_superclass = objc.registerName("superclass"); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSString_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSString_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSString_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSString_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock(_ObjCBlock_NSString_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(objc.NSString Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSString_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSString_ffiVoid_CallExtension - on objc.ObjCBlock)> { - objc.NSString call(ffi.Pointer arg0) => - objc.NSString.castFromPointer( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -late final _sel_debugDescription = objc.registerName("debugDescription"); -late final _sel_progress = objc.registerName("progress"); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSProgress_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSProgress_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSProgress_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_NSProgress_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(NSProgress Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSProgress_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSProgress_ffiVoid_CallExtension - on objc.ObjCBlock)> { - NSProgress call(ffi.Pointer arg0) => NSProgress.castFromPointer( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -late final _sel_taskIdentifier = objc.registerName("taskIdentifier"); -late final _class_NSURLRequest = objc.getClass("NSURLRequest"); -late final _sel_requestWithURL_ = objc.registerName("requestWithURL:"); - -enum NSURLRequestCachePolicy { - NSURLRequestUseProtocolCachePolicy(0), - NSURLRequestReloadIgnoringLocalCacheData(1), - NSURLRequestReloadIgnoringLocalAndRemoteCacheData(4), - NSURLRequestReturnCacheDataElseLoad(2), - NSURLRequestReturnCacheDataDontLoad(3), - NSURLRequestReloadRevalidatingCacheData(5); - - static const NSURLRequestReloadIgnoringCacheData = - NSURLRequestReloadIgnoringLocalCacheData; - - final int value; - const NSURLRequestCachePolicy(this.value); - - static NSURLRequestCachePolicy fromValue(int value) => switch (value) { - 0 => NSURLRequestUseProtocolCachePolicy, - 1 => NSURLRequestReloadIgnoringLocalCacheData, - 4 => NSURLRequestReloadIgnoringLocalAndRemoteCacheData, - 2 => NSURLRequestReturnCacheDataElseLoad, - 3 => NSURLRequestReturnCacheDataDontLoad, - 5 => NSURLRequestReloadRevalidatingCacheData, - _ => throw ArgumentError( - "Unknown value for NSURLRequestCachePolicy: $value"), - }; - - @override - String toString() { - if (this == NSURLRequestReloadIgnoringLocalCacheData) - return "NSURLRequestCachePolicy.NSURLRequestReloadIgnoringLocalCacheData, NSURLRequestCachePolicy.NSURLRequestReloadIgnoringCacheData"; - return super.toString(); - } -} - -late final _sel_requestWithURL_cachePolicy_timeoutInterval_ = - objc.registerName("requestWithURL:cachePolicy:timeoutInterval:"); -final _objc_msgSend_191svj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Double)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - double)>(); -late final _sel_initWithURL_cachePolicy_timeoutInterval_ = - objc.registerName("initWithURL:cachePolicy:timeoutInterval:"); -late final _sel_URL = objc.registerName("URL"); -late final _sel_cachePolicy = objc.registerName("cachePolicy"); -final _objc_msgSend_2xak1q = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_timeoutInterval = objc.registerName("timeoutInterval"); -late final _sel_mainDocumentURL = objc.registerName("mainDocumentURL"); - -enum NSURLRequestNetworkServiceType { - NSURLNetworkServiceTypeDefault(0), - NSURLNetworkServiceTypeVoIP(1), - NSURLNetworkServiceTypeVideo(2), - NSURLNetworkServiceTypeBackground(3), - NSURLNetworkServiceTypeVoice(4), - NSURLNetworkServiceTypeResponsiveData(6), - NSURLNetworkServiceTypeAVStreaming(8), - NSURLNetworkServiceTypeResponsiveAV(9), - NSURLNetworkServiceTypeCallSignaling(11); - - final int value; - const NSURLRequestNetworkServiceType(this.value); - - static NSURLRequestNetworkServiceType fromValue(int value) => switch (value) { - 0 => NSURLNetworkServiceTypeDefault, - 1 => NSURLNetworkServiceTypeVoIP, - 2 => NSURLNetworkServiceTypeVideo, - 3 => NSURLNetworkServiceTypeBackground, - 4 => NSURLNetworkServiceTypeVoice, - 6 => NSURLNetworkServiceTypeResponsiveData, - 8 => NSURLNetworkServiceTypeAVStreaming, - 9 => NSURLNetworkServiceTypeResponsiveAV, - 11 => NSURLNetworkServiceTypeCallSignaling, - _ => throw ArgumentError( - "Unknown value for NSURLRequestNetworkServiceType: $value"), - }; -} - -late final _sel_networkServiceType = objc.registerName("networkServiceType"); -final _objc_msgSend_ttt73t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_allowsCellularAccess = - objc.registerName("allowsCellularAccess"); -late final _sel_allowsExpensiveNetworkAccess = - objc.registerName("allowsExpensiveNetworkAccess"); -late final _sel_allowsConstrainedNetworkAccess = - objc.registerName("allowsConstrainedNetworkAccess"); -late final _sel_assumesHTTP3Capable = objc.registerName("assumesHTTP3Capable"); - -enum NSURLRequestAttribution { - NSURLRequestAttributionDeveloper(0), - NSURLRequestAttributionUser(1); - - final int value; - const NSURLRequestAttribution(this.value); - - static NSURLRequestAttribution fromValue(int value) => switch (value) { - 0 => NSURLRequestAttributionDeveloper, - 1 => NSURLRequestAttributionUser, - _ => throw ArgumentError( - "Unknown value for NSURLRequestAttribution: $value"), - }; -} - -late final _sel_attribution = objc.registerName("attribution"); -final _objc_msgSend_t5yka9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_requiresDNSSECValidation = - objc.registerName("requiresDNSSECValidation"); -late final _sel_HTTPMethod = objc.registerName("HTTPMethod"); -late final _sel_allHTTPHeaderFields = objc.registerName("allHTTPHeaderFields"); -late final _sel_valueForHTTPHeaderField_ = - objc.registerName("valueForHTTPHeaderField:"); -late final _sel_HTTPBody = objc.registerName("HTTPBody"); -late final _sel_HTTPBodyStream = objc.registerName("HTTPBodyStream"); -late final _sel_HTTPShouldHandleCookies = - objc.registerName("HTTPShouldHandleCookies"); -late final _sel_HTTPShouldUsePipelining = - objc.registerName("HTTPShouldUsePipelining"); - -/// NSURLRequest -class NSURLRequest extends objc.NSObject { - NSURLRequest._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLRequest] that points to the same underlying object as [other]. - NSURLRequest.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLRequest] that wraps the given raw object pointer. - NSURLRequest.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLRequest]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLRequest); - } - - /// requestWithURL: - static NSURLRequest requestWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - _class_NSURLRequest, _sel_requestWithURL_, URL.ref.pointer); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool getSupportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSURLRequest, _sel_supportsSecureCoding); - } - - /// requestWithURL:cachePolicy:timeoutInterval: - static NSURLRequest requestWithURL_cachePolicy_timeoutInterval_( - objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, - double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - _class_NSURLRequest, - _sel_requestWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithURL: - NSURLRequest initWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, URL.ref.pointer); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithURL:cachePolicy:timeoutInterval: - NSURLRequest initWithURL_cachePolicy_timeoutInterval_(objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// cachePolicy - NSURLRequestCachePolicy get cachePolicy { - final _ret = _objc_msgSend_2xak1q(this.ref.pointer, _sel_cachePolicy); - return NSURLRequestCachePolicy.fromValue(_ret); - } - - /// timeoutInterval - double get timeoutInterval { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_timeoutInterval) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeoutInterval); - } - - /// mainDocumentURL - objc.NSURL? get mainDocumentURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mainDocumentURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// networkServiceType - NSURLRequestNetworkServiceType get networkServiceType { - final _ret = - _objc_msgSend_ttt73t(this.ref.pointer, _sel_networkServiceType); - return NSURLRequestNetworkServiceType.fromValue(_ret); - } - - /// allowsCellularAccess - bool get allowsCellularAccess { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsCellularAccess); - } - - /// allowsExpensiveNetworkAccess - bool get allowsExpensiveNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExpensiveNetworkAccess); - } - - /// allowsConstrainedNetworkAccess - bool get allowsConstrainedNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsConstrainedNetworkAccess); - } - - /// assumesHTTP3Capable - bool get assumesHTTP3Capable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_assumesHTTP3Capable); - } - - /// attribution - NSURLRequestAttribution get attribution { - final _ret = _objc_msgSend_t5yka9(this.ref.pointer, _sel_attribution); - return NSURLRequestAttribution.fromValue(_ret); - } - - /// requiresDNSSECValidation - bool get requiresDNSSECValidation { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_requiresDNSSECValidation); - } - - /// HTTPMethod - objc.NSString? get HTTPMethod { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPMethod); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// allHTTPHeaderFields - objc.NSDictionary? get allHTTPHeaderFields { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allHTTPHeaderFields); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// valueForHTTPHeaderField: - objc.NSString? valueForHTTPHeaderField_(objc.NSString field) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_valueForHTTPHeaderField_, field.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// HTTPBody - objc.NSData? get HTTPBody { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBody); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// HTTPBodyStream - objc.NSInputStream? get HTTPBodyStream { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBodyStream); - return _ret.address == 0 - ? null - : objc.NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// HTTPShouldHandleCookies - bool get HTTPShouldHandleCookies { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldHandleCookies); - } - - /// HTTPShouldUsePipelining - bool get HTTPShouldUsePipelining { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldUsePipelining); - } - - /// init - NSURLRequest init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLRequest new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLRequest, _sel_new); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLRequest allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLRequest, _sel_allocWithZone_, zone); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLRequest alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLRequest, _sel_alloc); - return NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLRequest, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLRequest, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLRequest, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLRequest, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLRequest, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLRequest, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLRequest, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLRequest self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLRequest retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLRequest autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLRequest? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLRequest.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_originalRequest = objc.registerName("originalRequest"); -late final _sel_currentRequest = objc.registerName("currentRequest"); -late final _class_NSURLResponse = objc.getClass("NSURLResponse"); -late final _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_ = - objc.registerName( - "initWithURL:MIMEType:expectedContentLength:textEncodingName:"); -final _objc_msgSend_eyseqq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_MIMEType = objc.registerName("MIMEType"); -late final _sel_expectedContentLength = - objc.registerName("expectedContentLength"); -final _objc_msgSend_e94jsr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.LongLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_textEncodingName = objc.registerName("textEncodingName"); -late final _sel_suggestedFilename = objc.registerName("suggestedFilename"); - -/// NSURLResponse -class NSURLResponse extends objc.NSObject { - NSURLResponse._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLResponse] that points to the same underlying object as [other]. - NSURLResponse.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLResponse] that wraps the given raw object pointer. - NSURLResponse.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLResponse]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLResponse); - } - - /// initWithURL:MIMEType:expectedContentLength:textEncodingName: - NSURLResponse initWithURL_MIMEType_expectedContentLength_textEncodingName_( - objc.NSURL URL, - objc.NSString? MIMEType, - int length, - objc.NSString? name) { - final _ret = _objc_msgSend_eyseqq( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_, - URL.ref.pointer, - MIMEType?.ref.pointer ?? ffi.nullptr, - length, - name?.ref.pointer ?? ffi.nullptr); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// MIMEType - objc.NSString? get MIMEType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_MIMEType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// expectedContentLength - int get expectedContentLength { - return _objc_msgSend_e94jsr(this.ref.pointer, _sel_expectedContentLength); - } - - /// textEncodingName - objc.NSString? get textEncodingName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_textEncodingName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// suggestedFilename - objc.NSString? get suggestedFilename { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suggestedFilename); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLResponse init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLResponse new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLResponse, _sel_new); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLResponse allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLResponse, _sel_allocWithZone_, zone); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLResponse alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLResponse, _sel_alloc); - return NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLResponse, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLResponse, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLResponse, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLResponse, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLResponse, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLResponse, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLResponse, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLResponse self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLResponse retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLResponse autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSURLResponse, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLResponse? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLResponse.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _sel_response = objc.registerName("response"); -late final _sel_earliestBeginDate = objc.registerName("earliestBeginDate"); -late final _sel_setEarliestBeginDate_ = - objc.registerName("setEarliestBeginDate:"); -late final _sel_countOfBytesClientExpectsToSend = - objc.registerName("countOfBytesClientExpectsToSend"); -late final _sel_setCountOfBytesClientExpectsToSend_ = - objc.registerName("setCountOfBytesClientExpectsToSend:"); -late final _sel_countOfBytesClientExpectsToReceive = - objc.registerName("countOfBytesClientExpectsToReceive"); -late final _sel_setCountOfBytesClientExpectsToReceive_ = - objc.registerName("setCountOfBytesClientExpectsToReceive:"); -late final _sel_countOfBytesSent = objc.registerName("countOfBytesSent"); -late final _sel_countOfBytesReceived = - objc.registerName("countOfBytesReceived"); -late final _sel_countOfBytesExpectedToSend = - objc.registerName("countOfBytesExpectedToSend"); -late final _sel_countOfBytesExpectedToReceive = - objc.registerName("countOfBytesExpectedToReceive"); -late final _sel_taskDescription = objc.registerName("taskDescription"); -late final _sel_setTaskDescription_ = objc.registerName("setTaskDescription:"); - -enum NSURLSessionTaskState { - NSURLSessionTaskStateRunning(0), - NSURLSessionTaskStateSuspended(1), - NSURLSessionTaskStateCanceling(2), - NSURLSessionTaskStateCompleted(3); - - final int value; - const NSURLSessionTaskState(this.value); - - static NSURLSessionTaskState fromValue(int value) => switch (value) { - 0 => NSURLSessionTaskStateRunning, - 1 => NSURLSessionTaskStateSuspended, - 2 => NSURLSessionTaskStateCanceling, - 3 => NSURLSessionTaskStateCompleted, - _ => throw ArgumentError( - "Unknown value for NSURLSessionTaskState: $value"), - }; -} - -late final _sel_state = objc.registerName("state"); -final _objc_msgSend_8b7yc1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_error = objc.registerName("error"); -late final _sel_suspend = objc.registerName("suspend"); -late final _sel_priority = objc.registerName("priority"); -final _objc_msgSend_fcilgx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_fcilgxFpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPriority_ = objc.registerName("setPriority:"); -final _objc_msgSend_s9gjzc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Float)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, double)>(); -late final _sel_prefersIncrementalDelivery = - objc.registerName("prefersIncrementalDelivery"); -late final _sel_setPrefersIncrementalDelivery_ = - objc.registerName("setPrefersIncrementalDelivery:"); - -/// NSURLSessionTask -class NSURLSessionTask extends objc.NSObject { - NSURLSessionTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionTask] that points to the same underlying object as [other]. - NSURLSessionTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionTask] that wraps the given raw object pointer. - NSURLSessionTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionTask); - } - - /// taskIdentifier - int get taskIdentifier { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_taskIdentifier); - } - - /// originalRequest - NSURLRequest? get originalRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_originalRequest); - return _ret.address == 0 - ? null - : NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// currentRequest - NSURLRequest? get currentRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentRequest); - return _ret.address == 0 - ? null - : NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// response - NSURLResponse? get response { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_response); - return _ret.address == 0 - ? null - : NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// progress - NSProgress get progress { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_progress); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// earliestBeginDate - objc.NSDate? get earliestBeginDate { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_earliestBeginDate); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setEarliestBeginDate: - set earliestBeginDate(objc.NSDate? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setEarliestBeginDate_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// countOfBytesClientExpectsToSend - int get countOfBytesClientExpectsToSend { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesClientExpectsToSend); - } - - /// setCountOfBytesClientExpectsToSend: - set countOfBytesClientExpectsToSend(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setCountOfBytesClientExpectsToSend_, value); - } - - /// countOfBytesClientExpectsToReceive - int get countOfBytesClientExpectsToReceive { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesClientExpectsToReceive); - } - - /// setCountOfBytesClientExpectsToReceive: - set countOfBytesClientExpectsToReceive(int value) { - return _objc_msgSend_rrr3q( - this.ref.pointer, _sel_setCountOfBytesClientExpectsToReceive_, value); - } - - /// countOfBytesSent - int get countOfBytesSent { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_countOfBytesSent); - } - - /// countOfBytesReceived - int get countOfBytesReceived { - return _objc_msgSend_1voti03(this.ref.pointer, _sel_countOfBytesReceived); - } - - /// countOfBytesExpectedToSend - int get countOfBytesExpectedToSend { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesExpectedToSend); - } - - /// countOfBytesExpectedToReceive - int get countOfBytesExpectedToReceive { - return _objc_msgSend_1voti03( - this.ref.pointer, _sel_countOfBytesExpectedToReceive); - } - - /// taskDescription - objc.NSString? get taskDescription { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_taskDescription); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setTaskDescription: - set taskDescription(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setTaskDescription_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// state - NSURLSessionTaskState get state { - final _ret = _objc_msgSend_8b7yc1(this.ref.pointer, _sel_state); - return NSURLSessionTaskState.fromValue(_ret); - } - - /// error - objc.NSError? get error { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_error); - return _ret.address == 0 - ? null - : objc.NSError.castFromPointer(_ret, retain: true, release: true); - } - - /// suspend - void suspend() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_suspend); - } - - /// resume - void resume() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resume); - } - - /// priority - double get priority { - return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_priority) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_priority); - } - - /// setPriority: - set priority(double value) { - return _objc_msgSend_s9gjzc(this.ref.pointer, _sel_setPriority_, value); - } - - /// prefersIncrementalDelivery - bool get prefersIncrementalDelivery { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_prefersIncrementalDelivery); - } - - /// setPrefersIncrementalDelivery: - set prefersIncrementalDelivery(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setPrefersIncrementalDelivery_, value); - } - - /// init - NSURLSessionTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLSessionTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionTask, _sel_new); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionTask, _sel_allocWithZone_, zone); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLSessionTask alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionTask, _sel_alloc); - return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLSessionTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLSessionTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_storeCookies_forTask_ = - objc.registerName("storeCookies:forTask:"); -void _ObjCBlock_ffiVoid_NSArray_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSArray_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSArray_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSArray { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSArray_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSArray?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSArray.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSArray?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSArray.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSArray_CallExtension - on objc.ObjCBlock { - void call(objc.NSArray? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getCookiesForTask_completionHandler_ = - objc.registerName("getCookiesForTask:completionHandler:"); - -/// NSHTTPCookieStorage -class NSHTTPCookieStorage extends objc.NSObject { - NSHTTPCookieStorage._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSHTTPCookieStorage] that points to the same underlying object as [other]. - NSHTTPCookieStorage.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSHTTPCookieStorage] that wraps the given raw object pointer. - NSHTTPCookieStorage.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSHTTPCookieStorage]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSHTTPCookieStorage); - } - - /// sharedHTTPCookieStorage - static NSHTTPCookieStorage getSharedHTTPCookieStorage() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookieStorage, _sel_sharedHTTPCookieStorage); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// sharedCookieStorageForGroupContainerIdentifier: - static NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier_( - objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7( - _class_NSHTTPCookieStorage, - _sel_sharedCookieStorageForGroupContainerIdentifier_, - identifier.ref.pointer); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// cookies - objc.NSArray? get cookies { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_cookies); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setCookie: - void setCookie_(NSHTTPCookie cookie) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCookie_, cookie.ref.pointer); - } - - /// deleteCookie: - void deleteCookie_(NSHTTPCookie cookie) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_deleteCookie_, cookie.ref.pointer); - } - - /// removeCookiesSinceDate: - void removeCookiesSinceDate_(objc.NSDate date) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeCookiesSinceDate_, date.ref.pointer); - } - - /// cookiesForURL: - objc.NSArray? cookiesForURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_cookiesForURL_, URL.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setCookies:forURL:mainDocumentURL: - void setCookies_forURL_mainDocumentURL_( - objc.NSArray cookies, objc.NSURL? URL, objc.NSURL? mainDocumentURL) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_setCookies_forURL_mainDocumentURL_, - cookies.ref.pointer, - URL?.ref.pointer ?? ffi.nullptr, - mainDocumentURL?.ref.pointer ?? ffi.nullptr); - } - - /// cookieAcceptPolicy - NSHTTPCookieAcceptPolicy get cookieAcceptPolicy { - final _ret = - _objc_msgSend_1jpuqgg(this.ref.pointer, _sel_cookieAcceptPolicy); - return NSHTTPCookieAcceptPolicy.fromValue(_ret); - } - - /// setCookieAcceptPolicy: - set cookieAcceptPolicy(NSHTTPCookieAcceptPolicy value) { - return _objc_msgSend_199e8fv( - this.ref.pointer, _sel_setCookieAcceptPolicy_, value.value); - } - - /// sortedCookiesUsingDescriptors: - objc.NSArray sortedCookiesUsingDescriptors_(objc.NSArray sortOrder) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_sortedCookiesUsingDescriptors_, sortOrder.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// storeCookies:forTask: - void storeCookies_forTask_(objc.NSArray cookies, NSURLSessionTask task) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_storeCookies_forTask_, - cookies.ref.pointer, task.ref.pointer); - } - - /// getCookiesForTask:completionHandler: - void getCookiesForTask_completionHandler_(NSURLSessionTask task, - objc.ObjCBlock completionHandler) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_getCookiesForTask_completionHandler_, - task.ref.pointer, - completionHandler.ref.pointer); - } - - /// init - NSHTTPCookieStorage init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSHTTPCookieStorage new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookieStorage, _sel_new); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSHTTPCookieStorage allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSHTTPCookieStorage, _sel_allocWithZone_, zone); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSHTTPCookieStorage alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHTTPCookieStorage, _sel_alloc); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSHTTPCookieStorage, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSHTTPCookieStorage, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSHTTPCookieStorage, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSHTTPCookieStorage, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSHTTPCookieStorage, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSHTTPCookieStorage, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSHTTPCookieStorage, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookieStorage, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHTTPCookieStorage, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSHTTPCookieStorage self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSHTTPCookieStorage retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSHTTPCookieStorage autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _class_NSIndexPath = objc.getClass("NSIndexPath"); -late final _sel_indexPathWithIndex_ = objc.registerName("indexPathWithIndex:"); -late final _sel_indexPathWithIndexes_length_ = - objc.registerName("indexPathWithIndexes:length:"); -final _objc_msgSend_1educny = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_initWithIndexes_length_ = - objc.registerName("initWithIndexes:length:"); -late final _sel_initWithIndex_ = objc.registerName("initWithIndex:"); -late final _sel_indexPathByAddingIndex_ = - objc.registerName("indexPathByAddingIndex:"); -late final _sel_indexPathByRemovingLastIndex = - objc.registerName("indexPathByRemovingLastIndex"); -late final _sel_indexAtPosition_ = objc.registerName("indexAtPosition:"); -final _objc_msgSend_1eigyr6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_getIndexes_range_ = objc.registerName("getIndexes:range:"); -final _objc_msgSend_oxe0mk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - objc.NSRange)>(); -late final _sel_getIndexes_ = objc.registerName("getIndexes:"); -final _objc_msgSend_v7ntkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - -/// NSIndexPath -class NSIndexPath extends objc.NSObject { - NSIndexPath._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSIndexPath] that points to the same underlying object as [other]. - NSIndexPath.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSIndexPath] that wraps the given raw object pointer. - NSIndexPath.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSIndexPath]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSIndexPath); - } - - /// indexPathWithIndex: - static NSIndexPath indexPathWithIndex_(int index) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSIndexPath, _sel_indexPathWithIndex_, index); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// indexPathWithIndexes:length: - static NSIndexPath indexPathWithIndexes_length_( - ffi.Pointer indexes, int length) { - final _ret = _objc_msgSend_1educny( - _class_NSIndexPath, _sel_indexPathWithIndexes_length_, indexes, length); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithIndexes:length: - NSIndexPath initWithIndexes_length_( - ffi.Pointer indexes, int length) { - final _ret = _objc_msgSend_1educny(this.ref.retainAndReturnPointer(), - _sel_initWithIndexes_length_, indexes, length); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithIndex: - NSIndexPath initWithIndex_(int index) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.retainAndReturnPointer(), _sel_initWithIndex_, index); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// indexPathByAddingIndex: - NSIndexPath indexPathByAddingIndex_(int index) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_indexPathByAddingIndex_, index); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// indexPathByRemovingLastIndex - NSIndexPath indexPathByRemovingLastIndex() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_indexPathByRemovingLastIndex); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// indexAtPosition: - int indexAtPosition_(int position) { - return _objc_msgSend_1eigyr6( - this.ref.pointer, _sel_indexAtPosition_, position); - } - - /// length - int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); - } - - /// getIndexes:range: - void getIndexes_range_( - ffi.Pointer indexes, objc.NSRange positionRange) { - _objc_msgSend_oxe0mk( - this.ref.pointer, _sel_getIndexes_range_, indexes, positionRange); - } - - /// compare: - objc.NSComparisonResult compare_(NSIndexPath otherObject) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_compare_, otherObject.ref.pointer); - return objc.NSComparisonResult.fromValue(_ret); - } - - /// getIndexes: - void getIndexes_(ffi.Pointer indexes) { - _objc_msgSend_v7ntkj(this.ref.pointer, _sel_getIndexes_, indexes); - } - - /// init - NSIndexPath init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSIndexPath new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexPath, _sel_new); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSIndexPath allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSIndexPath, _sel_allocWithZone_, zone); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSIndexPath alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexPath, _sel_alloc); - return NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSIndexPath, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSIndexPath, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSIndexPath, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSIndexPath, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSIndexPath, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSIndexPath, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSIndexPath, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSIndexPath, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSIndexPath, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSIndexPath self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSIndexPath retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSIndexPath autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSIndexPath.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSIndexPath, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSIndexPath? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSIndexPath.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSInflectionRule = objc.getClass("NSInflectionRule"); -late final _sel_automaticRule = objc.registerName("automaticRule"); -late final _sel_canInflectLanguage_ = objc.registerName("canInflectLanguage:"); -late final _sel_canInflectPreferredLocalization = - objc.registerName("canInflectPreferredLocalization"); - -/// NSInflectionRule -class NSInflectionRule extends objc.NSObject { - NSInflectionRule._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSInflectionRule] that points to the same underlying object as [other]. - NSInflectionRule.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSInflectionRule] that wraps the given raw object pointer. - NSInflectionRule.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSInflectionRule]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSInflectionRule); - } - - /// init - NSInflectionRule init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// automaticRule - static NSInflectionRule getAutomaticRule() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSInflectionRule, _sel_automaticRule); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// canInflectLanguage: - static bool canInflectLanguage_(objc.NSString language) { - return _objc_msgSend_l8lotg(_class_NSInflectionRule, - _sel_canInflectLanguage_, language.ref.pointer); - } - - /// canInflectPreferredLocalization - static bool getCanInflectPreferredLocalization() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_canInflectPreferredLocalization); - } - - /// new - static NSInflectionRule new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSInflectionRule, _sel_new); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSInflectionRule allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSInflectionRule, _sel_allocWithZone_, zone); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSInflectionRule alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSInflectionRule, _sel_alloc); - return NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSInflectionRule, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSInflectionRule, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSInflectionRule, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSInflectionRule, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSInflectionRule, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSInflectionRule, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSInflectionRule, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSInflectionRule self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSInflectionRule retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSInflectionRule autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSInflectionRule.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSInflectionRule, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSInflectionRule? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSInflectionRule.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSMorphology = objc.getClass("NSMorphology"); - -enum NSGrammaticalGender { - NSGrammaticalGenderNotSet(0), - NSGrammaticalGenderFeminine(1), - NSGrammaticalGenderMasculine(2), - NSGrammaticalGenderNeuter(3); - - final int value; - const NSGrammaticalGender(this.value); - - static NSGrammaticalGender fromValue(int value) => switch (value) { - 0 => NSGrammaticalGenderNotSet, - 1 => NSGrammaticalGenderFeminine, - 2 => NSGrammaticalGenderMasculine, - 3 => NSGrammaticalGenderNeuter, - _ => - throw ArgumentError("Unknown value for NSGrammaticalGender: $value"), - }; -} - -late final _sel_grammaticalGender = objc.registerName("grammaticalGender"); -final _objc_msgSend_y3dgf1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setGrammaticalGender_ = - objc.registerName("setGrammaticalGender:"); -final _objc_msgSend_12a9bks = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalPartOfSpeech { - NSGrammaticalPartOfSpeechNotSet(0), - NSGrammaticalPartOfSpeechDeterminer(1), - NSGrammaticalPartOfSpeechPronoun(2), - NSGrammaticalPartOfSpeechLetter(3), - NSGrammaticalPartOfSpeechAdverb(4), - NSGrammaticalPartOfSpeechParticle(5), - NSGrammaticalPartOfSpeechAdjective(6), - NSGrammaticalPartOfSpeechAdposition(7), - NSGrammaticalPartOfSpeechVerb(8), - NSGrammaticalPartOfSpeechNoun(9), - NSGrammaticalPartOfSpeechConjunction(10), - NSGrammaticalPartOfSpeechNumeral(11), - NSGrammaticalPartOfSpeechInterjection(12), - NSGrammaticalPartOfSpeechPreposition(13), - NSGrammaticalPartOfSpeechAbbreviation(14); - - final int value; - const NSGrammaticalPartOfSpeech(this.value); - - static NSGrammaticalPartOfSpeech fromValue(int value) => switch (value) { - 0 => NSGrammaticalPartOfSpeechNotSet, - 1 => NSGrammaticalPartOfSpeechDeterminer, - 2 => NSGrammaticalPartOfSpeechPronoun, - 3 => NSGrammaticalPartOfSpeechLetter, - 4 => NSGrammaticalPartOfSpeechAdverb, - 5 => NSGrammaticalPartOfSpeechParticle, - 6 => NSGrammaticalPartOfSpeechAdjective, - 7 => NSGrammaticalPartOfSpeechAdposition, - 8 => NSGrammaticalPartOfSpeechVerb, - 9 => NSGrammaticalPartOfSpeechNoun, - 10 => NSGrammaticalPartOfSpeechConjunction, - 11 => NSGrammaticalPartOfSpeechNumeral, - 12 => NSGrammaticalPartOfSpeechInterjection, - 13 => NSGrammaticalPartOfSpeechPreposition, - 14 => NSGrammaticalPartOfSpeechAbbreviation, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalPartOfSpeech: $value"), - }; -} - -late final _sel_partOfSpeech = objc.registerName("partOfSpeech"); -final _objc_msgSend_vk5e30 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPartOfSpeech_ = objc.registerName("setPartOfSpeech:"); -final _objc_msgSend_1k6p0ib = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalNumber { - NSGrammaticalNumberNotSet(0), - NSGrammaticalNumberSingular(1), - NSGrammaticalNumberZero(2), - NSGrammaticalNumberPlural(3), - NSGrammaticalNumberPluralTwo(4), - NSGrammaticalNumberPluralFew(5), - NSGrammaticalNumberPluralMany(6); - - final int value; - const NSGrammaticalNumber(this.value); - - static NSGrammaticalNumber fromValue(int value) => switch (value) { - 0 => NSGrammaticalNumberNotSet, - 1 => NSGrammaticalNumberSingular, - 2 => NSGrammaticalNumberZero, - 3 => NSGrammaticalNumberPlural, - 4 => NSGrammaticalNumberPluralTwo, - 5 => NSGrammaticalNumberPluralFew, - 6 => NSGrammaticalNumberPluralMany, - _ => - throw ArgumentError("Unknown value for NSGrammaticalNumber: $value"), - }; -} - -late final _sel_number = objc.registerName("number"); -final _objc_msgSend_1lu1qy9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setNumber_ = objc.registerName("setNumber:"); -final _objc_msgSend_kwz1vc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalCase { - NSGrammaticalCaseNotSet(0), - NSGrammaticalCaseNominative(1), - NSGrammaticalCaseAccusative(2), - NSGrammaticalCaseDative(3), - NSGrammaticalCaseGenitive(4), - NSGrammaticalCasePrepositional(5), - NSGrammaticalCaseAblative(6), - NSGrammaticalCaseAdessive(7), - NSGrammaticalCaseAllative(8), - NSGrammaticalCaseElative(9), - NSGrammaticalCaseIllative(10), - NSGrammaticalCaseEssive(11), - NSGrammaticalCaseInessive(12), - NSGrammaticalCaseLocative(13), - NSGrammaticalCaseTranslative(14); - - final int value; - const NSGrammaticalCase(this.value); - - static NSGrammaticalCase fromValue(int value) => switch (value) { - 0 => NSGrammaticalCaseNotSet, - 1 => NSGrammaticalCaseNominative, - 2 => NSGrammaticalCaseAccusative, - 3 => NSGrammaticalCaseDative, - 4 => NSGrammaticalCaseGenitive, - 5 => NSGrammaticalCasePrepositional, - 6 => NSGrammaticalCaseAblative, - 7 => NSGrammaticalCaseAdessive, - 8 => NSGrammaticalCaseAllative, - 9 => NSGrammaticalCaseElative, - 10 => NSGrammaticalCaseIllative, - 11 => NSGrammaticalCaseEssive, - 12 => NSGrammaticalCaseInessive, - 13 => NSGrammaticalCaseLocative, - 14 => NSGrammaticalCaseTranslative, - _ => throw ArgumentError("Unknown value for NSGrammaticalCase: $value"), - }; -} - -late final _sel_grammaticalCase = objc.registerName("grammaticalCase"); -final _objc_msgSend_1xz5l6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setGrammaticalCase_ = objc.registerName("setGrammaticalCase:"); -final _objc_msgSend_erklvx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalDetermination { - NSGrammaticalDeterminationNotSet(0), - NSGrammaticalDeterminationIndependent(1), - NSGrammaticalDeterminationDependent(2); - - final int value; - const NSGrammaticalDetermination(this.value); - - static NSGrammaticalDetermination fromValue(int value) => switch (value) { - 0 => NSGrammaticalDeterminationNotSet, - 1 => NSGrammaticalDeterminationIndependent, - 2 => NSGrammaticalDeterminationDependent, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalDetermination: $value"), - }; -} - -late final _sel_determination = objc.registerName("determination"); -final _objc_msgSend_18c2fg3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDetermination_ = objc.registerName("setDetermination:"); -final _objc_msgSend_ug05wa = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalPerson { - NSGrammaticalPersonNotSet(0), - NSGrammaticalPersonFirst(1), - NSGrammaticalPersonSecond(2), - NSGrammaticalPersonThird(3); - - final int value; - const NSGrammaticalPerson(this.value); - - static NSGrammaticalPerson fromValue(int value) => switch (value) { - 0 => NSGrammaticalPersonNotSet, - 1 => NSGrammaticalPersonFirst, - 2 => NSGrammaticalPersonSecond, - 3 => NSGrammaticalPersonThird, - _ => - throw ArgumentError("Unknown value for NSGrammaticalPerson: $value"), - }; -} - -late final _sel_grammaticalPerson = objc.registerName("grammaticalPerson"); -final _objc_msgSend_1ffoin9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setGrammaticalPerson_ = - objc.registerName("setGrammaticalPerson:"); -final _objc_msgSend_ae3g2g = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalPronounType { - NSGrammaticalPronounTypeNotSet(0), - NSGrammaticalPronounTypePersonal(1), - NSGrammaticalPronounTypeReflexive(2), - NSGrammaticalPronounTypePossessive(3); - - final int value; - const NSGrammaticalPronounType(this.value); - - static NSGrammaticalPronounType fromValue(int value) => switch (value) { - 0 => NSGrammaticalPronounTypeNotSet, - 1 => NSGrammaticalPronounTypePersonal, - 2 => NSGrammaticalPronounTypeReflexive, - 3 => NSGrammaticalPronounTypePossessive, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalPronounType: $value"), - }; -} - -late final _sel_pronounType = objc.registerName("pronounType"); -final _objc_msgSend_17hihkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setPronounType_ = objc.registerName("setPronounType:"); -final _objc_msgSend_1trhr2m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSGrammaticalDefiniteness { - NSGrammaticalDefinitenessNotSet(0), - NSGrammaticalDefinitenessIndefinite(1), - NSGrammaticalDefinitenessDefinite(2); - - final int value; - const NSGrammaticalDefiniteness(this.value); - - static NSGrammaticalDefiniteness fromValue(int value) => switch (value) { - 0 => NSGrammaticalDefinitenessNotSet, - 1 => NSGrammaticalDefinitenessIndefinite, - 2 => NSGrammaticalDefinitenessDefinite, - _ => throw ArgumentError( - "Unknown value for NSGrammaticalDefiniteness: $value"), - }; -} - -late final _sel_definiteness = objc.registerName("definiteness"); -final _objc_msgSend_gnbhg7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDefiniteness_ = objc.registerName("setDefiniteness:"); -final _objc_msgSend_vbzknq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _class_NSMorphologyCustomPronoun = - objc.getClass("NSMorphologyCustomPronoun"); -late final _sel_isSupportedForLanguage_ = - objc.registerName("isSupportedForLanguage:"); -late final _sel_requiredKeysForLanguage_ = - objc.registerName("requiredKeysForLanguage:"); -late final _sel_subjectForm = objc.registerName("subjectForm"); -late final _sel_setSubjectForm_ = objc.registerName("setSubjectForm:"); -late final _sel_objectForm = objc.registerName("objectForm"); -late final _sel_setObjectForm_ = objc.registerName("setObjectForm:"); -late final _sel_possessiveForm = objc.registerName("possessiveForm"); -late final _sel_setPossessiveForm_ = objc.registerName("setPossessiveForm:"); -late final _sel_possessiveAdjectiveForm = - objc.registerName("possessiveAdjectiveForm"); -late final _sel_setPossessiveAdjectiveForm_ = - objc.registerName("setPossessiveAdjectiveForm:"); -late final _sel_reflexiveForm = objc.registerName("reflexiveForm"); -late final _sel_setReflexiveForm_ = objc.registerName("setReflexiveForm:"); - -/// NSMorphologyCustomPronoun -class NSMorphologyCustomPronoun extends objc.NSObject { - NSMorphologyCustomPronoun._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMorphologyCustomPronoun] that points to the same underlying object as [other]. - NSMorphologyCustomPronoun.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMorphologyCustomPronoun] that wraps the given raw object pointer. - NSMorphologyCustomPronoun.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMorphologyCustomPronoun]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMorphologyCustomPronoun); - } - - /// isSupportedForLanguage: - static bool isSupportedForLanguage_(objc.NSString language) { - return _objc_msgSend_l8lotg(_class_NSMorphologyCustomPronoun, - _sel_isSupportedForLanguage_, language.ref.pointer); - } - - /// requiredKeysForLanguage: - static objc.NSArray requiredKeysForLanguage_(objc.NSString language) { - final _ret = _objc_msgSend_juohf7(_class_NSMorphologyCustomPronoun, - _sel_requiredKeysForLanguage_, language.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// subjectForm - objc.NSString? get subjectForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_subjectForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSubjectForm: - set subjectForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setSubjectForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// objectForm - objc.NSString? get objectForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setObjectForm: - set objectForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setObjectForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// possessiveForm - objc.NSString? get possessiveForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_possessiveForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPossessiveForm: - set possessiveForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setPossessiveForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// possessiveAdjectiveForm - objc.NSString? get possessiveAdjectiveForm { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_possessiveAdjectiveForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPossessiveAdjectiveForm: - set possessiveAdjectiveForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setPossessiveAdjectiveForm_, value?.ref.pointer ?? ffi.nullptr); - } - - /// reflexiveForm - objc.NSString? get reflexiveForm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reflexiveForm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setReflexiveForm: - set reflexiveForm(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setReflexiveForm_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// init - NSMorphologyCustomPronoun init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSMorphologyCustomPronoun new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMorphologyCustomPronoun, _sel_new); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSMorphologyCustomPronoun allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMorphologyCustomPronoun, _sel_allocWithZone_, zone); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSMorphologyCustomPronoun alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMorphologyCustomPronoun, _sel_alloc); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMorphologyCustomPronoun, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMorphologyCustomPronoun, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMorphologyCustomPronoun, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSMorphologyCustomPronoun, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMorphologyCustomPronoun, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMorphologyCustomPronoun, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMorphologyCustomPronoun, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphologyCustomPronoun, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphologyCustomPronoun, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMorphologyCustomPronoun self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSMorphologyCustomPronoun retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSMorphologyCustomPronoun autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMorphologyCustomPronoun, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSMorphologyCustomPronoun? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_customPronounForLanguage_ = - objc.registerName("customPronounForLanguage:"); -late final _sel_setCustomPronoun_forLanguage_error_ = - objc.registerName("setCustomPronoun:forLanguage:error:"); -late final _sel_isUnspecified = objc.registerName("isUnspecified"); -late final _sel_userMorphology = objc.registerName("userMorphology"); - -/// NSMorphology -class NSMorphology extends objc.NSObject { - NSMorphology._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMorphology] that points to the same underlying object as [other]. - NSMorphology.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMorphology] that wraps the given raw object pointer. - NSMorphology.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMorphology]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMorphology); - } - - /// grammaticalGender - NSGrammaticalGender get grammaticalGender { - final _ret = _objc_msgSend_y3dgf1(this.ref.pointer, _sel_grammaticalGender); - return NSGrammaticalGender.fromValue(_ret); - } - - /// setGrammaticalGender: - set grammaticalGender(NSGrammaticalGender value) { - return _objc_msgSend_12a9bks( - this.ref.pointer, _sel_setGrammaticalGender_, value.value); - } - - /// partOfSpeech - NSGrammaticalPartOfSpeech get partOfSpeech { - final _ret = _objc_msgSend_vk5e30(this.ref.pointer, _sel_partOfSpeech); - return NSGrammaticalPartOfSpeech.fromValue(_ret); - } - - /// setPartOfSpeech: - set partOfSpeech(NSGrammaticalPartOfSpeech value) { - return _objc_msgSend_1k6p0ib( - this.ref.pointer, _sel_setPartOfSpeech_, value.value); - } - - /// number - NSGrammaticalNumber get number { - final _ret = _objc_msgSend_1lu1qy9(this.ref.pointer, _sel_number); - return NSGrammaticalNumber.fromValue(_ret); - } - - /// setNumber: - set number(NSGrammaticalNumber value) { - return _objc_msgSend_kwz1vc(this.ref.pointer, _sel_setNumber_, value.value); - } - - /// grammaticalCase - NSGrammaticalCase get grammaticalCase { - final _ret = _objc_msgSend_1xz5l6(this.ref.pointer, _sel_grammaticalCase); - return NSGrammaticalCase.fromValue(_ret); - } - - /// setGrammaticalCase: - set grammaticalCase(NSGrammaticalCase value) { - return _objc_msgSend_erklvx( - this.ref.pointer, _sel_setGrammaticalCase_, value.value); - } - - /// determination - NSGrammaticalDetermination get determination { - final _ret = _objc_msgSend_18c2fg3(this.ref.pointer, _sel_determination); - return NSGrammaticalDetermination.fromValue(_ret); - } - - /// setDetermination: - set determination(NSGrammaticalDetermination value) { - return _objc_msgSend_ug05wa( - this.ref.pointer, _sel_setDetermination_, value.value); - } - - /// grammaticalPerson - NSGrammaticalPerson get grammaticalPerson { - final _ret = - _objc_msgSend_1ffoin9(this.ref.pointer, _sel_grammaticalPerson); - return NSGrammaticalPerson.fromValue(_ret); - } - - /// setGrammaticalPerson: - set grammaticalPerson(NSGrammaticalPerson value) { - return _objc_msgSend_ae3g2g( - this.ref.pointer, _sel_setGrammaticalPerson_, value.value); - } - - /// pronounType - NSGrammaticalPronounType get pronounType { - final _ret = _objc_msgSend_17hihkj(this.ref.pointer, _sel_pronounType); - return NSGrammaticalPronounType.fromValue(_ret); - } - - /// setPronounType: - set pronounType(NSGrammaticalPronounType value) { - return _objc_msgSend_1trhr2m( - this.ref.pointer, _sel_setPronounType_, value.value); - } - - /// definiteness - NSGrammaticalDefiniteness get definiteness { - final _ret = _objc_msgSend_gnbhg7(this.ref.pointer, _sel_definiteness); - return NSGrammaticalDefiniteness.fromValue(_ret); - } - - /// setDefiniteness: - set definiteness(NSGrammaticalDefiniteness value) { - return _objc_msgSend_vbzknq( - this.ref.pointer, _sel_setDefiniteness_, value.value); - } - - /// customPronounForLanguage: - NSMorphologyCustomPronoun? customPronounForLanguage_(objc.NSString language) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_customPronounForLanguage_, language.ref.pointer); - return _ret.address == 0 - ? null - : NSMorphologyCustomPronoun.castFromPointer(_ret, - retain: true, release: true); - } - - /// setCustomPronoun:forLanguage:error: - bool setCustomPronoun_forLanguage_error_(NSMorphologyCustomPronoun? features, - objc.NSString language, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( - this.ref.pointer, - _sel_setCustomPronoun_forLanguage_error_, - features?.ref.pointer ?? ffi.nullptr, - language.ref.pointer, - error); - } - - /// isUnspecified - bool get unspecified { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isUnspecified); - } - - /// userMorphology - static NSMorphology getUserMorphology() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSMorphology, _sel_userMorphology); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSMorphology init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSMorphology new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMorphology, _sel_new); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSMorphology allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSMorphology, _sel_allocWithZone_, zone); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSMorphology alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMorphology, _sel_alloc); - return NSMorphology.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMorphology, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMorphology, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMorphology, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSMorphology, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMorphology, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMorphology, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMorphology, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphology, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMorphology, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMorphology self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSMorphology retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSMorphology autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMorphology.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSMorphology, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSMorphology? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMorphology.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSOperationQueue = objc.getClass("NSOperationQueue"); -late final _class_NSOperation = objc.getClass("NSOperation"); -late final _sel_start = objc.registerName("start"); -late final _sel_main = objc.registerName("main"); -late final _sel_isExecuting = objc.registerName("isExecuting"); -late final _sel_isConcurrent = objc.registerName("isConcurrent"); -late final _sel_isAsynchronous = objc.registerName("isAsynchronous"); -late final _sel_isReady = objc.registerName("isReady"); -late final _sel_addDependency_ = objc.registerName("addDependency:"); -late final _sel_removeDependency_ = objc.registerName("removeDependency:"); -late final _sel_dependencies = objc.registerName("dependencies"); - -enum NSOperationQueuePriority { - NSOperationQueuePriorityVeryLow(-8), - NSOperationQueuePriorityLow(-4), - NSOperationQueuePriorityNormal(0), - NSOperationQueuePriorityHigh(4), - NSOperationQueuePriorityVeryHigh(8); - - final int value; - const NSOperationQueuePriority(this.value); - - static NSOperationQueuePriority fromValue(int value) => switch (value) { - -8 => NSOperationQueuePriorityVeryLow, - -4 => NSOperationQueuePriorityLow, - 0 => NSOperationQueuePriorityNormal, - 4 => NSOperationQueuePriorityHigh, - 8 => NSOperationQueuePriorityVeryHigh, - _ => throw ArgumentError( - "Unknown value for NSOperationQueuePriority: $value"), - }; -} - -late final _sel_queuePriority = objc.registerName("queuePriority"); -final _objc_msgSend_10n15g8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setQueuePriority_ = objc.registerName("setQueuePriority:"); -final _objc_msgSend_d8yjnr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_completionBlock = objc.registerName("completionBlock"); -late final _sel_setCompletionBlock_ = objc.registerName("setCompletionBlock:"); -late final _sel_waitUntilFinished = objc.registerName("waitUntilFinished"); -late final _sel_threadPriority = objc.registerName("threadPriority"); -late final _sel_setThreadPriority_ = objc.registerName("setThreadPriority:"); -final _objc_msgSend_suh039 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Double)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, double)>(); - -enum NSQualityOfService { - NSQualityOfServiceUserInteractive(33), - NSQualityOfServiceUserInitiated(25), - NSQualityOfServiceUtility(17), - NSQualityOfServiceBackground(9), - NSQualityOfServiceDefault(-1); - - final int value; - const NSQualityOfService(this.value); - - static NSQualityOfService fromValue(int value) => switch (value) { - 33 => NSQualityOfServiceUserInteractive, - 25 => NSQualityOfServiceUserInitiated, - 17 => NSQualityOfServiceUtility, - 9 => NSQualityOfServiceBackground, - -1 => NSQualityOfServiceDefault, - _ => - throw ArgumentError("Unknown value for NSQualityOfService: $value"), - }; -} - -late final _sel_qualityOfService = objc.registerName("qualityOfService"); -final _objc_msgSend_17dnyeh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setQualityOfService_ = - objc.registerName("setQualityOfService:"); -final _objc_msgSend_1fcr8u4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setName_ = objc.registerName("setName:"); - -/// NSOperation -class NSOperation extends objc.NSObject { - NSOperation._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSOperation] that points to the same underlying object as [other]. - NSOperation.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSOperation] that wraps the given raw object pointer. - NSOperation.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSOperation]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSOperation); - } - - /// start - void start() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_start); - } - - /// main - void main() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_main); - } - - /// isCancelled - bool get cancelled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isCancelled); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// isExecuting - bool get executing { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isExecuting); - } - - /// isFinished - bool get finished { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isFinished); - } - - /// isConcurrent - bool get concurrent { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isConcurrent); - } - - /// isAsynchronous - bool get asynchronous { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isAsynchronous); - } - - /// isReady - bool get ready { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isReady); - } - - /// addDependency: - void addDependency_(NSOperation op) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addDependency_, op.ref.pointer); - } - - /// removeDependency: - void removeDependency_(NSOperation op) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeDependency_, op.ref.pointer); - } - - /// dependencies - objc.NSArray get dependencies { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dependencies); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// queuePriority - NSOperationQueuePriority get queuePriority { - final _ret = _objc_msgSend_10n15g8(this.ref.pointer, _sel_queuePriority); - return NSOperationQueuePriority.fromValue(_ret); - } - - /// setQueuePriority: - set queuePriority(NSOperationQueuePriority value) { - return _objc_msgSend_d8yjnr( - this.ref.pointer, _sel_setQueuePriority_, value.value); - } - - /// completionBlock - objc.ObjCBlock? get completionBlock { - final _ret = _objc_msgSend_2osec1(this.ref.pointer, _sel_completionBlock); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid.castFromPointer(_ret, retain: true, release: true); - } - - /// setCompletionBlock: - set completionBlock(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setCompletionBlock_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// waitUntilFinished - void waitUntilFinished() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_waitUntilFinished); - } - - /// threadPriority - double get threadPriority { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_threadPriority) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_threadPriority); - } - - /// setThreadPriority: - set threadPriority(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setThreadPriority_, value); - } - - /// qualityOfService - NSQualityOfService get qualityOfService { - final _ret = _objc_msgSend_17dnyeh(this.ref.pointer, _sel_qualityOfService); - return NSQualityOfService.fromValue(_ret); - } - - /// setQualityOfService: - set qualityOfService(NSQualityOfService value) { - return _objc_msgSend_1fcr8u4( - this.ref.pointer, _sel_setQualityOfService_, value.value); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setName: - set name(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); - } - - /// init - NSOperation init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSOperation new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperation, _sel_new); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSOperation allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSOperation, _sel_allocWithZone_, zone); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSOperation alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperation, _sel_alloc); - return NSOperation.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSOperation, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSOperation, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSOperation, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSOperation, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOperation, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSOperation, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSOperation, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOperation, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSOperation, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSOperation self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSOperation.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSOperation retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSOperation.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSOperation autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSOperation.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_addOperation_ = objc.registerName("addOperation:"); -late final _sel_addOperations_waitUntilFinished_ = - objc.registerName("addOperations:waitUntilFinished:"); -final _objc_msgSend_1n1qwdd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_addOperationWithBlock_ = - objc.registerName("addOperationWithBlock:"); -late final _sel_addBarrierBlock_ = objc.registerName("addBarrierBlock:"); -late final _sel_maxConcurrentOperationCount = - objc.registerName("maxConcurrentOperationCount"); -late final _sel_setMaxConcurrentOperationCount_ = - objc.registerName("setMaxConcurrentOperationCount:"); -late final _sel_isSuspended = objc.registerName("isSuspended"); -late final _sel_setSuspended_ = objc.registerName("setSuspended:"); -late final _sel_underlyingQueue = objc.registerName("underlyingQueue"); -late final _sel_setUnderlyingQueue_ = objc.registerName("setUnderlyingQueue:"); -late final _sel_cancelAllOperations = objc.registerName("cancelAllOperations"); -late final _sel_waitUntilAllOperationsAreFinished = - objc.registerName("waitUntilAllOperationsAreFinished"); -late final _sel_currentQueue = objc.registerName("currentQueue"); -late final _sel_mainQueue = objc.registerName("mainQueue"); -late final _sel_operations = objc.registerName("operations"); -late final _sel_operationCount = objc.registerName("operationCount"); - -/// NSOperationQueue -class NSOperationQueue extends objc.NSObject { - NSOperationQueue._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSOperationQueue] that points to the same underlying object as [other]. - NSOperationQueue.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSOperationQueue] that wraps the given raw object pointer. - NSOperationQueue.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSOperationQueue]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSOperationQueue); - } - - /// progress - NSProgress get progress { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_progress); - return NSProgress.castFromPointer(_ret, retain: true, release: true); - } - - /// addOperation: - void addOperation_(NSOperation op) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addOperation_, op.ref.pointer); - } - - /// addOperations:waitUntilFinished: - void addOperations_waitUntilFinished_(objc.NSArray ops, bool wait) { - _objc_msgSend_1n1qwdd(this.ref.pointer, - _sel_addOperations_waitUntilFinished_, ops.ref.pointer, wait); - } - - /// addOperationWithBlock: - void addOperationWithBlock_(objc.ObjCBlock block) { - _objc_msgSend_4daxhl( - this.ref.pointer, _sel_addOperationWithBlock_, block.ref.pointer); - } - - /// addBarrierBlock: - void addBarrierBlock_(objc.ObjCBlock barrier) { - _objc_msgSend_4daxhl( - this.ref.pointer, _sel_addBarrierBlock_, barrier.ref.pointer); - } - - /// maxConcurrentOperationCount - int get maxConcurrentOperationCount { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_maxConcurrentOperationCount); - } - - /// setMaxConcurrentOperationCount: - set maxConcurrentOperationCount(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setMaxConcurrentOperationCount_, value); - } - - /// isSuspended - bool get suspended { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSuspended); - } - - /// setSuspended: - set suspended(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setSuspended_, value); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setName: - set name(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); - } - - /// qualityOfService - NSQualityOfService get qualityOfService { - final _ret = _objc_msgSend_17dnyeh(this.ref.pointer, _sel_qualityOfService); - return NSQualityOfService.fromValue(_ret); - } - - /// setQualityOfService: - set qualityOfService(NSQualityOfService value) { - return _objc_msgSend_1fcr8u4( - this.ref.pointer, _sel_setQualityOfService_, value.value); - } - - /// underlyingQueue - objc.NSObject? get underlyingQueue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_underlyingQueue); - return _ret.address == 0 - ? null - : objc.NSObject.castFromPointer(_ret, retain: true, release: true); - } - - /// setUnderlyingQueue: - set underlyingQueue(objc.NSObject? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setUnderlyingQueue_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// cancelAllOperations - void cancelAllOperations() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancelAllOperations); - } - - /// waitUntilAllOperationsAreFinished - void waitUntilAllOperationsAreFinished() { - _objc_msgSend_ksby9f( - this.ref.pointer, _sel_waitUntilAllOperationsAreFinished); - } - - /// currentQueue - static NSOperationQueue? getCurrentQueue() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_currentQueue); - return _ret.address == 0 - ? null - : NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// mainQueue - static NSOperationQueue getMainQueue() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_mainQueue); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// operations - objc.NSArray get operations { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_operations); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// operationCount - int get operationCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_operationCount); - } - - /// init - NSOperationQueue init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSOperationQueue new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_new); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSOperationQueue allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSOperationQueue, _sel_allocWithZone_, zone); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSOperationQueue alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOperationQueue, _sel_alloc); - return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSOperationQueue, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSOperationQueue, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSOperationQueue, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSOperationQueue, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOperationQueue, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSOperationQueue, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSOperationQueue, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOperationQueue, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOperationQueue, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSOperationQueue self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSOperationQueue retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSOperationQueue autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSOrthography = objc.getClass("NSOrthography"); -late final _sel_dominantScript = objc.registerName("dominantScript"); -late final _sel_languageMap = objc.registerName("languageMap"); -late final _sel_initWithDominantScript_languageMap_ = - objc.registerName("initWithDominantScript:languageMap:"); -late final _sel_languagesForScript_ = objc.registerName("languagesForScript:"); -late final _sel_dominantLanguageForScript_ = - objc.registerName("dominantLanguageForScript:"); -late final _sel_dominantLanguage = objc.registerName("dominantLanguage"); -late final _sel_allScripts = objc.registerName("allScripts"); -late final _sel_allLanguages = objc.registerName("allLanguages"); -late final _sel_defaultOrthographyForLanguage_ = - objc.registerName("defaultOrthographyForLanguage:"); -late final _sel_orthographyWithDominantScript_languageMap_ = - objc.registerName("orthographyWithDominantScript:languageMap:"); - -/// NSOrthography -class NSOrthography extends objc.NSObject { - NSOrthography._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSOrthography] that points to the same underlying object as [other]. - NSOrthography.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSOrthography] that wraps the given raw object pointer. - NSOrthography.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSOrthography]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSOrthography); - } - - /// dominantScript - objc.NSString get dominantScript { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dominantScript); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// languageMap - objc.NSDictionary get languageMap { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_languageMap); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithDominantScript:languageMap: - NSOrthography initWithDominantScript_languageMap_( - objc.NSString script, objc.NSDictionary map) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithDominantScript_languageMap_, - script.ref.pointer, - map.ref.pointer); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSOrthography? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// languagesForScript: - objc.NSArray? languagesForScript_(objc.NSString script) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_languagesForScript_, script.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// dominantLanguageForScript: - objc.NSString? dominantLanguageForScript_(objc.NSString script) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dominantLanguageForScript_, script.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dominantLanguage - objc.NSString get dominantLanguage { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dominantLanguage); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// allScripts - objc.NSArray get allScripts { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allScripts); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allLanguages - objc.NSArray get allLanguages { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allLanguages); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultOrthographyForLanguage: - static NSOrthography defaultOrthographyForLanguage_(objc.NSString language) { - final _ret = _objc_msgSend_juohf7(_class_NSOrthography, - _sel_defaultOrthographyForLanguage_, language.ref.pointer); - return NSOrthography.castFromPointer(_ret, retain: true, release: true); - } - - /// orthographyWithDominantScript:languageMap: - static NSOrthography orthographyWithDominantScript_languageMap_( - objc.NSString script, objc.NSDictionary map) { - final _ret = _objc_msgSend_iq11qg( - _class_NSOrthography, - _sel_orthographyWithDominantScript_languageMap_, - script.ref.pointer, - map.ref.pointer); - return NSOrthography.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSOrthography init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSOrthography new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrthography, _sel_new); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSOrthography allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSOrthography, _sel_allocWithZone_, zone); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSOrthography alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrthography, _sel_alloc); - return NSOrthography.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSOrthography, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSOrthography, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSOrthography, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSOrthography, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOrthography, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSOrthography, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSOrthography, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOrthography, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSOrthography, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSOrthography, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _class_NSPointerArray = objc.getClass("NSPointerArray"); -late final _sel_countByEnumeratingWithState_objects_count_ = - objc.registerName("countByEnumeratingWithState:objects:count:"); -final _objc_msgSend_q12f7y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - ffi.UnsignedLong arg3)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>()(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrTrampoline, - 0) - .cast(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - (objc.getBlockClosure(block) as int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int))(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureTrampoline, - 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. -abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, ffi.UnsignedLong arg3)>> ptr) => - objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - objc.newPointerBlock(_ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)> fromFunction(int Function(ffi.Pointer, ffi.Pointer, ffi.Pointer>, int) fn) => - objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - objc.newClosureBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - fn(arg0, arg1, arg2, arg3)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. -extension ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_CallExtension - on objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> { - int call( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - ffi.UnsignedLong arg3)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>()(ref.pointer, arg0, arg1, arg2, arg3); -} - -enum NSPointerFunctionsOptions { - NSPointerFunctionsStrongMemory(0), - NSPointerFunctionsZeroingWeakMemory(1), - NSPointerFunctionsOpaqueMemory(2), - NSPointerFunctionsMallocMemory(3), - NSPointerFunctionsMachVirtualMemory(4), - NSPointerFunctionsWeakMemory(5), - NSPointerFunctionsOpaquePersonality(256), - NSPointerFunctionsObjectPointerPersonality(512), - NSPointerFunctionsCStringPersonality(768), - NSPointerFunctionsStructPersonality(1024), - NSPointerFunctionsIntegerPersonality(1280), - NSPointerFunctionsCopyIn(65536); - - static const NSPointerFunctionsObjectPersonality = - NSPointerFunctionsStrongMemory; - - final int value; - const NSPointerFunctionsOptions(this.value); - - static NSPointerFunctionsOptions fromValue(int value) => switch (value) { - 0 => NSPointerFunctionsStrongMemory, - 1 => NSPointerFunctionsZeroingWeakMemory, - 2 => NSPointerFunctionsOpaqueMemory, - 3 => NSPointerFunctionsMallocMemory, - 4 => NSPointerFunctionsMachVirtualMemory, - 5 => NSPointerFunctionsWeakMemory, - 256 => NSPointerFunctionsOpaquePersonality, - 512 => NSPointerFunctionsObjectPointerPersonality, - 768 => NSPointerFunctionsCStringPersonality, - 1024 => NSPointerFunctionsStructPersonality, - 1280 => NSPointerFunctionsIntegerPersonality, - 65536 => NSPointerFunctionsCopyIn, - _ => throw ArgumentError( - "Unknown value for NSPointerFunctionsOptions: $value"), - }; - - @override - String toString() { - if (this == NSPointerFunctionsStrongMemory) - return "NSPointerFunctionsOptions.NSPointerFunctionsStrongMemory, NSPointerFunctionsOptions.NSPointerFunctionsObjectPersonality"; - return super.toString(); - } -} - -late final _sel_initWithOptions_ = objc.registerName("initWithOptions:"); -final _objc_msgSend_146ksfy = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _class_NSPointerFunctions = objc.getClass("NSPointerFunctions"); -late final _sel_pointerFunctionsWithOptions_ = - objc.registerName("pointerFunctionsWithOptions:"); -late final _sel_hashFunction = objc.registerName("hashFunction"); -final _objc_msgSend_1sotwf1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer, ffi.Pointer)>>)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setHashFunction_ = objc.registerName("setHashFunction:"); -final _objc_msgSend_1oonnyk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>(); -late final _sel_isEqualFunction = objc.registerName("isEqualFunction"); -final _objc_msgSend_1xqafxe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer, ffi.Pointer, ffi.Pointer)>>)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setIsEqualFunction_ = objc.registerName("setIsEqualFunction:"); -final _objc_msgSend_1i3z8j1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>>)>(); -late final _sel_sizeFunction = objc.registerName("sizeFunction"); -final _objc_msgSend_1u1e56c = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setSizeFunction_ = objc.registerName("setSizeFunction:"); -final _objc_msgSend_10z8lan = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>(); -late final _sel_descriptionFunction = objc.registerName("descriptionFunction"); -final _objc_msgSend_1y69tkw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDescriptionFunction_ = - objc.registerName("setDescriptionFunction:"); -final _objc_msgSend_1a23vur = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>)>(); -late final _sel_relinquishFunction = objc.registerName("relinquishFunction"); -final _objc_msgSend_15kilzc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer, ffi.Pointer)>>)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setRelinquishFunction_ = - objc.registerName("setRelinquishFunction:"); -final _objc_msgSend_18u5cwv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>>)>(); -late final _sel_acquireFunction = objc.registerName("acquireFunction"); -final _objc_msgSend_y49dq4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Pointer)>>, ffi.Bool)>> Function( - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>, - ffi.Bool)>> - Function(ffi.Pointer, ffi.Pointer)>(); -late final _sel_setAcquireFunction_ = objc.registerName("setAcquireFunction:"); -final _objc_msgSend_nyyll3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>, - ffi.Bool)>>)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi - .NativeFunction)>>, - ffi.Bool)>>)>(); -late final _sel_usesStrongWriteBarrier = - objc.registerName("usesStrongWriteBarrier"); -late final _sel_setUsesStrongWriteBarrier_ = - objc.registerName("setUsesStrongWriteBarrier:"); -late final _sel_usesWeakReadAndWriteBarriers = - objc.registerName("usesWeakReadAndWriteBarriers"); -late final _sel_setUsesWeakReadAndWriteBarriers_ = - objc.registerName("setUsesWeakReadAndWriteBarriers:"); - -/// NSPointerFunctions -class NSPointerFunctions extends objc.NSObject { - NSPointerFunctions._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPointerFunctions] that points to the same underlying object as [other]. - NSPointerFunctions.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPointerFunctions] that wraps the given raw object pointer. - NSPointerFunctions.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPointerFunctions]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPointerFunctions); - } - - /// initWithOptions: - NSPointerFunctions initWithOptions_(NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy(this.ref.retainAndReturnPointer(), - _sel_initWithOptions_, options.value); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// pointerFunctionsWithOptions: - static NSPointerFunctions pointerFunctionsWithOptions_( - NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy(_class_NSPointerFunctions, - _sel_pointerFunctionsWithOptions_, options.value); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// hashFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>> - get hashFunction { - return _objc_msgSend_1sotwf1(this.ref.pointer, _sel_hashFunction); - } - - /// setHashFunction: - set hashFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - value) { - return _objc_msgSend_1oonnyk( - this.ref.pointer, _sel_setHashFunction_, value); - } - - /// isEqualFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>> - get isEqualFunction { - return _objc_msgSend_1xqafxe(this.ref.pointer, _sel_isEqualFunction); - } - - /// setIsEqualFunction: - set isEqualFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - value) { - return _objc_msgSend_1i3z8j1( - this.ref.pointer, _sel_setIsEqualFunction_, value); - } - - /// sizeFunction - ffi.Pointer< - ffi.NativeFunction)>> - get sizeFunction { - return _objc_msgSend_1u1e56c(this.ref.pointer, _sel_sizeFunction); - } - - /// setSizeFunction: - set sizeFunction( - ffi.Pointer< - ffi - .NativeFunction)>> - value) { - return _objc_msgSend_10z8lan( - this.ref.pointer, _sel_setSizeFunction_, value); - } - - /// descriptionFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>> - get descriptionFunction { - return _objc_msgSend_1y69tkw(this.ref.pointer, _sel_descriptionFunction); - } - - /// setDescriptionFunction: - set descriptionFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>> - value) { - return _objc_msgSend_1a23vur( - this.ref.pointer, _sel_setDescriptionFunction_, value); - } - - /// relinquishFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>)>> - get relinquishFunction { - return _objc_msgSend_15kilzc(this.ref.pointer, _sel_relinquishFunction); - } - - /// setRelinquishFunction: - set relinquishFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>)>> - value) { - return _objc_msgSend_18u5cwv( - this.ref.pointer, _sel_setRelinquishFunction_, value); - } - - /// acquireFunction - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer)>>, - ffi.Bool)>> get acquireFunction { - return _objc_msgSend_y49dq4(this.ref.pointer, _sel_acquireFunction); - } - - /// setAcquireFunction: - set acquireFunction( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer)>>, - ffi.Bool)>> - value) { - return _objc_msgSend_nyyll3( - this.ref.pointer, _sel_setAcquireFunction_, value); - } - - /// usesStrongWriteBarrier - bool get usesStrongWriteBarrier { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_usesStrongWriteBarrier); - } - - /// setUsesStrongWriteBarrier: - set usesStrongWriteBarrier(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesStrongWriteBarrier_, value); - } - - /// usesWeakReadAndWriteBarriers - bool get usesWeakReadAndWriteBarriers { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_usesWeakReadAndWriteBarriers); - } - - /// setUsesWeakReadAndWriteBarriers: - set usesWeakReadAndWriteBarriers(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setUsesWeakReadAndWriteBarriers_, value); - } - - /// init - NSPointerFunctions init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSPointerFunctions new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerFunctions, _sel_new); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSPointerFunctions allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSPointerFunctions, _sel_allocWithZone_, zone); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSPointerFunctions alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerFunctions, _sel_alloc); - return NSPointerFunctions.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPointerFunctions, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPointerFunctions, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPointerFunctions, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSPointerFunctions, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPointerFunctions, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPointerFunctions, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPointerFunctions, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerFunctions, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerFunctions, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSPointerFunctions self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSPointerFunctions retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSPointerFunctions autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_initWithPointerFunctions_ = - objc.registerName("initWithPointerFunctions:"); -late final _sel_pointerArrayWithOptions_ = - objc.registerName("pointerArrayWithOptions:"); -late final _sel_pointerArrayWithPointerFunctions_ = - objc.registerName("pointerArrayWithPointerFunctions:"); -late final _sel_pointerFunctions = objc.registerName("pointerFunctions"); -late final _sel_pointerAtIndex_ = objc.registerName("pointerAtIndex:"); -final _objc_msgSend_hwxa7r = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_addPointer_ = objc.registerName("addPointer:"); -final _objc_msgSend_hepzs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_removePointerAtIndex_ = - objc.registerName("removePointerAtIndex:"); -late final _sel_insertPointer_atIndex_ = - objc.registerName("insertPointer:atIndex:"); -final _objc_msgSend_vzqe8w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -late final _sel_replacePointerAtIndex_withPointer_ = - objc.registerName("replacePointerAtIndex:withPointer:"); -final _objc_msgSend_19y6iy4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int, ffi.Pointer)>(); -late final _sel_compact = objc.registerName("compact"); -late final _sel_count = objc.registerName("count"); -late final _sel_setCount_ = objc.registerName("setCount:"); -late final _sel_pointerArrayWithStrongObjects = - objc.registerName("pointerArrayWithStrongObjects"); -late final _sel_pointerArrayWithWeakObjects = - objc.registerName("pointerArrayWithWeakObjects"); -late final _sel_strongObjectsPointerArray = - objc.registerName("strongObjectsPointerArray"); -late final _sel_weakObjectsPointerArray = - objc.registerName("weakObjectsPointerArray"); -late final _sel_allObjects = objc.registerName("allObjects"); - -/// NSPointerArray -class NSPointerArray extends objc.NSObject { - NSPointerArray._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPointerArray] that points to the same underlying object as [other]. - NSPointerArray.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPointerArray] that wraps the given raw object pointer. - NSPointerArray.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPointerArray]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPointerArray); - } - - /// initWithOptions: - NSPointerArray initWithOptions_(NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy(this.ref.retainAndReturnPointer(), - _sel_initWithOptions_, options.value); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithPointerFunctions: - NSPointerArray initWithPointerFunctions_(NSPointerFunctions functions) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithPointerFunctions_, functions.ref.pointer); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// pointerArrayWithOptions: - static NSPointerArray pointerArrayWithOptions_( - NSPointerFunctionsOptions options) { - final _ret = _objc_msgSend_146ksfy( - _class_NSPointerArray, _sel_pointerArrayWithOptions_, options.value); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pointerArrayWithPointerFunctions: - static NSPointerArray pointerArrayWithPointerFunctions_( - NSPointerFunctions functions) { - final _ret = _objc_msgSend_juohf7(_class_NSPointerArray, - _sel_pointerArrayWithPointerFunctions_, functions.ref.pointer); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pointerFunctions - NSPointerFunctions get pointerFunctions { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_pointerFunctions); - return NSPointerFunctions.castFromPointer(_ret, - retain: true, release: true); - } - - /// pointerAtIndex: - ffi.Pointer pointerAtIndex_(int index) { - return _objc_msgSend_hwxa7r(this.ref.pointer, _sel_pointerAtIndex_, index); - } - - /// addPointer: - void addPointer_(ffi.Pointer pointer) { - _objc_msgSend_hepzs(this.ref.pointer, _sel_addPointer_, pointer); - } - - /// removePointerAtIndex: - void removePointerAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removePointerAtIndex_, index); - } - - /// insertPointer:atIndex: - void insertPointer_atIndex_(ffi.Pointer item, int index) { - _objc_msgSend_vzqe8w( - this.ref.pointer, _sel_insertPointer_atIndex_, item, index); - } - - /// replacePointerAtIndex:withPointer: - void replacePointerAtIndex_withPointer_( - int index, ffi.Pointer item) { - _objc_msgSend_19y6iy4( - this.ref.pointer, _sel_replacePointerAtIndex_withPointer_, index, item); - } - - /// compact - void compact() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_compact); - } - - /// count - int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); - } - - /// setCount: - set count(int value) { - return _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_setCount_, value); - } - - /// pointerArrayWithStrongObjects - static objc.ObjCObjectBase pointerArrayWithStrongObjects() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_pointerArrayWithStrongObjects); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// pointerArrayWithWeakObjects - static objc.ObjCObjectBase pointerArrayWithWeakObjects() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_pointerArrayWithWeakObjects); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// strongObjectsPointerArray - static NSPointerArray strongObjectsPointerArray() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_strongObjectsPointerArray); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// weakObjectsPointerArray - static NSPointerArray weakObjectsPointerArray() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_weakObjectsPointerArray); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allObjects - objc.NSArray get allObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allObjects); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSPointerArray init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSPointerArray new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerArray, _sel_new); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSPointerArray allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSPointerArray, _sel_allocWithZone_, zone); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSPointerArray alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPointerArray, _sel_alloc); - return NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPointerArray, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPointerArray, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPointerArray, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSPointerArray, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPointerArray, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPointerArray, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPointerArray, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPointerArray, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSPointerArray self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSPointerArray retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSPointerArray autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSPointerArray.castFromPointer(_ret, retain: true, release: true); - } - - /// countByEnumeratingWithState:objects:count: - int countByEnumeratingWithState_objects_count_( - ffi.Pointer state, - ffi.Pointer> buffer, - int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, - _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSPointerArray, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSPointerArray? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSPointerArray.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSPort = objc.getClass("NSPort"); -late final _sel_port = objc.registerName("port"); -late final _sel_invalidate = objc.registerName("invalidate"); -late final _sel_isValid = objc.registerName("isValid"); -late final _sel_scheduleInRunLoop_forMode_ = - objc.registerName("scheduleInRunLoop:forMode:"); -late final _sel_removeFromRunLoop_forMode_ = - objc.registerName("removeFromRunLoop:forMode:"); -late final _sel_reservedSpaceLength = objc.registerName("reservedSpaceLength"); -late final _sel_sendBeforeDate_components_from_reserved_ = - objc.registerName("sendBeforeDate:components:from:reserved:"); -final _objc_msgSend_1k87i90 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_sendBeforeDate_msgid_components_from_reserved_ = - objc.registerName("sendBeforeDate:msgid:components:from:reserved:"); -final _objc_msgSend_1sldtak = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _class_NSConnection = objc.getClass("NSConnection"); -late final _sel_statistics = objc.registerName("statistics"); -late final _sel_allConnections = objc.registerName("allConnections"); -late final _sel_defaultConnection = objc.registerName("defaultConnection"); -late final _sel_connectionWithRegisteredName_host_ = - objc.registerName("connectionWithRegisteredName:host:"); -late final _class_NSPortNameServer = objc.getClass("NSPortNameServer"); -late final _sel_systemDefaultPortNameServer = - objc.registerName("systemDefaultPortNameServer"); -late final _sel_portForName_ = objc.registerName("portForName:"); -late final _sel_portForName_host_ = objc.registerName("portForName:host:"); -late final _sel_registerPort_name_ = objc.registerName("registerPort:name:"); -late final _sel_removePortForName_ = objc.registerName("removePortForName:"); - -/// NSPortNameServer -class NSPortNameServer extends objc.NSObject { - NSPortNameServer._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPortNameServer] that points to the same underlying object as [other]. - NSPortNameServer.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPortNameServer] that wraps the given raw object pointer. - NSPortNameServer.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPortNameServer]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPortNameServer); - } - - /// systemDefaultPortNameServer - static NSPortNameServer systemDefaultPortNameServer() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPortNameServer, _sel_systemDefaultPortNameServer); - return NSPortNameServer.castFromPointer(_ret, retain: true, release: true); - } - - /// portForName: - NSPort? portForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_portForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// portForName:host: - NSPort? portForName_host_(objc.NSString name, objc.NSString? host) { - final _ret = _objc_msgSend_iq11qg(this.ref.pointer, _sel_portForName_host_, - name.ref.pointer, host?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// registerPort:name: - bool registerPort_name_(NSPort port, objc.NSString name) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_registerPort_name_, - port.ref.pointer, name.ref.pointer); - } - - /// removePortForName: - bool removePortForName_(objc.NSString name) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_removePortForName_, name.ref.pointer); - } - - /// init - NSPortNameServer init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSPortNameServer new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPortNameServer, _sel_new); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSPortNameServer allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSPortNameServer, _sel_allocWithZone_, zone); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSPortNameServer alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPortNameServer, _sel_alloc); - return NSPortNameServer.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPortNameServer, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPortNameServer, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPortNameServer, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSPortNameServer, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPortNameServer, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPortNameServer, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPortNameServer, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPortNameServer, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPortNameServer, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _sel_connectionWithRegisteredName_host_usingNameServer_ = - objc.registerName("connectionWithRegisteredName:host:usingNameServer:"); -late final _class_NSDistantObject = objc.getClass("NSDistantObject"); -late final _sel_proxyWithTarget_connection_ = - objc.registerName("proxyWithTarget:connection:"); -late final _sel_initWithTarget_connection_ = - objc.registerName("initWithTarget:connection:"); -late final _sel_proxyWithLocal_connection_ = - objc.registerName("proxyWithLocal:connection:"); -late final _sel_initWithLocal_connection_ = - objc.registerName("initWithLocal:connection:"); -late final _sel_setProtocolForProxy_ = - objc.registerName("setProtocolForProxy:"); -late final _sel_connectionForProxy = objc.registerName("connectionForProxy"); - -/// NSDistantObject -class NSDistantObject extends objc.NSProxy { - NSDistantObject._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSDistantObject] that points to the same underlying object as [other]. - NSDistantObject.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSDistantObject] that wraps the given raw object pointer. - NSDistantObject.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSDistantObject]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSDistantObject); - } - - /// proxyWithTarget:connection: - static objc.ObjCObjectBase? proxyWithTarget_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - _class_NSDistantObject, - _sel_proxyWithTarget_connection_, - target.ref.pointer, - connection.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// initWithTarget:connection: - NSDistantObject? initWithTarget_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithTarget_connection_, - target.ref.pointer, - connection.ref.pointer); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: false, release: true); - } - - /// proxyWithLocal:connection: - static objc.ObjCObjectBase proxyWithLocal_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - _class_NSDistantObject, - _sel_proxyWithLocal_connection_, - target.ref.pointer, - connection.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// initWithLocal:connection: - NSDistantObject initWithLocal_connection_( - objc.ObjCObjectBase target, NSConnection connection) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithLocal_connection_, - target.ref.pointer, - connection.ref.pointer); - return NSDistantObject.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSDistantObject? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: false, release: true); - } - - /// setProtocolForProxy: - void setProtocolForProxy_(objc.Protocol? proto) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setProtocolForProxy_, - proto?.ref.pointer ?? ffi.nullptr); - } - - /// connectionForProxy - NSConnection get connectionForProxy { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_connectionForProxy); - return NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// alloc - static objc.ObjCObjectBase alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDistantObject, _sel_alloc); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// self - NSDistantObject self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSDistantObject retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSDistantObject autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_rootProxyForConnectionWithRegisteredName_host_ = - objc.registerName("rootProxyForConnectionWithRegisteredName:host:"); -late final _sel_rootProxyForConnectionWithRegisteredName_host_usingNameServer_ = - objc.registerName( - "rootProxyForConnectionWithRegisteredName:host:usingNameServer:"); -late final _sel_serviceConnectionWithName_rootObject_usingNameServer_ = - objc.registerName("serviceConnectionWithName:rootObject:usingNameServer:"); -late final _sel_serviceConnectionWithName_rootObject_ = - objc.registerName("serviceConnectionWithName:rootObject:"); -late final _sel_requestTimeout = objc.registerName("requestTimeout"); -late final _sel_setRequestTimeout_ = objc.registerName("setRequestTimeout:"); -late final _sel_replyTimeout = objc.registerName("replyTimeout"); -late final _sel_setReplyTimeout_ = objc.registerName("setReplyTimeout:"); -late final _sel_rootObject = objc.registerName("rootObject"); -late final _sel_setRootObject_ = objc.registerName("setRootObject:"); -late final _sel_independentConversationQueueing = - objc.registerName("independentConversationQueueing"); -late final _sel_setIndependentConversationQueueing_ = - objc.registerName("setIndependentConversationQueueing:"); -late final _sel_rootProxy = objc.registerName("rootProxy"); -late final _sel_addRequestMode_ = objc.registerName("addRequestMode:"); -late final _sel_removeRequestMode_ = objc.registerName("removeRequestMode:"); -late final _sel_requestModes = objc.registerName("requestModes"); -late final _sel_registerName_ = objc.registerName("registerName:"); -late final _sel_registerName_withNameServer_ = - objc.registerName("registerName:withNameServer:"); -late final _sel_connectionWithReceivePort_sendPort_ = - objc.registerName("connectionWithReceivePort:sendPort:"); -late final _sel_currentConversation = objc.registerName("currentConversation"); -late final _sel_initWithReceivePort_sendPort_ = - objc.registerName("initWithReceivePort:sendPort:"); -late final _sel_sendPort = objc.registerName("sendPort"); -late final _sel_receivePort = objc.registerName("receivePort"); -late final _sel_enableMultipleThreads = - objc.registerName("enableMultipleThreads"); -late final _sel_multipleThreadsEnabled = - objc.registerName("multipleThreadsEnabled"); -late final _sel_addRunLoop_ = objc.registerName("addRunLoop:"); -late final _sel_removeRunLoop_ = objc.registerName("removeRunLoop:"); -late final _sel_runInNewThread = objc.registerName("runInNewThread"); -late final _sel_remoteObjects = objc.registerName("remoteObjects"); -late final _sel_localObjects = objc.registerName("localObjects"); -late final _sel_dispatchWithComponents_ = - objc.registerName("dispatchWithComponents:"); - -/// NSConnection -class NSConnection extends objc.NSObject { - NSConnection._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSConnection] that points to the same underlying object as [other]. - NSConnection.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSConnection] that wraps the given raw object pointer. - NSConnection.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSConnection]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSConnection); - } - - /// statistics - objc.NSDictionary get statistics { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_statistics); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// allConnections - static objc.NSArray allConnections() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSConnection, _sel_allConnections); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultConnection - static NSConnection defaultConnection() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSConnection, _sel_defaultConnection); - return NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// connectionWithRegisteredName:host: - static NSConnection? connectionWithRegisteredName_host_( - objc.NSString name, objc.NSString? hostName) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_connectionWithRegisteredName_host_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// connectionWithRegisteredName:host:usingNameServer: - static NSConnection? connectionWithRegisteredName_host_usingNameServer_( - objc.NSString name, objc.NSString? hostName, NSPortNameServer server) { - final _ret = _objc_msgSend_aud7dn( - _class_NSConnection, - _sel_connectionWithRegisteredName_host_usingNameServer_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr, - server.ref.pointer); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// rootProxyForConnectionWithRegisteredName:host: - static NSDistantObject? rootProxyForConnectionWithRegisteredName_host_( - objc.NSString name, objc.NSString? hostName) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_rootProxyForConnectionWithRegisteredName_host_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// rootProxyForConnectionWithRegisteredName:host:usingNameServer: - static NSDistantObject? - rootProxyForConnectionWithRegisteredName_host_usingNameServer_( - objc.NSString name, - objc.NSString? hostName, - NSPortNameServer server) { - final _ret = _objc_msgSend_aud7dn( - _class_NSConnection, - _sel_rootProxyForConnectionWithRegisteredName_host_usingNameServer_, - name.ref.pointer, - hostName?.ref.pointer ?? ffi.nullptr, - server.ref.pointer); - return _ret.address == 0 - ? null - : NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// serviceConnectionWithName:rootObject:usingNameServer: - static NSConnection? serviceConnectionWithName_rootObject_usingNameServer_( - objc.NSString name, objc.ObjCObjectBase root, NSPortNameServer server) { - final _ret = _objc_msgSend_aud7dn( - _class_NSConnection, - _sel_serviceConnectionWithName_rootObject_usingNameServer_, - name.ref.pointer, - root.ref.pointer, - server.ref.pointer); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// serviceConnectionWithName:rootObject: - static NSConnection? serviceConnectionWithName_rootObject_( - objc.NSString name, objc.ObjCObjectBase root) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_serviceConnectionWithName_rootObject_, - name.ref.pointer, - root.ref.pointer); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// requestTimeout - double get requestTimeout { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_requestTimeout) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_requestTimeout); - } - - /// setRequestTimeout: - set requestTimeout(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setRequestTimeout_, value); - } - - /// replyTimeout - double get replyTimeout { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_replyTimeout) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_replyTimeout); - } - - /// setReplyTimeout: - set replyTimeout(double value) { - return _objc_msgSend_suh039(this.ref.pointer, _sel_setReplyTimeout_, value); - } - - /// rootObject - objc.ObjCObjectBase? get rootObject { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setRootObject: - set rootObject(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setRootObject_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// independentConversationQueueing - bool get independentConversationQueueing { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_independentConversationQueueing); - } - - /// setIndependentConversationQueueing: - set independentConversationQueueing(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setIndependentConversationQueueing_, value); - } - - /// isValid - bool get valid { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValid); - } - - /// rootProxy - NSDistantObject get rootProxy { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootProxy); - return NSDistantObject.castFromPointer(_ret, retain: true, release: true); - } - - /// invalidate - void invalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidate); - } - - /// addRequestMode: - void addRequestMode_(objc.NSString rmode) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addRequestMode_, rmode.ref.pointer); - } - - /// removeRequestMode: - void removeRequestMode_(objc.NSString rmode) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeRequestMode_, rmode.ref.pointer); - } - - /// requestModes - objc.NSArray get requestModes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_requestModes); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// registerName: - bool registerName_(objc.NSString? name) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_registerName_, name?.ref.pointer ?? ffi.nullptr); - } - - /// registerName:withNameServer: - bool registerName_withNameServer_( - objc.NSString? name, NSPortNameServer server) { - return _objc_msgSend_1ywe6ev( - this.ref.pointer, - _sel_registerName_withNameServer_, - name?.ref.pointer ?? ffi.nullptr, - server.ref.pointer); - } - - /// connectionWithReceivePort:sendPort: - static NSConnection? connectionWithReceivePort_sendPort_( - NSPort? receivePort, NSPort? sendPort) { - final _ret = _objc_msgSend_iq11qg( - _class_NSConnection, - _sel_connectionWithReceivePort_sendPort_, - receivePort?.ref.pointer ?? ffi.nullptr, - sendPort?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// currentConversation - static objc.ObjCObjectBase? currentConversation() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSConnection, _sel_currentConversation); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// initWithReceivePort:sendPort: - NSConnection? initWithReceivePort_sendPort_( - NSPort? receivePort, NSPort? sendPort) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithReceivePort_sendPort_, - receivePort?.ref.pointer ?? ffi.nullptr, - sendPort?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// sendPort - NSPort get sendPort { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sendPort); - return NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// receivePort - NSPort get receivePort { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_receivePort); - return NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// enableMultipleThreads - void enableMultipleThreads() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_enableMultipleThreads); - } - - /// multipleThreadsEnabled - bool get multipleThreadsEnabled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_multipleThreadsEnabled); - } - - /// addRunLoop: - void addRunLoop_(objc.NSRunLoop runloop) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addRunLoop_, runloop.ref.pointer); - } - - /// removeRunLoop: - void removeRunLoop_(objc.NSRunLoop runloop) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeRunLoop_, runloop.ref.pointer); - } - - /// runInNewThread - void runInNewThread() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_runInNewThread); - } - - /// remoteObjects - objc.NSArray get remoteObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_remoteObjects); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localObjects - objc.NSArray get localObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localObjects); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// dispatchWithComponents: - void dispatchWithComponents_(objc.NSArray components) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_dispatchWithComponents_, components.ref.pointer); - } - - /// init - NSConnection init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSConnection new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSConnection, _sel_new); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSConnection allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSConnection, _sel_allocWithZone_, zone); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSConnection alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSConnection, _sel_alloc); - return NSConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSConnection, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSConnection, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSConnection, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSConnection, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSConnection, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSConnection, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSConnection, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSConnection, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSConnection, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _sel_addConnection_toRunLoop_forMode_ = - objc.registerName("addConnection:toRunLoop:forMode:"); -late final _sel_removeConnection_fromRunLoop_forMode_ = - objc.registerName("removeConnection:fromRunLoop:forMode:"); - -/// NSPort -class NSPort extends objc.NSObject { - NSPort._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSPort] that points to the same underlying object as [other]. - NSPort.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSPort] that wraps the given raw object pointer. - NSPort.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSPort]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSPort); - } - - /// port - static NSPort port() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPort, _sel_port); - return NSPort.castFromPointer(_ret, retain: true, release: true); - } - - /// invalidate - void invalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidate); - } - - /// isValid - bool get valid { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValid); - } - - /// setDelegate: - void setDelegate_(objc.ObjCObjectBase? anObject) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDelegate_, - anObject?.ref.pointer ?? ffi.nullptr); - } - - /// delegate - objc.ObjCObjectBase? delegate() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// scheduleInRunLoop:forMode: - void scheduleInRunLoop_forMode_(objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, - runLoop.ref.pointer, mode.ref.pointer); - } - - /// removeFromRunLoop:forMode: - void removeFromRunLoop_forMode_(objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeFromRunLoop_forMode_, - runLoop.ref.pointer, mode.ref.pointer); - } - - /// reservedSpaceLength - int get reservedSpaceLength { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_reservedSpaceLength); - } - - /// sendBeforeDate:components:from:reserved: - bool sendBeforeDate_components_from_reserved_( - objc.NSDate limitDate, - objc.NSMutableArray? components, - NSPort? receivePort, - int headerSpaceReserved) { - return _objc_msgSend_1k87i90( - this.ref.pointer, - _sel_sendBeforeDate_components_from_reserved_, - limitDate.ref.pointer, - components?.ref.pointer ?? ffi.nullptr, - receivePort?.ref.pointer ?? ffi.nullptr, - headerSpaceReserved); - } - - /// sendBeforeDate:msgid:components:from:reserved: - bool sendBeforeDate_msgid_components_from_reserved_( - objc.NSDate limitDate, - int msgID, - objc.NSMutableArray? components, - NSPort? receivePort, - int headerSpaceReserved) { - return _objc_msgSend_1sldtak( - this.ref.pointer, - _sel_sendBeforeDate_msgid_components_from_reserved_, - limitDate.ref.pointer, - msgID, - components?.ref.pointer ?? ffi.nullptr, - receivePort?.ref.pointer ?? ffi.nullptr, - headerSpaceReserved); - } - - /// addConnection:toRunLoop:forMode: - void addConnection_toRunLoop_forMode_( - NSConnection conn, objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_addConnection_toRunLoop_forMode_, - conn.ref.pointer, - runLoop.ref.pointer, - mode.ref.pointer); - } - - /// removeConnection:fromRunLoop:forMode: - void removeConnection_fromRunLoop_forMode_( - NSConnection conn, objc.NSRunLoop runLoop, objc.NSString mode) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_removeConnection_fromRunLoop_forMode_, - conn.ref.pointer, - runLoop.ref.pointer, - mode.ref.pointer); - } - - /// init - NSPort init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSPort new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPort, _sel_new); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSPort allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSPort, _sel_allocWithZone_, zone); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSPort alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSPort, _sel_alloc); - return NSPort.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSPort, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSPort, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSPort, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSPort, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSPort, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSPort, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSPort, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSPort, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSPort, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSPort? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSPort.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSProcessInfo = objc.getClass("NSProcessInfo"); -late final _sel_processInfo = objc.registerName("processInfo"); -late final _sel_environment = objc.registerName("environment"); -late final _sel_arguments = objc.registerName("arguments"); -late final _sel_hostName = objc.registerName("hostName"); -late final _sel_processName = objc.registerName("processName"); -late final _sel_setProcessName_ = objc.registerName("setProcessName:"); -late final _sel_processIdentifier = objc.registerName("processIdentifier"); -late final _sel_globallyUniqueString = - objc.registerName("globallyUniqueString"); -late final _sel_operatingSystem = objc.registerName("operatingSystem"); -late final _sel_operatingSystemName = objc.registerName("operatingSystemName"); -late final _sel_operatingSystemVersionString = - objc.registerName("operatingSystemVersionString"); - -final class NSOperatingSystemVersion extends ffi.Struct { - @ffi.Long() - external int majorVersion; - - @ffi.Long() - external int minorVersion; - - @ffi.Long() - external int patchVersion; -} - -late final _sel_operatingSystemVersion = - objc.registerName("operatingSystemVersion"); -final _objc_msgSend_1wzlp4e = objc.msgSendPointer - .cast< - ffi.NativeFunction< - NSOperatingSystemVersion Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - NSOperatingSystemVersion Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1wzlp4eStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_processorCount = objc.registerName("processorCount"); -late final _sel_activeProcessorCount = - objc.registerName("activeProcessorCount"); -late final _sel_physicalMemory = objc.registerName("physicalMemory"); -late final _sel_isOperatingSystemAtLeastVersion_ = - objc.registerName("isOperatingSystemAtLeastVersion:"); -final _objc_msgSend_1cw7twn = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, NSOperatingSystemVersion)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, NSOperatingSystemVersion)>(); -late final _sel_systemUptime = objc.registerName("systemUptime"); -late final _sel_disableSuddenTermination = - objc.registerName("disableSuddenTermination"); -late final _sel_enableSuddenTermination = - objc.registerName("enableSuddenTermination"); -late final _sel_disableAutomaticTermination_ = - objc.registerName("disableAutomaticTermination:"); -late final _sel_enableAutomaticTermination_ = - objc.registerName("enableAutomaticTermination:"); -late final _sel_automaticTerminationSupportEnabled = - objc.registerName("automaticTerminationSupportEnabled"); -late final _sel_setAutomaticTerminationSupportEnabled_ = - objc.registerName("setAutomaticTerminationSupportEnabled:"); - -enum NSActivityOptions { - NSActivityIdleDisplaySleepDisabled(1099511627776), - NSActivityIdleSystemSleepDisabled(1048576), - NSActivitySuddenTerminationDisabled(16384), - NSActivityAutomaticTerminationDisabled(32768), - NSActivityAnimationTrackingEnabled(35184372088832), - NSActivityTrackingEnabled(70368744177664), - NSActivityUserInitiated(16777215), - NSActivityUserInitiatedAllowingIdleSystemSleep(15728639), - NSActivityBackground(255), - NSActivityLatencyCritical(1095216660480), - NSActivityUserInteractive(1095233437695); - - final int value; - const NSActivityOptions(this.value); - - static NSActivityOptions fromValue(int value) => switch (value) { - 1099511627776 => NSActivityIdleDisplaySleepDisabled, - 1048576 => NSActivityIdleSystemSleepDisabled, - 16384 => NSActivitySuddenTerminationDisabled, - 32768 => NSActivityAutomaticTerminationDisabled, - 35184372088832 => NSActivityAnimationTrackingEnabled, - 70368744177664 => NSActivityTrackingEnabled, - 16777215 => NSActivityUserInitiated, - 15728639 => NSActivityUserInitiatedAllowingIdleSystemSleep, - 255 => NSActivityBackground, - 1095216660480 => NSActivityLatencyCritical, - 1095233437695 => NSActivityUserInteractive, - _ => throw ArgumentError("Unknown value for NSActivityOptions: $value"), - }; -} - -late final _sel_beginActivityWithOptions_reason_ = - objc.registerName("beginActivityWithOptions:reason:"); -final _objc_msgSend_1pavxqs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Uint64, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_endActivity_ = objc.registerName("endActivity:"); -late final _sel_performActivityWithOptions_reason_usingBlock_ = - objc.registerName("performActivityWithOptions:reason:usingBlock:"); -final _objc_msgSend_17597p1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Uint64, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_bool_fnPtrTrampoline( - ffi.Pointer block, bool arg0) => - block.ref.target - .cast>() - .asFunction()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Bool)>(_ObjCBlock_ffiVoid_bool_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_bool_closureTrampoline( - ffi.Pointer block, bool arg0) => - (objc.getBlockClosure(block) as void Function(bool))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Bool)>(_ObjCBlock_ffiVoid_bool_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_bool_listenerTrampoline( - ffi.Pointer block, bool arg0) { - (objc.getBlockClosure(block) as void Function(bool))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable, ffi.Bool)> - _ObjCBlock_ffiVoid_bool_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Bool)>.listener(_ObjCBlock_ffiVoid_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_bool_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(bool) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_bool_closureCallable, (bool arg0) => fn(arg0)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(bool) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_bool_listenerCallable.nativeFunction.cast(), - (bool arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_117qins(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_bool_CallExtension - on objc.ObjCBlock { - void call(bool arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, ffi.Bool arg0)>>() - .asFunction, bool)>()( - ref.pointer, arg0); -} - -late final _sel_performExpiringActivityWithReason_usingBlock_ = - objc.registerName("performExpiringActivityWithReason:usingBlock:"); -late final _sel_userName = objc.registerName("userName"); -late final _sel_fullUserName = objc.registerName("fullUserName"); - -enum NSProcessInfoThermalState { - NSProcessInfoThermalStateNominal(0), - NSProcessInfoThermalStateFair(1), - NSProcessInfoThermalStateSerious(2), - NSProcessInfoThermalStateCritical(3); - - final int value; - const NSProcessInfoThermalState(this.value); - - static NSProcessInfoThermalState fromValue(int value) => switch (value) { - 0 => NSProcessInfoThermalStateNominal, - 1 => NSProcessInfoThermalStateFair, - 2 => NSProcessInfoThermalStateSerious, - 3 => NSProcessInfoThermalStateCritical, - _ => throw ArgumentError( - "Unknown value for NSProcessInfoThermalState: $value"), - }; -} - -late final _sel_thermalState = objc.registerName("thermalState"); -final _objc_msgSend_1ssuop7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isLowPowerModeEnabled = - objc.registerName("isLowPowerModeEnabled"); -late final _sel_isMacCatalystApp = objc.registerName("isMacCatalystApp"); -late final _sel_isiOSAppOnMac = objc.registerName("isiOSAppOnMac"); - -/// NSProcessInfo -class NSProcessInfo extends objc.NSObject { - NSProcessInfo._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSProcessInfo] that points to the same underlying object as [other]. - NSProcessInfo.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSProcessInfo] that wraps the given raw object pointer. - NSProcessInfo.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSProcessInfo]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSProcessInfo); - } - - /// processInfo - static NSProcessInfo getProcessInfo() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProcessInfo, _sel_processInfo); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } - - /// environment - objc.NSDictionary get environment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_environment); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// arguments - objc.NSArray get arguments { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_arguments); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// hostName - objc.NSString get hostName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_hostName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// processName - objc.NSString get processName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_processName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setProcessName: - set processName(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setProcessName_, value.ref.pointer); - } - - /// processIdentifier - int get processIdentifier { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_processIdentifier); - } - - /// globallyUniqueString - objc.NSString get globallyUniqueString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_globallyUniqueString); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// operatingSystem - int operatingSystem() { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_operatingSystem); - } - - /// operatingSystemName - objc.NSString operatingSystemName() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_operatingSystemName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// operatingSystemVersionString - objc.NSString get operatingSystemVersionString { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_operatingSystemVersionString); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// operatingSystemVersion - NSOperatingSystemVersion get operatingSystemVersion { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1wzlp4eStret( - _ptr, this.ref.pointer, _sel_operatingSystemVersion) - : _ptr.ref = _objc_msgSend_1wzlp4e( - this.ref.pointer, _sel_operatingSystemVersion); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// processorCount - int get processorCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_processorCount); - } - - /// activeProcessorCount - int get activeProcessorCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_activeProcessorCount); - } - - /// physicalMemory - int get physicalMemory { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_physicalMemory); - } - - /// isOperatingSystemAtLeastVersion: - bool isOperatingSystemAtLeastVersion_(NSOperatingSystemVersion version) { - return _objc_msgSend_1cw7twn( - this.ref.pointer, _sel_isOperatingSystemAtLeastVersion_, version); - } - - /// systemUptime - double get systemUptime { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_systemUptime) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_systemUptime); - } - - /// disableSuddenTermination - void disableSuddenTermination() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_disableSuddenTermination); - } - - /// enableSuddenTermination - void enableSuddenTermination() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_enableSuddenTermination); - } - - /// disableAutomaticTermination: - void disableAutomaticTermination_(objc.NSString reason) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_disableAutomaticTermination_, - reason.ref.pointer); - } - - /// enableAutomaticTermination: - void enableAutomaticTermination_(objc.NSString reason) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_enableAutomaticTermination_, reason.ref.pointer); - } - - /// automaticTerminationSupportEnabled - bool get automaticTerminationSupportEnabled { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_automaticTerminationSupportEnabled); - } - - /// setAutomaticTerminationSupportEnabled: - set automaticTerminationSupportEnabled(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAutomaticTerminationSupportEnabled_, value); - } - - /// beginActivityWithOptions:reason: - objc.ObjCObjectBase beginActivityWithOptions_reason_( - NSActivityOptions options, objc.NSString reason) { - final _ret = _objc_msgSend_1pavxqs( - this.ref.pointer, - _sel_beginActivityWithOptions_reason_, - options.value, - reason.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// endActivity: - void endActivity_(objc.ObjCObjectBase activity) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_endActivity_, activity.ref.pointer); - } - - /// performActivityWithOptions:reason:usingBlock: - void performActivityWithOptions_reason_usingBlock_(NSActivityOptions options, - objc.NSString reason, objc.ObjCBlock block) { - _objc_msgSend_17597p1( - this.ref.pointer, - _sel_performActivityWithOptions_reason_usingBlock_, - options.value, - reason.ref.pointer, - block.ref.pointer); - } - - /// performExpiringActivityWithReason:usingBlock: - void performExpiringActivityWithReason_usingBlock_( - objc.NSString reason, objc.ObjCBlock block) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_performExpiringActivityWithReason_usingBlock_, - reason.ref.pointer, - block.ref.pointer); - } - - /// userName - objc.NSString get userName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// fullUserName - objc.NSString get fullUserName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fullUserName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// thermalState - NSProcessInfoThermalState get thermalState { - final _ret = _objc_msgSend_1ssuop7(this.ref.pointer, _sel_thermalState); - return NSProcessInfoThermalState.fromValue(_ret); - } - - /// isLowPowerModeEnabled - bool get lowPowerModeEnabled { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isLowPowerModeEnabled); - } - - /// isMacCatalystApp - bool get macCatalystApp { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isMacCatalystApp); - } - - /// isiOSAppOnMac - bool get iOSAppOnMac { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isiOSAppOnMac); - } - - /// init - NSProcessInfo init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSProcessInfo new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProcessInfo, _sel_new); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSProcessInfo allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSProcessInfo, _sel_allocWithZone_, zone); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSProcessInfo alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProcessInfo, _sel_alloc); - return NSProcessInfo.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSProcessInfo, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSProcessInfo, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSProcessInfo, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSProcessInfo, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSProcessInfo, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSProcessInfo, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSProcessInfo, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSProcessInfo, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSProcessInfo, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSProcessInfo self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSProcessInfo retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSProcessInfo autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSProcessInfo.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSTextCheckingResult = objc.getClass("NSTextCheckingResult"); - -enum NSTextCheckingType { - NSTextCheckingTypeOrthography(1), - NSTextCheckingTypeSpelling(2), - NSTextCheckingTypeGrammar(4), - NSTextCheckingTypeDate(8), - NSTextCheckingTypeAddress(16), - NSTextCheckingTypeLink(32), - NSTextCheckingTypeQuote(64), - NSTextCheckingTypeDash(128), - NSTextCheckingTypeReplacement(256), - NSTextCheckingTypeCorrection(512), - NSTextCheckingTypeRegularExpression(1024), - NSTextCheckingTypePhoneNumber(2048), - NSTextCheckingTypeTransitInformation(4096); - - final int value; - const NSTextCheckingType(this.value); - - static NSTextCheckingType fromValue(int value) => switch (value) { - 1 => NSTextCheckingTypeOrthography, - 2 => NSTextCheckingTypeSpelling, - 4 => NSTextCheckingTypeGrammar, - 8 => NSTextCheckingTypeDate, - 16 => NSTextCheckingTypeAddress, - 32 => NSTextCheckingTypeLink, - 64 => NSTextCheckingTypeQuote, - 128 => NSTextCheckingTypeDash, - 256 => NSTextCheckingTypeReplacement, - 512 => NSTextCheckingTypeCorrection, - 1024 => NSTextCheckingTypeRegularExpression, - 2048 => NSTextCheckingTypePhoneNumber, - 4096 => NSTextCheckingTypeTransitInformation, - _ => - throw ArgumentError("Unknown value for NSTextCheckingType: $value"), - }; -} - -late final _sel_resultType = objc.registerName("resultType"); -final _objc_msgSend_1d8v3ql = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Uint64 Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_range = objc.registerName("range"); -final _objc_msgSend_vi3lef = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - objc.NSRange Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_vi3lefStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); -late final _sel_orthography = objc.registerName("orthography"); -late final _sel_grammarDetails = objc.registerName("grammarDetails"); -late final _sel_duration = objc.registerName("duration"); -late final _sel_components = objc.registerName("components"); -late final _sel_replacementString = objc.registerName("replacementString"); -late final _sel_alternativeStrings = objc.registerName("alternativeStrings"); -late final _class_NSRegularExpression = objc.getClass("NSRegularExpression"); - -enum NSRegularExpressionOptions { - NSRegularExpressionCaseInsensitive(1), - NSRegularExpressionAllowCommentsAndWhitespace(2), - NSRegularExpressionIgnoreMetacharacters(4), - NSRegularExpressionDotMatchesLineSeparators(8), - NSRegularExpressionAnchorsMatchLines(16), - NSRegularExpressionUseUnixLineSeparators(32), - NSRegularExpressionUseUnicodeWordBoundaries(64); - - final int value; - const NSRegularExpressionOptions(this.value); - - static NSRegularExpressionOptions fromValue(int value) => switch (value) { - 1 => NSRegularExpressionCaseInsensitive, - 2 => NSRegularExpressionAllowCommentsAndWhitespace, - 4 => NSRegularExpressionIgnoreMetacharacters, - 8 => NSRegularExpressionDotMatchesLineSeparators, - 16 => NSRegularExpressionAnchorsMatchLines, - 32 => NSRegularExpressionUseUnixLineSeparators, - 64 => NSRegularExpressionUseUnicodeWordBoundaries, - _ => throw ArgumentError( - "Unknown value for NSRegularExpressionOptions: $value"), - }; -} - -late final _sel_regularExpressionWithPattern_options_error_ = - objc.registerName("regularExpressionWithPattern:options:error:"); -final _objc_msgSend_mq25jr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_initWithPattern_options_error_ = - objc.registerName("initWithPattern:options:error:"); -late final _sel_pattern = objc.registerName("pattern"); -late final _sel_options = objc.registerName("options"); -final _objc_msgSend_jt3cu0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_numberOfCaptureGroups = - objc.registerName("numberOfCaptureGroups"); -late final _sel_escapedPatternForString_ = - objc.registerName("escapedPatternForString:"); - -enum NSMatchingOptions { - NSMatchingReportProgress(1), - NSMatchingReportCompletion(2), - NSMatchingAnchored(4), - NSMatchingWithTransparentBounds(8), - NSMatchingWithoutAnchoringBounds(16); - - final int value; - const NSMatchingOptions(this.value); - - static NSMatchingOptions fromValue(int value) => switch (value) { - 1 => NSMatchingReportProgress, - 2 => NSMatchingReportCompletion, - 4 => NSMatchingAnchored, - 8 => NSMatchingWithTransparentBounds, - 16 => NSMatchingWithoutAnchoringBounds, - _ => throw ArgumentError("Unknown value for NSMatchingOptions: $value"), - }; -} - -enum NSMatchingFlags { - NSMatchingProgress(1), - NSMatchingCompleted(2), - NSMatchingHitEnd(4), - NSMatchingRequiredEnd(8), - NSMatchingInternalError(16); - - final int value; - const NSMatchingFlags(this.value); - - static NSMatchingFlags fromValue(int value) => switch (value) { - 1 => NSMatchingProgress, - 2 => NSMatchingCompleted, - 4 => NSMatchingHitEnd, - 8 => NSMatchingRequiredEnd, - 16 => NSMatchingInternalError, - _ => throw ArgumentError("Unknown value for NSMatchingFlags: $value"), - }; -} - -void - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.UnsignedLong arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, int, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrTrampoline) - .cast(); -void - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - int, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureTrampoline) - .cast(); -void - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - int, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerCallable = - ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function( - NSTextCheckingResult?, ffi.UnsignedLong, ffi.Pointer)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock)> - fromFunctionPointer(ffi.Pointer arg0, ffi.UnsignedLong arg1, ffi.Pointer arg2)>> ptr) => - objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)>( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(void Function(NSTextCheckingResult?, NSMatchingFlags, ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_closureCallable, - (ffi.Pointer arg0, int arg1, ffi.Pointer arg2) => fn( - arg0.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(arg0, retain: true, release: true), - NSMatchingFlags.fromValue(arg1), - arg2)), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function( - NSTextCheckingResult?, ffi.UnsignedLong, ffi.Pointer)> - listener( - void Function( - NSTextCheckingResult?, NSMatchingFlags, ffi.Pointer) - fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, int arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(arg0, - retain: false, release: true), - NSMatchingFlags.fromValue(arg1), - arg2)); - final wrapper = _wrapListenerBlock_9w6y6n(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool_CallExtension - on objc.ObjCBlock< - ffi.Void Function( - NSTextCheckingResult?, ffi.UnsignedLong, ffi.Pointer)> { - void call(NSTextCheckingResult? arg0, NSMatchingFlags arg1, - ffi.Pointer arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.UnsignedLong arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1.value, arg2); -} - -late final _sel_enumerateMatchesInString_options_range_usingBlock_ = - objc.registerName("enumerateMatchesInString:options:range:usingBlock:"); -final _objc_msgSend_1c1lm06 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_matchesInString_options_range_ = - objc.registerName("matchesInString:options:range:"); -final _objc_msgSend_1ntyxzp = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -late final _sel_numberOfMatchesInString_options_range_ = - objc.registerName("numberOfMatchesInString:options:range:"); -final _objc_msgSend_1y9v6af = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -late final _sel_firstMatchInString_options_range_ = - objc.registerName("firstMatchInString:options:range:"); -late final _sel_rangeOfFirstMatchInString_options_range_ = - objc.registerName("rangeOfFirstMatchInString:options:range:"); -final _objc_msgSend_6yg79o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -final _objc_msgSend_6yg79oStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange)>(); -late final _sel_stringByReplacingMatchesInString_options_range_withTemplate_ = - objc.registerName( - "stringByReplacingMatchesInString:options:range:withTemplate:"); -final _objc_msgSend_zsgini = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_replaceMatchesInString_options_range_withTemplate_ = - objc.registerName("replaceMatchesInString:options:range:withTemplate:"); -final _objc_msgSend_19w8ucc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_replacementStringForResult_inString_offset_template_ = - objc.registerName("replacementStringForResult:inString:offset:template:"); -late final _sel_escapedTemplateForString_ = - objc.registerName("escapedTemplateForString:"); - -/// NSRegularExpression -class NSRegularExpression extends objc.NSObject { - NSRegularExpression._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSRegularExpression] that points to the same underlying object as [other]. - NSRegularExpression.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSRegularExpression] that wraps the given raw object pointer. - NSRegularExpression.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSRegularExpression]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSRegularExpression); - } - - /// regularExpressionWithPattern:options:error: - static NSRegularExpression? regularExpressionWithPattern_options_error_( - objc.NSString pattern, - NSRegularExpressionOptions options, - ffi.Pointer> error) { - final _ret = _objc_msgSend_mq25jr( - _class_NSRegularExpression, - _sel_regularExpressionWithPattern_options_error_, - pattern.ref.pointer, - options.value, - error); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithPattern:options:error: - NSRegularExpression? initWithPattern_options_error_( - objc.NSString pattern, - NSRegularExpressionOptions options, - ffi.Pointer> error) { - final _ret = _objc_msgSend_mq25jr( - this.ref.retainAndReturnPointer(), - _sel_initWithPattern_options_error_, - pattern.ref.pointer, - options.value, - error); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// pattern - objc.NSString get pattern { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_pattern); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// options - NSRegularExpressionOptions get options { - final _ret = _objc_msgSend_jt3cu0(this.ref.pointer, _sel_options); - return NSRegularExpressionOptions.fromValue(_ret); - } - - /// numberOfCaptureGroups - int get numberOfCaptureGroups { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_numberOfCaptureGroups); - } - - /// escapedPatternForString: - static objc.NSString escapedPatternForString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(_class_NSRegularExpression, - _sel_escapedPatternForString_, string.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// enumerateMatchesInString:options:range:usingBlock: - void enumerateMatchesInString_options_range_usingBlock_( - objc.NSString string, - NSMatchingOptions options, - objc.NSRange range, - objc.ObjCBlock< - ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, - ffi.Pointer)> - block) { - _objc_msgSend_1c1lm06( - this.ref.pointer, - _sel_enumerateMatchesInString_options_range_usingBlock_, - string.ref.pointer, - options.value, - range, - block.ref.pointer); - } - - /// matchesInString:options:range: - objc.NSArray matchesInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - final _ret = _objc_msgSend_1ntyxzp( - this.ref.pointer, - _sel_matchesInString_options_range_, - string.ref.pointer, - options.value, - range); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// numberOfMatchesInString:options:range: - int numberOfMatchesInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - return _objc_msgSend_1y9v6af( - this.ref.pointer, - _sel_numberOfMatchesInString_options_range_, - string.ref.pointer, - options.value, - range); - } - - /// firstMatchInString:options:range: - NSTextCheckingResult? firstMatchInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - final _ret = _objc_msgSend_1ntyxzp( - this.ref.pointer, - _sel_firstMatchInString_options_range_, - string.ref.pointer, - options.value, - range); - return _ret.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// rangeOfFirstMatchInString:options:range: - objc.NSRange rangeOfFirstMatchInString_options_range_( - objc.NSString string, NSMatchingOptions options, objc.NSRange range) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_6yg79oStret( - _ptr, - this.ref.pointer, - _sel_rangeOfFirstMatchInString_options_range_, - string.ref.pointer, - options.value, - range) - : _ptr.ref = _objc_msgSend_6yg79o( - this.ref.pointer, - _sel_rangeOfFirstMatchInString_options_range_, - string.ref.pointer, - options.value, - range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// stringByReplacingMatchesInString:options:range:withTemplate: - objc.NSString stringByReplacingMatchesInString_options_range_withTemplate_( - objc.NSString string, - NSMatchingOptions options, - objc.NSRange range, - objc.NSString templ) { - final _ret = _objc_msgSend_zsgini( - this.ref.pointer, - _sel_stringByReplacingMatchesInString_options_range_withTemplate_, - string.ref.pointer, - options.value, - range, - templ.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// replaceMatchesInString:options:range:withTemplate: - int replaceMatchesInString_options_range_withTemplate_( - objc.NSMutableString string, - NSMatchingOptions options, - objc.NSRange range, - objc.NSString templ) { - return _objc_msgSend_19w8ucc( - this.ref.pointer, - _sel_replaceMatchesInString_options_range_withTemplate_, - string.ref.pointer, - options.value, - range, - templ.ref.pointer); - } - - /// replacementStringForResult:inString:offset:template: - objc.NSString replacementStringForResult_inString_offset_template_( - NSTextCheckingResult result, - objc.NSString string, - int offset, - objc.NSString templ) { - final _ret = _objc_msgSend_eyseqq( - this.ref.pointer, - _sel_replacementStringForResult_inString_offset_template_, - result.ref.pointer, - string.ref.pointer, - offset, - templ.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// escapedTemplateForString: - static objc.NSString escapedTemplateForString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(_class_NSRegularExpression, - _sel_escapedTemplateForString_, string.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSRegularExpression init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSRegularExpression new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSRegularExpression, _sel_new); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSRegularExpression allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSRegularExpression, _sel_allocWithZone_, zone); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSRegularExpression alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSRegularExpression, _sel_alloc); - return NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSRegularExpression, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSRegularExpression, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSRegularExpression, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSRegularExpression, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSRegularExpression, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSRegularExpression, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSRegularExpression, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSRegularExpression, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSRegularExpression, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSRegularExpression self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSRegularExpression retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSRegularExpression autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSRegularExpression, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSRegularExpression? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_regularExpression = objc.registerName("regularExpression"); -late final _sel_phoneNumber = objc.registerName("phoneNumber"); -late final _sel_numberOfRanges = objc.registerName("numberOfRanges"); -late final _sel_rangeAtIndex_ = objc.registerName("rangeAtIndex:"); -final _objc_msgSend_rmij85 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_rmij85Stret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_rangeWithName_ = objc.registerName("rangeWithName:"); -final _objc_msgSend_1pl4rx6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - objc.NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - objc.NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1pl4rx6Stret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_resultByAdjustingRangesWithOffset_ = - objc.registerName("resultByAdjustingRangesWithOffset:"); -late final _sel_addressComponents = objc.registerName("addressComponents"); -late final _sel_orthographyCheckingResultWithRange_orthography_ = - objc.registerName("orthographyCheckingResultWithRange:orthography:"); -final _objc_msgSend_1g0atks = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer)>(); -late final _sel_spellCheckingResultWithRange_ = - objc.registerName("spellCheckingResultWithRange:"); -late final _sel_grammarCheckingResultWithRange_details_ = - objc.registerName("grammarCheckingResultWithRange:details:"); -late final _sel_dateCheckingResultWithRange_date_ = - objc.registerName("dateCheckingResultWithRange:date:"); -late final _sel_dateCheckingResultWithRange_date_timeZone_duration_ = - objc.registerName("dateCheckingResultWithRange:date:timeZone:duration:"); -final _objc_msgSend_1trgi6b = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer, - ffi.Double)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer, - double)>(); -late final _sel_addressCheckingResultWithRange_components_ = - objc.registerName("addressCheckingResultWithRange:components:"); -late final _sel_linkCheckingResultWithRange_URL_ = - objc.registerName("linkCheckingResultWithRange:URL:"); -late final _sel_quoteCheckingResultWithRange_replacementString_ = - objc.registerName("quoteCheckingResultWithRange:replacementString:"); -late final _sel_dashCheckingResultWithRange_replacementString_ = - objc.registerName("dashCheckingResultWithRange:replacementString:"); -late final _sel_replacementCheckingResultWithRange_replacementString_ = - objc.registerName("replacementCheckingResultWithRange:replacementString:"); -late final _sel_correctionCheckingResultWithRange_replacementString_ = - objc.registerName("correctionCheckingResultWithRange:replacementString:"); -late final _sel_correctionCheckingResultWithRange_replacementString_alternativeStrings_ = - objc.registerName( - "correctionCheckingResultWithRange:replacementString:alternativeStrings:"); -final _objc_msgSend_1desjtb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - objc.NSRange, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_regularExpressionCheckingResultWithRanges_count_regularExpression_ = - objc.registerName( - "regularExpressionCheckingResultWithRanges:count:regularExpression:"); -final _objc_msgSend_1s39epe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_phoneNumberCheckingResultWithRange_phoneNumber_ = - objc.registerName("phoneNumberCheckingResultWithRange:phoneNumber:"); -late final _sel_transitInformationCheckingResultWithRange_components_ = - objc.registerName("transitInformationCheckingResultWithRange:components:"); - -/// NSTextCheckingResult -class NSTextCheckingResult extends objc.NSObject { - NSTextCheckingResult._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTextCheckingResult] that points to the same underlying object as [other]. - NSTextCheckingResult.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTextCheckingResult] that wraps the given raw object pointer. - NSTextCheckingResult.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTextCheckingResult]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTextCheckingResult); - } - - /// resultType - NSTextCheckingType get resultType { - final _ret = _objc_msgSend_1d8v3ql(this.ref.pointer, _sel_resultType); - return NSTextCheckingType.fromValue(_ret); - } - - /// range - objc.NSRange get range { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_vi3lefStret(_ptr, this.ref.pointer, _sel_range) - : _ptr.ref = _objc_msgSend_vi3lef(this.ref.pointer, _sel_range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// orthography - NSOrthography? get orthography { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_orthography); - return _ret.address == 0 - ? null - : NSOrthography.castFromPointer(_ret, retain: true, release: true); - } - - /// grammarDetails - objc.NSArray? get grammarDetails { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_grammarDetails); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// date - objc.NSDate? get date { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_date); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// timeZone - NSTimeZone? get timeZone { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_timeZone); - return _ret.address == 0 - ? null - : NSTimeZone.castFromPointer(_ret, retain: true, release: true); - } - - /// duration - double get duration { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_duration) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_duration); - } - - /// components - objc.NSDictionary? get components { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_components); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// replacementString - objc.NSString? get replacementString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_replacementString); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// alternativeStrings - objc.NSArray? get alternativeStrings { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_alternativeStrings); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// regularExpression - NSRegularExpression? get regularExpression { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_regularExpression); - return _ret.address == 0 - ? null - : NSRegularExpression.castFromPointer(_ret, - retain: true, release: true); - } - - /// phoneNumber - objc.NSString? get phoneNumber { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_phoneNumber); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// numberOfRanges - int get numberOfRanges { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_numberOfRanges); - } - - /// rangeAtIndex: - objc.NSRange rangeAtIndex_(int idx) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_rmij85Stret( - _ptr, this.ref.pointer, _sel_rangeAtIndex_, idx) - : _ptr.ref = - _objc_msgSend_rmij85(this.ref.pointer, _sel_rangeAtIndex_, idx); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// rangeWithName: - objc.NSRange rangeWithName_(objc.NSString name) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1pl4rx6Stret( - _ptr, this.ref.pointer, _sel_rangeWithName_, name.ref.pointer) - : _ptr.ref = _objc_msgSend_1pl4rx6( - this.ref.pointer, _sel_rangeWithName_, name.ref.pointer); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// resultByAdjustingRangesWithOffset: - NSTextCheckingResult resultByAdjustingRangesWithOffset_(int offset) { - final _ret = _objc_msgSend_crtxa9( - this.ref.pointer, _sel_resultByAdjustingRangesWithOffset_, offset); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// addressComponents - objc.NSDictionary? get addressComponents { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_addressComponents); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// orthographyCheckingResultWithRange:orthography: - static NSTextCheckingResult orthographyCheckingResultWithRange_orthography_( - objc.NSRange range, NSOrthography orthography) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_orthographyCheckingResultWithRange_orthography_, - range, - orthography.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// spellCheckingResultWithRange: - static NSTextCheckingResult spellCheckingResultWithRange_( - objc.NSRange range) { - final _ret = _objc_msgSend_176f8tz( - _class_NSTextCheckingResult, _sel_spellCheckingResultWithRange_, range); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// grammarCheckingResultWithRange:details: - static NSTextCheckingResult grammarCheckingResultWithRange_details_( - objc.NSRange range, objc.NSArray details) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_grammarCheckingResultWithRange_details_, - range, - details.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// dateCheckingResultWithRange:date: - static NSTextCheckingResult dateCheckingResultWithRange_date_( - objc.NSRange range, objc.NSDate date) { - final _ret = _objc_msgSend_1g0atks(_class_NSTextCheckingResult, - _sel_dateCheckingResultWithRange_date_, range, date.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// dateCheckingResultWithRange:date:timeZone:duration: - static NSTextCheckingResult - dateCheckingResultWithRange_date_timeZone_duration_(objc.NSRange range, - objc.NSDate date, NSTimeZone timeZone, double duration) { - final _ret = _objc_msgSend_1trgi6b( - _class_NSTextCheckingResult, - _sel_dateCheckingResultWithRange_date_timeZone_duration_, - range, - date.ref.pointer, - timeZone.ref.pointer, - duration); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// addressCheckingResultWithRange:components: - static NSTextCheckingResult addressCheckingResultWithRange_components_( - objc.NSRange range, objc.NSDictionary components) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_addressCheckingResultWithRange_components_, - range, - components.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// linkCheckingResultWithRange:URL: - static NSTextCheckingResult linkCheckingResultWithRange_URL_( - objc.NSRange range, objc.NSURL url) { - final _ret = _objc_msgSend_1g0atks(_class_NSTextCheckingResult, - _sel_linkCheckingResultWithRange_URL_, range, url.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// quoteCheckingResultWithRange:replacementString: - static NSTextCheckingResult quoteCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_quoteCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// dashCheckingResultWithRange:replacementString: - static NSTextCheckingResult dashCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_dashCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// replacementCheckingResultWithRange:replacementString: - static NSTextCheckingResult - replacementCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_replacementCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// correctionCheckingResultWithRange:replacementString: - static NSTextCheckingResult - correctionCheckingResultWithRange_replacementString_( - objc.NSRange range, objc.NSString replacementString) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_correctionCheckingResultWithRange_replacementString_, - range, - replacementString.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// correctionCheckingResultWithRange:replacementString:alternativeStrings: - static NSTextCheckingResult - correctionCheckingResultWithRange_replacementString_alternativeStrings_( - objc.NSRange range, - objc.NSString replacementString, - objc.NSArray alternativeStrings) { - final _ret = _objc_msgSend_1desjtb( - _class_NSTextCheckingResult, - _sel_correctionCheckingResultWithRange_replacementString_alternativeStrings_, - range, - replacementString.ref.pointer, - alternativeStrings.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// regularExpressionCheckingResultWithRanges:count:regularExpression: - static NSTextCheckingResult - regularExpressionCheckingResultWithRanges_count_regularExpression_( - ffi.Pointer ranges, - int count, - NSRegularExpression regularExpression) { - final _ret = _objc_msgSend_1s39epe( - _class_NSTextCheckingResult, - _sel_regularExpressionCheckingResultWithRanges_count_regularExpression_, - ranges, - count, - regularExpression.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// phoneNumberCheckingResultWithRange:phoneNumber: - static NSTextCheckingResult phoneNumberCheckingResultWithRange_phoneNumber_( - objc.NSRange range, objc.NSString phoneNumber) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_phoneNumberCheckingResultWithRange_phoneNumber_, - range, - phoneNumber.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// transitInformationCheckingResultWithRange:components: - static NSTextCheckingResult - transitInformationCheckingResultWithRange_components_( - objc.NSRange range, objc.NSDictionary components) { - final _ret = _objc_msgSend_1g0atks( - _class_NSTextCheckingResult, - _sel_transitInformationCheckingResultWithRange_components_, - range, - components.ref.pointer); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSTextCheckingResult init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSTextCheckingResult new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTextCheckingResult, _sel_new); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSTextCheckingResult allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSTextCheckingResult, _sel_allocWithZone_, zone); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSTextCheckingResult alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTextCheckingResult, _sel_alloc); - return NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTextCheckingResult, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTextCheckingResult, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTextCheckingResult, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSTextCheckingResult, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTextCheckingResult, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTextCheckingResult, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTextCheckingResult, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTextCheckingResult, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTextCheckingResult, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSTextCheckingResult self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSTextCheckingResult retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSTextCheckingResult autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSTextCheckingResult.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSTextCheckingResult, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSTextCheckingResult? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSTextCheckingResult.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _class_NSTimer = objc.getClass("NSTimer"); -late final _sel_timerWithTimeInterval_invocation_repeats_ = - objc.registerName("timerWithTimeInterval:invocation:repeats:"); -final _objc_msgSend_1dbp0rg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer, - bool)>(); -late final _sel_scheduledTimerWithTimeInterval_invocation_repeats_ = - objc.registerName("scheduledTimerWithTimeInterval:invocation:repeats:"); -late final _sel_timerWithTimeInterval_target_selector_userInfo_repeats_ = objc - .registerName("timerWithTimeInterval:target:selector:userInfo:repeats:"); -final _objc_msgSend_12fx7q4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_ = - objc.registerName( - "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:"); -void _ObjCBlock_ffiVoid_NSTimer_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTimer_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTimer_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTimer_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTimer_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTimer_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTimer_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSTimer_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSTimer_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSTimer { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSTimer_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSTimer) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTimer_closureCallable, - (ffi.Pointer arg0) => fn( - NSTimer.castFromPointer(arg0, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSTimer) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTimer_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => - fn(NSTimer.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSTimer_CallExtension - on objc.ObjCBlock { - void call(NSTimer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_timerWithTimeInterval_repeats_block_ = - objc.registerName("timerWithTimeInterval:repeats:block:"); -final _objc_msgSend_1t6yrah = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Bool, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - double, - bool, - ffi.Pointer)>(); -late final _sel_scheduledTimerWithTimeInterval_repeats_block_ = - objc.registerName("scheduledTimerWithTimeInterval:repeats:block:"); -late final _sel_initWithFireDate_interval_repeats_block_ = - objc.registerName("initWithFireDate:interval:repeats:block:"); -final _objc_msgSend_tzx95k = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Bool, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - double, - bool, - ffi.Pointer)>(); -late final _sel_initWithFireDate_interval_target_selector_userInfo_repeats_ = - objc.registerName( - "initWithFireDate:interval:target:selector:userInfo:repeats:"); -final _objc_msgSend_1thgzrb = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_fire = objc.registerName("fire"); -late final _sel_fireDate = objc.registerName("fireDate"); -late final _sel_setFireDate_ = objc.registerName("setFireDate:"); -late final _sel_timeInterval = objc.registerName("timeInterval"); -late final _sel_tolerance = objc.registerName("tolerance"); -late final _sel_setTolerance_ = objc.registerName("setTolerance:"); - -/// NSTimer -class NSTimer extends objc.NSObject { - NSTimer._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTimer] that points to the same underlying object as [other]. - NSTimer.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTimer] that wraps the given raw object pointer. - NSTimer.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTimer]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTimer); - } - - /// timerWithTimeInterval:invocation:repeats: - static NSTimer timerWithTimeInterval_invocation_repeats_( - double ti, objc.NSInvocation invocation, bool yesOrNo) { - final _ret = _objc_msgSend_1dbp0rg( - _class_NSTimer, - _sel_timerWithTimeInterval_invocation_repeats_, - ti, - invocation.ref.pointer, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// scheduledTimerWithTimeInterval:invocation:repeats: - static NSTimer scheduledTimerWithTimeInterval_invocation_repeats_( - double ti, objc.NSInvocation invocation, bool yesOrNo) { - final _ret = _objc_msgSend_1dbp0rg( - _class_NSTimer, - _sel_scheduledTimerWithTimeInterval_invocation_repeats_, - ti, - invocation.ref.pointer, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// timerWithTimeInterval:target:selector:userInfo:repeats: - static NSTimer timerWithTimeInterval_target_selector_userInfo_repeats_( - double ti, - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? userInfo, - bool yesOrNo) { - final _ret = _objc_msgSend_12fx7q4( - _class_NSTimer, - _sel_timerWithTimeInterval_target_selector_userInfo_repeats_, - ti, - aTarget.ref.pointer, - aSelector, - userInfo?.ref.pointer ?? ffi.nullptr, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: - static NSTimer - scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( - double ti, - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? userInfo, - bool yesOrNo) { - final _ret = _objc_msgSend_12fx7q4( - _class_NSTimer, - _sel_scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_, - ti, - aTarget.ref.pointer, - aSelector, - userInfo?.ref.pointer ?? ffi.nullptr, - yesOrNo); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// timerWithTimeInterval:repeats:block: - static NSTimer timerWithTimeInterval_repeats_block_(double interval, - bool repeats, objc.ObjCBlock block) { - final _ret = _objc_msgSend_1t6yrah( - _class_NSTimer, - _sel_timerWithTimeInterval_repeats_block_, - interval, - repeats, - block.ref.pointer); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// scheduledTimerWithTimeInterval:repeats:block: - static NSTimer scheduledTimerWithTimeInterval_repeats_block_(double interval, - bool repeats, objc.ObjCBlock block) { - final _ret = _objc_msgSend_1t6yrah( - _class_NSTimer, - _sel_scheduledTimerWithTimeInterval_repeats_block_, - interval, - repeats, - block.ref.pointer); - return NSTimer.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithFireDate:interval:repeats:block: - NSTimer initWithFireDate_interval_repeats_block_( - objc.NSDate date, - double interval, - bool repeats, - objc.ObjCBlock block) { - final _ret = _objc_msgSend_tzx95k( - this.ref.retainAndReturnPointer(), - _sel_initWithFireDate_interval_repeats_block_, - date.ref.pointer, - interval, - repeats, - block.ref.pointer); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithFireDate:interval:target:selector:userInfo:repeats: - NSTimer initWithFireDate_interval_target_selector_userInfo_repeats_( - objc.NSDate date, - double ti, - objc.ObjCObjectBase t, - ffi.Pointer s, - objc.ObjCObjectBase? ui, - bool rep) { - final _ret = _objc_msgSend_1thgzrb( - this.ref.retainAndReturnPointer(), - _sel_initWithFireDate_interval_target_selector_userInfo_repeats_, - date.ref.pointer, - ti, - t.ref.pointer, - s, - ui?.ref.pointer ?? ffi.nullptr, - rep); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// fire - void fire() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_fire); - } - - /// fireDate - objc.NSDate get fireDate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fireDate); - return objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// setFireDate: - set fireDate(objc.NSDate value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFireDate_, value.ref.pointer); - } - - /// timeInterval - double get timeInterval { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_timeInterval) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeInterval); - } - - /// tolerance - double get tolerance { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_tolerance) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_tolerance); - } - - /// setTolerance: - set tolerance(double value) { - return _objc_msgSend_suh039(this.ref.pointer, _sel_setTolerance_, value); - } - - /// invalidate - void invalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidate); - } - - /// isValid - bool get valid { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isValid); - } - - /// userInfo - objc.ObjCObjectBase? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// init - NSTimer init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSTimer new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimer, _sel_new); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSTimer allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSTimer, _sel_allocWithZone_, zone); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSTimer alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTimer, _sel_alloc); - return NSTimer.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTimer, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTimer, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTimer, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSTimer, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTimer, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTimer, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTimer, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTimer, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTimer, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSURLCache = objc.getClass("NSURLCache"); -late final _sel_sharedURLCache = objc.registerName("sharedURLCache"); -late final _sel_setSharedURLCache_ = objc.registerName("setSharedURLCache:"); -late final _sel_initWithMemoryCapacity_diskCapacity_diskPath_ = - objc.registerName("initWithMemoryCapacity:diskCapacity:diskPath:"); -final _objc_msgSend_ebb7er = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer)>(); -late final _sel_initWithMemoryCapacity_diskCapacity_directoryURL_ = - objc.registerName("initWithMemoryCapacity:diskCapacity:directoryURL:"); -late final _class_NSCachedURLResponse = objc.getClass("NSCachedURLResponse"); -late final _sel_initWithResponse_data_ = - objc.registerName("initWithResponse:data:"); - -enum NSURLCacheStoragePolicy { - NSURLCacheStorageAllowed(0), - NSURLCacheStorageAllowedInMemoryOnly(1), - NSURLCacheStorageNotAllowed(2); - - final int value; - const NSURLCacheStoragePolicy(this.value); - - static NSURLCacheStoragePolicy fromValue(int value) => switch (value) { - 0 => NSURLCacheStorageAllowed, - 1 => NSURLCacheStorageAllowedInMemoryOnly, - 2 => NSURLCacheStorageNotAllowed, - _ => throw ArgumentError( - "Unknown value for NSURLCacheStoragePolicy: $value"), - }; -} - -late final _sel_initWithResponse_data_userInfo_storagePolicy_ = - objc.registerName("initWithResponse:data:userInfo:storagePolicy:"); -final _objc_msgSend_nhp99d = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_storagePolicy = objc.registerName("storagePolicy"); -final _objc_msgSend_1xh4qg4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); - -/// NSCachedURLResponse -class NSCachedURLResponse extends objc.NSObject { - NSCachedURLResponse._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSCachedURLResponse] that points to the same underlying object as [other]. - NSCachedURLResponse.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSCachedURLResponse] that wraps the given raw object pointer. - NSCachedURLResponse.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSCachedURLResponse]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSCachedURLResponse); - } - - /// initWithResponse:data: - NSCachedURLResponse initWithResponse_data_( - NSURLResponse response, objc.NSData data) { - final _ret = _objc_msgSend_iq11qg(this.ref.retainAndReturnPointer(), - _sel_initWithResponse_data_, response.ref.pointer, data.ref.pointer); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithResponse:data:userInfo:storagePolicy: - NSCachedURLResponse initWithResponse_data_userInfo_storagePolicy_( - NSURLResponse response, - objc.NSData data, - objc.NSDictionary? userInfo, - NSURLCacheStoragePolicy storagePolicy) { - final _ret = _objc_msgSend_nhp99d( - this.ref.retainAndReturnPointer(), - _sel_initWithResponse_data_userInfo_storagePolicy_, - response.ref.pointer, - data.ref.pointer, - userInfo?.ref.pointer ?? ffi.nullptr, - storagePolicy.value); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// response - NSURLResponse get response { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_response); - return NSURLResponse.castFromPointer(_ret, retain: true, release: true); - } - - /// data - objc.NSData get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// userInfo - objc.NSDictionary? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// storagePolicy - NSURLCacheStoragePolicy get storagePolicy { - final _ret = _objc_msgSend_1xh4qg4(this.ref.pointer, _sel_storagePolicy); - return NSURLCacheStoragePolicy.fromValue(_ret); - } - - /// init - NSCachedURLResponse init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSCachedURLResponse new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCachedURLResponse, _sel_new); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSCachedURLResponse allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSCachedURLResponse, _sel_allocWithZone_, zone); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSCachedURLResponse alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCachedURLResponse, _sel_alloc); - return NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSCachedURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSCachedURLResponse, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSCachedURLResponse, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSCachedURLResponse, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSCachedURLResponse, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSCachedURLResponse, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSCachedURLResponse, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCachedURLResponse, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCachedURLResponse, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSCachedURLResponse self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSCachedURLResponse retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSCachedURLResponse autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSCachedURLResponse, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSCachedURLResponse? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_cachedResponseForRequest_ = - objc.registerName("cachedResponseForRequest:"); -late final _sel_storeCachedResponse_forRequest_ = - objc.registerName("storeCachedResponse:forRequest:"); -late final _sel_removeCachedResponseForRequest_ = - objc.registerName("removeCachedResponseForRequest:"); -late final _sel_removeAllCachedResponses = - objc.registerName("removeAllCachedResponses"); -late final _sel_removeCachedResponsesSinceDate_ = - objc.registerName("removeCachedResponsesSinceDate:"); -late final _sel_memoryCapacity = objc.registerName("memoryCapacity"); -late final _sel_setMemoryCapacity_ = objc.registerName("setMemoryCapacity:"); -late final _sel_diskCapacity = objc.registerName("diskCapacity"); -late final _sel_setDiskCapacity_ = objc.registerName("setDiskCapacity:"); -late final _sel_currentMemoryUsage = objc.registerName("currentMemoryUsage"); -late final _sel_currentDiskUsage = objc.registerName("currentDiskUsage"); -late final _class_NSURLSessionDataTask = objc.getClass("NSURLSessionDataTask"); - -/// NSURLSessionDataTask -class NSURLSessionDataTask extends NSURLSessionTask { - NSURLSessionDataTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionDataTask] that points to the same underlying object as [other]. - NSURLSessionDataTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionDataTask] that wraps the given raw object pointer. - NSURLSessionDataTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionDataTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionDataTask); - } - - /// init - NSURLSessionDataTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionDataTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionDataTask, _sel_new); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionDataTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionDataTask, _sel_allocWithZone_, zone); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionDataTask alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionDataTask, _sel_alloc); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionDataTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionDataTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDataTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDataTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionDataTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionDataTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionDataTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDataTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDataTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionDataTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionDataTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionDataTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_storeCachedResponse_forDataTask_ = - objc.registerName("storeCachedResponse:forDataTask:"); -void _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSCachedURLResponse_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSCachedURLResponse_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSCachedURLResponse_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerCallable = ffi - .NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSCachedURLResponse { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrCallable, - ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSCachedURLResponse?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSCachedURLResponse_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSCachedURLResponse?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSCachedURLResponse_CallExtension - on objc.ObjCBlock { - void call(NSCachedURLResponse? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getCachedResponseForDataTask_completionHandler_ = - objc.registerName("getCachedResponseForDataTask:completionHandler:"); -late final _sel_removeCachedResponseForDataTask_ = - objc.registerName("removeCachedResponseForDataTask:"); - -/// NSURLCache -class NSURLCache extends objc.NSObject { - NSURLCache._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLCache] that points to the same underlying object as [other]. - NSURLCache.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLCache] that wraps the given raw object pointer. - NSURLCache.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLCache]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCache); - } - - /// sharedURLCache - static NSURLCache getSharedURLCache() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_sharedURLCache); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// setSharedURLCache: - static void setSharedURLCache(NSURLCache value) { - return _objc_msgSend_ukcdfq( - _class_NSURLCache, _sel_setSharedURLCache_, value.ref.pointer); - } - - /// initWithMemoryCapacity:diskCapacity:diskPath: - NSURLCache initWithMemoryCapacity_diskCapacity_diskPath_( - int memoryCapacity, int diskCapacity, objc.NSString? path) { - final _ret = _objc_msgSend_ebb7er( - this.ref.retainAndReturnPointer(), - _sel_initWithMemoryCapacity_diskCapacity_diskPath_, - memoryCapacity, - diskCapacity, - path?.ref.pointer ?? ffi.nullptr); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithMemoryCapacity:diskCapacity:directoryURL: - NSURLCache initWithMemoryCapacity_diskCapacity_directoryURL_( - int memoryCapacity, int diskCapacity, objc.NSURL? directoryURL) { - final _ret = _objc_msgSend_ebb7er( - this.ref.retainAndReturnPointer(), - _sel_initWithMemoryCapacity_diskCapacity_directoryURL_, - memoryCapacity, - diskCapacity, - directoryURL?.ref.pointer ?? ffi.nullptr); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// cachedResponseForRequest: - NSCachedURLResponse? cachedResponseForRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_cachedResponseForRequest_, request.ref.pointer); - return _ret.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// storeCachedResponse:forRequest: - void storeCachedResponse_forRequest_( - NSCachedURLResponse cachedResponse, NSURLRequest request) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_storeCachedResponse_forRequest_, - cachedResponse.ref.pointer, - request.ref.pointer); - } - - /// removeCachedResponseForRequest: - void removeCachedResponseForRequest_(NSURLRequest request) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_removeCachedResponseForRequest_, - request.ref.pointer); - } - - /// removeAllCachedResponses - void removeAllCachedResponses() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllCachedResponses); - } - - /// removeCachedResponsesSinceDate: - void removeCachedResponsesSinceDate_(objc.NSDate date) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_removeCachedResponsesSinceDate_, - date.ref.pointer); - } - - /// memoryCapacity - int get memoryCapacity { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_memoryCapacity); - } - - /// setMemoryCapacity: - set memoryCapacity(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setMemoryCapacity_, value); - } - - /// diskCapacity - int get diskCapacity { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_diskCapacity); - } - - /// setDiskCapacity: - set diskCapacity(int value) { - return _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_setDiskCapacity_, value); - } - - /// currentMemoryUsage - int get currentMemoryUsage { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_currentMemoryUsage); - } - - /// currentDiskUsage - int get currentDiskUsage { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_currentDiskUsage); - } - - /// storeCachedResponse:forDataTask: - void storeCachedResponse_forDataTask_( - NSCachedURLResponse cachedResponse, NSURLSessionDataTask dataTask) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_storeCachedResponse_forDataTask_, - cachedResponse.ref.pointer, - dataTask.ref.pointer); - } - - /// getCachedResponseForDataTask:completionHandler: - void getCachedResponseForDataTask_completionHandler_( - NSURLSessionDataTask dataTask, - objc.ObjCBlock - completionHandler) { - _objc_msgSend_cmbt6k( - this.ref.pointer, - _sel_getCachedResponseForDataTask_completionHandler_, - dataTask.ref.pointer, - completionHandler.ref.pointer); - } - - /// removeCachedResponseForDataTask: - void removeCachedResponseForDataTask_(NSURLSessionDataTask dataTask) { - _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_removeCachedResponseForDataTask_, dataTask.ref.pointer); - } - - /// init - NSURLCache init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLCache new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_new); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLCache allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLCache, _sel_allocWithZone_, zone); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLCache alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_alloc); - return NSURLCache.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLCache, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLCache, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLCache, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLCache, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLCache, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLCache, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLCache, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCache, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLCache, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLCache self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLCache retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLCache autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLCache.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSURLConnection = objc.getClass("NSURLConnection"); -late final _sel_initWithRequest_delegate_startImmediately_ = - objc.registerName("initWithRequest:delegate:startImmediately:"); -final _objc_msgSend_at5jtv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -late final _sel_initWithRequest_delegate_ = - objc.registerName("initWithRequest:delegate:"); -late final _sel_connectionWithRequest_delegate_ = - objc.registerName("connectionWithRequest:delegate:"); -late final _sel_unscheduleFromRunLoop_forMode_ = - objc.registerName("unscheduleFromRunLoop:forMode:"); -late final _sel_setDelegateQueue_ = objc.registerName("setDelegateQueue:"); -late final _sel_canHandleRequest_ = objc.registerName("canHandleRequest:"); -late final _sel_sendSynchronousRequest_returningResponse_error_ = - objc.registerName("sendSynchronousRequest:returningResponse:error:"); -void _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(NSURLResponse?, objc.NSData?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSURLResponse?, objc.NSData?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 ? null : NSURLResponse.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : objc.NSData.castFromPointer(arg1, retain: true, release: true), - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(NSURLResponse?, objc.NSData?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : NSURLResponse.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : objc.NSData.castFromPointer(arg1, - retain: false, release: true), - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(NSURLResponse?, objc.NSData?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError_CallExtension on objc - .ObjCBlock { - void call(NSURLResponse? arg0, objc.NSData? arg1, objc.NSError? arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, - arg1?.ref.pointer ?? ffi.nullptr, - arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_sendAsynchronousRequest_queue_completionHandler_ = - objc.registerName("sendAsynchronousRequest:queue:completionHandler:"); -void _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock?, objc.NSError)>`. -abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock?, objc.NSError)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, - objc.NSError)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock?, objc.NSError)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock?, objc.NSError)>( - objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock?, objc.NSError)> fromFunction( - void Function(objc.ObjCObjectBase?, objc.NSError) fn) => - objc.ObjCBlock?, objc.NSError)>( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0.address == 0 - ? null - : objc.ObjCObjectBase(arg0, retain: true, release: true), - objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock?, objc.NSError)> - listener(void Function(objc.ObjCObjectBase?, objc.NSError) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - arg0.address == 0 - ? null - : objc.ObjCObjectBase(arg0, retain: false, release: true), - objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(ffi.Pointer?, - objc.NSError)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock?, objc.NSError)>`. -extension ObjCBlock_ffiVoid_objcObjCObject_NSError_CallExtension on objc - .ObjCBlock?, objc.NSError)> { - void call(objc.ObjCObjectBase? arg0, objc.NSError arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1.ref.pointer); -} - -final _objc_msgSend_10t0qpd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); - -/// NSURLConnection -class NSURLConnection extends objc.NSObject { - NSURLConnection._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLConnection] that points to the same underlying object as [other]. - NSURLConnection.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLConnection] that wraps the given raw object pointer. - NSURLConnection.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLConnection]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLConnection); - } - - /// initWithRequest:delegate:startImmediately: - NSURLConnection? initWithRequest_delegate_startImmediately_( - NSURLRequest request, - objc.ObjCObjectBase? delegate, - bool startImmediately) { - final _ret = _objc_msgSend_at5jtv( - this.ref.retainAndReturnPointer(), - _sel_initWithRequest_delegate_startImmediately_, - request.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr, - startImmediately); - return _ret.address == 0 - ? null - : NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithRequest:delegate: - NSURLConnection? initWithRequest_delegate_( - NSURLRequest request, objc.ObjCObjectBase? delegate) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithRequest_delegate_, - request.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// connectionWithRequest:delegate: - static NSURLConnection? connectionWithRequest_delegate_( - NSURLRequest request, objc.ObjCObjectBase? delegate) { - final _ret = _objc_msgSend_iq11qg( - _class_NSURLConnection, - _sel_connectionWithRequest_delegate_, - request.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// originalRequest - NSURLRequest get originalRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_originalRequest); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// currentRequest - NSURLRequest get currentRequest { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentRequest); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// start - void start() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_start); - } - - /// cancel - void cancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_cancel); - } - - /// scheduleInRunLoop:forMode: - void scheduleInRunLoop_forMode_(objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// unscheduleFromRunLoop:forMode: - void unscheduleFromRunLoop_forMode_( - objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_unscheduleFromRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// setDelegateQueue: - void setDelegateQueue_(NSOperationQueue? queue) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDelegateQueue_, - queue?.ref.pointer ?? ffi.nullptr); - } - - /// canHandleRequest: - static bool canHandleRequest_(NSURLRequest request) { - return _objc_msgSend_l8lotg( - _class_NSURLConnection, _sel_canHandleRequest_, request.ref.pointer); - } - - /// sendSynchronousRequest:returningResponse:error: - static objc.NSData? sendSynchronousRequest_returningResponse_error_( - NSURLRequest request, - ffi.Pointer> response, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1dca44n( - _class_NSURLConnection, - _sel_sendSynchronousRequest_returningResponse_error_, - request.ref.pointer, - response, - error); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// sendAsynchronousRequest:queue:completionHandler: - static void sendAsynchronousRequest_queue_completionHandler_( - NSURLRequest request, - NSOperationQueue queue, - objc.ObjCBlock< - ffi.Void Function(NSURLResponse?, objc.NSData?, objc.NSError?)> - handler) { - _objc_msgSend_10t0qpd( - _class_NSURLConnection, - _sel_sendAsynchronousRequest_queue_completionHandler_, - request.ref.pointer, - queue.ref.pointer, - handler.ref.pointer); - } - - /// init - NSURLConnection init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLConnection new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLConnection, _sel_new); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLConnection allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLConnection, _sel_allocWithZone_, zone); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLConnection alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLConnection, _sel_alloc); - return NSURLConnection.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLConnection, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLConnection, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLConnection, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLConnection, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLConnection, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLConnection, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLConnection, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLConnection, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLConnection, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLConnection self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLConnection retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLConnection autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLConnection.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSURLCredential = objc.getClass("NSURLCredential"); - -enum NSURLCredentialPersistence { - NSURLCredentialPersistenceNone(0), - NSURLCredentialPersistenceForSession(1), - NSURLCredentialPersistencePermanent(2), - NSURLCredentialPersistenceSynchronizable(3); - - final int value; - const NSURLCredentialPersistence(this.value); - - static NSURLCredentialPersistence fromValue(int value) => switch (value) { - 0 => NSURLCredentialPersistenceNone, - 1 => NSURLCredentialPersistenceForSession, - 2 => NSURLCredentialPersistencePermanent, - 3 => NSURLCredentialPersistenceSynchronizable, - _ => throw ArgumentError( - "Unknown value for NSURLCredentialPersistence: $value"), - }; -} - -late final _sel_persistence = objc.registerName("persistence"); -final _objc_msgSend_1dwdxi1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_initWithUser_password_persistence_ = - objc.registerName("initWithUser:password:persistence:"); -final _objc_msgSend_nwxkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_credentialWithUser_password_persistence_ = - objc.registerName("credentialWithUser:password:persistence:"); -late final _sel_user = objc.registerName("user"); -late final _sel_password = objc.registerName("password"); -late final _sel_hasPassword = objc.registerName("hasPassword"); - -final class __SecIdentity extends ffi.Opaque {} - -late final _sel_initWithIdentity_certificates_persistence_ = - objc.registerName("initWithIdentity:certificates:persistence:"); -final _objc_msgSend_1lfx01 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<__SecIdentity>, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<__SecIdentity>, - ffi.Pointer, - int)>(); -late final _sel_credentialWithIdentity_certificates_persistence_ = - objc.registerName("credentialWithIdentity:certificates:persistence:"); -late final _sel_identity = objc.registerName("identity"); -final _objc_msgSend_1dyqaf3 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer<__SecIdentity> Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer<__SecIdentity> Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_certificates = objc.registerName("certificates"); - -final class __SecTrust extends ffi.Opaque {} - -late final _sel_initWithTrust_ = objc.registerName("initWithTrust:"); -final _objc_msgSend_a2ucgd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<__SecTrust>)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<__SecTrust>)>(); -late final _sel_credentialForTrust_ = objc.registerName("credentialForTrust:"); - -/// NSURLCredential -class NSURLCredential extends objc.NSObject { - NSURLCredential._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLCredential] that points to the same underlying object as [other]. - NSURLCredential.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLCredential] that wraps the given raw object pointer. - NSURLCredential.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLCredential]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCredential); - } - - /// persistence - NSURLCredentialPersistence get persistence { - final _ret = _objc_msgSend_1dwdxi1(this.ref.pointer, _sel_persistence); - return NSURLCredentialPersistence.fromValue(_ret); - } - - /// initWithUser:password:persistence: - NSURLCredential initWithUser_password_persistence_(objc.NSString user, - objc.NSString password, NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_nwxkj( - this.ref.retainAndReturnPointer(), - _sel_initWithUser_password_persistence_, - user.ref.pointer, - password.ref.pointer, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// credentialWithUser:password:persistence: - static NSURLCredential credentialWithUser_password_persistence_( - objc.NSString user, - objc.NSString password, - NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_nwxkj( - _class_NSURLCredential, - _sel_credentialWithUser_password_persistence_, - user.ref.pointer, - password.ref.pointer, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// user - objc.NSString? get user { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_user); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// password - objc.NSString? get password { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_password); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// hasPassword - bool get hasPassword { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasPassword); - } - - /// initWithIdentity:certificates:persistence: - NSURLCredential initWithIdentity_certificates_persistence_( - ffi.Pointer<__SecIdentity> identity, - objc.NSArray? certArray, - NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_1lfx01( - this.ref.retainAndReturnPointer(), - _sel_initWithIdentity_certificates_persistence_, - identity, - certArray?.ref.pointer ?? ffi.nullptr, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// credentialWithIdentity:certificates:persistence: - static NSURLCredential credentialWithIdentity_certificates_persistence_( - ffi.Pointer<__SecIdentity> identity, - objc.NSArray? certArray, - NSURLCredentialPersistence persistence) { - final _ret = _objc_msgSend_1lfx01( - _class_NSURLCredential, - _sel_credentialWithIdentity_certificates_persistence_, - identity, - certArray?.ref.pointer ?? ffi.nullptr, - persistence.value); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// identity - ffi.Pointer<__SecIdentity> get identity { - return _objc_msgSend_1dyqaf3(this.ref.pointer, _sel_identity); - } - - /// certificates - objc.NSArray get certificates { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_certificates); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithTrust: - NSURLCredential initWithTrust_(ffi.Pointer<__SecTrust> trust) { - final _ret = _objc_msgSend_a2ucgd( - this.ref.retainAndReturnPointer(), _sel_initWithTrust_, trust); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// credentialForTrust: - static NSURLCredential credentialForTrust_(ffi.Pointer<__SecTrust> trust) { - final _ret = _objc_msgSend_a2ucgd( - _class_NSURLCredential, _sel_credentialForTrust_, trust); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLCredential init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLCredential new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCredential, _sel_new); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLCredential allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLCredential, _sel_allocWithZone_, zone); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLCredential alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCredential, _sel_alloc); - return NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLCredential, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLCredential, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLCredential, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLCredential, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLCredential, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLCredential, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLCredential, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredential, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredential, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLCredential self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLCredential retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLCredential autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSURLCredential, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLCredential? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLCredential.castFromPointer(_ret, retain: false, release: true); - } -} - -late final _class_NSURLProtectionSpace = objc.getClass("NSURLProtectionSpace"); -late final _sel_initWithHost_port_protocol_realm_authenticationMethod_ = - objc.registerName("initWithHost:port:protocol:realm:authenticationMethod:"); -final _objc_msgSend_sfgdlr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_initWithProxyHost_port_type_realm_authenticationMethod_ = objc - .registerName("initWithProxyHost:port:type:realm:authenticationMethod:"); -late final _sel_realm = objc.registerName("realm"); -late final _sel_receivesCredentialSecurely = - objc.registerName("receivesCredentialSecurely"); -late final _sel_host = objc.registerName("host"); -late final _sel_proxyType = objc.registerName("proxyType"); -late final _sel_protocol = objc.registerName("protocol"); -late final _sel_authenticationMethod = - objc.registerName("authenticationMethod"); -late final _sel_distinguishedNames = objc.registerName("distinguishedNames"); -late final _sel_serverTrust = objc.registerName("serverTrust"); -final _objc_msgSend_uv0l05 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer<__SecTrust> Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer<__SecTrust> Function( - ffi.Pointer, ffi.Pointer)>(); - -/// NSURLProtectionSpace -class NSURLProtectionSpace extends objc.NSObject { - NSURLProtectionSpace._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLProtectionSpace] that points to the same underlying object as [other]. - NSURLProtectionSpace.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLProtectionSpace] that wraps the given raw object pointer. - NSURLProtectionSpace.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLProtectionSpace]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLProtectionSpace); - } - - /// initWithHost:port:protocol:realm:authenticationMethod: - NSURLProtectionSpace initWithHost_port_protocol_realm_authenticationMethod_( - objc.NSString host, - int port, - objc.NSString? protocol, - objc.NSString? realm, - objc.NSString? authenticationMethod) { - final _ret = _objc_msgSend_sfgdlr( - this.ref.retainAndReturnPointer(), - _sel_initWithHost_port_protocol_realm_authenticationMethod_, - host.ref.pointer, - port, - protocol?.ref.pointer ?? ffi.nullptr, - realm?.ref.pointer ?? ffi.nullptr, - authenticationMethod?.ref.pointer ?? ffi.nullptr); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithProxyHost:port:type:realm:authenticationMethod: - NSURLProtectionSpace initWithProxyHost_port_type_realm_authenticationMethod_( - objc.NSString host, - int port, - objc.NSString? type, - objc.NSString? realm, - objc.NSString? authenticationMethod) { - final _ret = _objc_msgSend_sfgdlr( - this.ref.retainAndReturnPointer(), - _sel_initWithProxyHost_port_type_realm_authenticationMethod_, - host.ref.pointer, - port, - type?.ref.pointer ?? ffi.nullptr, - realm?.ref.pointer ?? ffi.nullptr, - authenticationMethod?.ref.pointer ?? ffi.nullptr); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// realm - objc.NSString? get realm { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_realm); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// receivesCredentialSecurely - bool get receivesCredentialSecurely { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_receivesCredentialSecurely); - } - - /// isProxy - bool get isProxy { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isProxy); - } - - /// host - objc.NSString get host { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_host); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// port - int get port { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_port); - } - - /// proxyType - objc.NSString? get proxyType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_proxyType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// protocol - objc.NSString? get protocol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_protocol); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// authenticationMethod - objc.NSString get authenticationMethod { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_authenticationMethod); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// distinguishedNames - objc.NSArray? get distinguishedNames { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_distinguishedNames); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// serverTrust - ffi.Pointer<__SecTrust> get serverTrust { - return _objc_msgSend_uv0l05(this.ref.pointer, _sel_serverTrust); - } - - /// init - NSURLProtectionSpace init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLProtectionSpace new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtectionSpace, _sel_new); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLProtectionSpace allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLProtectionSpace, _sel_allocWithZone_, zone); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLProtectionSpace alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtectionSpace, _sel_alloc); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLProtectionSpace, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLProtectionSpace, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLProtectionSpace, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLProtectionSpace, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLProtectionSpace, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLProtectionSpace, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLProtectionSpace, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtectionSpace, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtectionSpace, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLProtectionSpace self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLProtectionSpace retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLProtectionSpace autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLProtectionSpace.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSURLProtectionSpace, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSURLProtectionSpace? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSURLProtectionSpace.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _class_NSURLCredentialStorage = - objc.getClass("NSURLCredentialStorage"); -late final _sel_sharedCredentialStorage = - objc.registerName("sharedCredentialStorage"); -late final _sel_credentialsForProtectionSpace_ = - objc.registerName("credentialsForProtectionSpace:"); -late final _sel_allCredentials = objc.registerName("allCredentials"); -late final _sel_setCredential_forProtectionSpace_ = - objc.registerName("setCredential:forProtectionSpace:"); -late final _sel_removeCredential_forProtectionSpace_ = - objc.registerName("removeCredential:forProtectionSpace:"); -late final _sel_removeCredential_forProtectionSpace_options_ = - objc.registerName("removeCredential:forProtectionSpace:options:"); -late final _sel_defaultCredentialForProtectionSpace_ = - objc.registerName("defaultCredentialForProtectionSpace:"); -late final _sel_setDefaultCredential_forProtectionSpace_ = - objc.registerName("setDefaultCredential:forProtectionSpace:"); -void _ObjCBlock_ffiVoid_NSDictionary_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSDictionary_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSDictionary_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSDictionary_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSDictionary_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSDictionary_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSDictionary { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSDictionary_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSDictionary?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSDictionary?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSDictionary_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSDictionary.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSDictionary_CallExtension - on objc.ObjCBlock { - void call(objc.NSDictionary? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getCredentialsForProtectionSpace_task_completionHandler_ = objc - .registerName("getCredentialsForProtectionSpace:task:completionHandler:"); -late final _sel_setCredential_forProtectionSpace_task_ = - objc.registerName("setCredential:forProtectionSpace:task:"); -late final _sel_removeCredential_forProtectionSpace_options_task_ = - objc.registerName("removeCredential:forProtectionSpace:options:task:"); -final _objc_msgSend_19b8ge5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_NSURLCredential_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSURLCredential_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLCredential_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLCredential_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSURLCredential_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLCredential_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLCredential_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURLCredential_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURLCredential_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURLCredential { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSURLCredential_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSURLCredential?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLCredential_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSURLCredential.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSURLCredential?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLCredential_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : NSURLCredential.castFromPointer(arg0, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURLCredential_CallExtension - on objc.ObjCBlock { - void call(NSURLCredential? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_getDefaultCredentialForProtectionSpace_task_completionHandler_ = - objc.registerName( - "getDefaultCredentialForProtectionSpace:task:completionHandler:"); -late final _sel_setDefaultCredential_forProtectionSpace_task_ = - objc.registerName("setDefaultCredential:forProtectionSpace:task:"); - -/// NSURLCredentialStorage -class NSURLCredentialStorage extends objc.NSObject { - NSURLCredentialStorage._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLCredentialStorage] that points to the same underlying object as [other]. - NSURLCredentialStorage.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLCredentialStorage] that wraps the given raw object pointer. - NSURLCredentialStorage.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLCredentialStorage]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCredentialStorage); - } - - /// sharedCredentialStorage - static NSURLCredentialStorage getSharedCredentialStorage() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredentialStorage, _sel_sharedCredentialStorage); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// credentialsForProtectionSpace: - objc.NSDictionary? credentialsForProtectionSpace_( - NSURLProtectionSpace space) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_credentialsForProtectionSpace_, space.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// allCredentials - objc.NSDictionary get allCredentials { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allCredentials); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setCredential:forProtectionSpace: - void setCredential_forProtectionSpace_( - NSURLCredential credential, NSURLProtectionSpace space) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_setCredential_forProtectionSpace_, - credential.ref.pointer, - space.ref.pointer); - } - - /// removeCredential:forProtectionSpace: - void removeCredential_forProtectionSpace_( - NSURLCredential credential, NSURLProtectionSpace space) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_removeCredential_forProtectionSpace_, - credential.ref.pointer, - space.ref.pointer); - } - - /// removeCredential:forProtectionSpace:options: - void removeCredential_forProtectionSpace_options_(NSURLCredential credential, - NSURLProtectionSpace space, objc.NSDictionary? options) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_removeCredential_forProtectionSpace_options_, - credential.ref.pointer, - space.ref.pointer, - options?.ref.pointer ?? ffi.nullptr); - } - - /// defaultCredentialForProtectionSpace: - NSURLCredential? defaultCredentialForProtectionSpace_( - NSURLProtectionSpace space) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_defaultCredentialForProtectionSpace_, space.ref.pointer); - return _ret.address == 0 - ? null - : NSURLCredential.castFromPointer(_ret, retain: true, release: true); - } - - /// setDefaultCredential:forProtectionSpace: - void setDefaultCredential_forProtectionSpace_( - NSURLCredential credential, NSURLProtectionSpace space) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_setDefaultCredential_forProtectionSpace_, - credential.ref.pointer, - space.ref.pointer); - } - - /// getCredentialsForProtectionSpace:task:completionHandler: - void getCredentialsForProtectionSpace_task_completionHandler_( - NSURLProtectionSpace protectionSpace, - NSURLSessionTask task, - objc.ObjCBlock completionHandler) { - _objc_msgSend_10t0qpd( - this.ref.pointer, - _sel_getCredentialsForProtectionSpace_task_completionHandler_, - protectionSpace.ref.pointer, - task.ref.pointer, - completionHandler.ref.pointer); - } - - /// setCredential:forProtectionSpace:task: - void setCredential_forProtectionSpace_task_(NSURLCredential credential, - NSURLProtectionSpace protectionSpace, NSURLSessionTask task) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_setCredential_forProtectionSpace_task_, - credential.ref.pointer, - protectionSpace.ref.pointer, - task.ref.pointer); - } - - /// removeCredential:forProtectionSpace:options:task: - void removeCredential_forProtectionSpace_options_task_( - NSURLCredential credential, - NSURLProtectionSpace protectionSpace, - objc.NSDictionary? options, - NSURLSessionTask task) { - _objc_msgSend_19b8ge5( - this.ref.pointer, - _sel_removeCredential_forProtectionSpace_options_task_, - credential.ref.pointer, - protectionSpace.ref.pointer, - options?.ref.pointer ?? ffi.nullptr, - task.ref.pointer); - } - - /// getDefaultCredentialForProtectionSpace:task:completionHandler: - void getDefaultCredentialForProtectionSpace_task_completionHandler_( - NSURLProtectionSpace space, - NSURLSessionTask task, - objc.ObjCBlock completionHandler) { - _objc_msgSend_10t0qpd( - this.ref.pointer, - _sel_getDefaultCredentialForProtectionSpace_task_completionHandler_, - space.ref.pointer, - task.ref.pointer, - completionHandler.ref.pointer); - } - - /// setDefaultCredential:forProtectionSpace:task: - void setDefaultCredential_forProtectionSpace_task_(NSURLCredential credential, - NSURLProtectionSpace protectionSpace, NSURLSessionTask task) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_setDefaultCredential_forProtectionSpace_task_, - credential.ref.pointer, - protectionSpace.ref.pointer, - task.ref.pointer); - } - - /// init - NSURLCredentialStorage init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLCredentialStorage new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLCredentialStorage, _sel_new); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLCredentialStorage allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLCredentialStorage, _sel_allocWithZone_, zone); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLCredentialStorage alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLCredentialStorage, _sel_alloc); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLCredentialStorage, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLCredentialStorage, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLCredentialStorage, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLCredentialStorage, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLCredentialStorage, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLCredentialStorage, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLCredentialStorage, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredentialStorage, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLCredentialStorage, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLCredentialStorage self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLCredentialStorage retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLCredentialStorage autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _class_NSURLProtocol = objc.getClass("NSURLProtocol"); -late final _sel_initWithRequest_cachedResponse_client_ = - objc.registerName("initWithRequest:cachedResponse:client:"); -late final _sel_client = objc.registerName("client"); -late final _sel_request = objc.registerName("request"); -late final _sel_cachedResponse = objc.registerName("cachedResponse"); -late final _sel_canInitWithRequest_ = objc.registerName("canInitWithRequest:"); -late final _sel_canonicalRequestForRequest_ = - objc.registerName("canonicalRequestForRequest:"); -late final _sel_requestIsCacheEquivalent_toRequest_ = - objc.registerName("requestIsCacheEquivalent:toRequest:"); -late final _sel_startLoading = objc.registerName("startLoading"); -late final _sel_stopLoading = objc.registerName("stopLoading"); -late final _sel_propertyForKey_inRequest_ = - objc.registerName("propertyForKey:inRequest:"); -late final _class_NSMutableURLRequest = objc.getClass("NSMutableURLRequest"); -late final _sel_setURL_ = objc.registerName("setURL:"); -late final _sel_setCachePolicy_ = objc.registerName("setCachePolicy:"); -final _objc_msgSend_12vaadl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setTimeoutInterval_ = objc.registerName("setTimeoutInterval:"); -late final _sel_setMainDocumentURL_ = objc.registerName("setMainDocumentURL:"); -late final _sel_setNetworkServiceType_ = - objc.registerName("setNetworkServiceType:"); -final _objc_msgSend_br89tg = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setAllowsCellularAccess_ = - objc.registerName("setAllowsCellularAccess:"); -late final _sel_setAllowsExpensiveNetworkAccess_ = - objc.registerName("setAllowsExpensiveNetworkAccess:"); -late final _sel_setAllowsConstrainedNetworkAccess_ = - objc.registerName("setAllowsConstrainedNetworkAccess:"); -late final _sel_setAssumesHTTP3Capable_ = - objc.registerName("setAssumesHTTP3Capable:"); -late final _sel_setAttribution_ = objc.registerName("setAttribution:"); -final _objc_msgSend_1w8eyjo = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setRequiresDNSSECValidation_ = - objc.registerName("setRequiresDNSSECValidation:"); -late final _sel_setHTTPMethod_ = objc.registerName("setHTTPMethod:"); -late final _sel_setAllHTTPHeaderFields_ = - objc.registerName("setAllHTTPHeaderFields:"); -late final _sel_setValue_forHTTPHeaderField_ = - objc.registerName("setValue:forHTTPHeaderField:"); -late final _sel_addValue_forHTTPHeaderField_ = - objc.registerName("addValue:forHTTPHeaderField:"); -late final _sel_setHTTPBody_ = objc.registerName("setHTTPBody:"); -late final _sel_setHTTPBodyStream_ = objc.registerName("setHTTPBodyStream:"); -late final _sel_setHTTPShouldHandleCookies_ = - objc.registerName("setHTTPShouldHandleCookies:"); -late final _sel_setHTTPShouldUsePipelining_ = - objc.registerName("setHTTPShouldUsePipelining:"); - -/// NSMutableURLRequest -class NSMutableURLRequest extends NSURLRequest { - NSMutableURLRequest._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMutableURLRequest] that points to the same underlying object as [other]. - NSMutableURLRequest.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMutableURLRequest] that wraps the given raw object pointer. - NSMutableURLRequest.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMutableURLRequest]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableURLRequest); - } - - /// URL - objc.NSURL? get URL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setURL: - set URL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setURL_, value?.ref.pointer ?? ffi.nullptr); - } - - /// cachePolicy - NSURLRequestCachePolicy get cachePolicy { - final _ret = _objc_msgSend_2xak1q(this.ref.pointer, _sel_cachePolicy); - return NSURLRequestCachePolicy.fromValue(_ret); - } - - /// setCachePolicy: - set cachePolicy(NSURLRequestCachePolicy value) { - return _objc_msgSend_12vaadl( - this.ref.pointer, _sel_setCachePolicy_, value.value); - } - - /// timeoutInterval - double get timeoutInterval { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_timeoutInterval) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeoutInterval); - } - - /// setTimeoutInterval: - set timeoutInterval(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setTimeoutInterval_, value); - } - - /// mainDocumentURL - objc.NSURL? get mainDocumentURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mainDocumentURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setMainDocumentURL: - set mainDocumentURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setMainDocumentURL_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// networkServiceType - NSURLRequestNetworkServiceType get networkServiceType { - final _ret = - _objc_msgSend_ttt73t(this.ref.pointer, _sel_networkServiceType); - return NSURLRequestNetworkServiceType.fromValue(_ret); - } - - /// setNetworkServiceType: - set networkServiceType(NSURLRequestNetworkServiceType value) { - return _objc_msgSend_br89tg( - this.ref.pointer, _sel_setNetworkServiceType_, value.value); - } - - /// allowsCellularAccess - bool get allowsCellularAccess { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsCellularAccess); - } - - /// setAllowsCellularAccess: - set allowsCellularAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsCellularAccess_, value); - } - - /// allowsExpensiveNetworkAccess - bool get allowsExpensiveNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExpensiveNetworkAccess); - } - - /// setAllowsExpensiveNetworkAccess: - set allowsExpensiveNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsExpensiveNetworkAccess_, value); - } - - /// allowsConstrainedNetworkAccess - bool get allowsConstrainedNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsConstrainedNetworkAccess); - } - - /// setAllowsConstrainedNetworkAccess: - set allowsConstrainedNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsConstrainedNetworkAccess_, value); - } - - /// assumesHTTP3Capable - bool get assumesHTTP3Capable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_assumesHTTP3Capable); - } - - /// setAssumesHTTP3Capable: - set assumesHTTP3Capable(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAssumesHTTP3Capable_, value); - } - - /// attribution - NSURLRequestAttribution get attribution { - final _ret = _objc_msgSend_t5yka9(this.ref.pointer, _sel_attribution); - return NSURLRequestAttribution.fromValue(_ret); - } - - /// setAttribution: - set attribution(NSURLRequestAttribution value) { - return _objc_msgSend_1w8eyjo( - this.ref.pointer, _sel_setAttribution_, value.value); - } - - /// requiresDNSSECValidation - bool get requiresDNSSECValidation { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_requiresDNSSECValidation); - } - - /// setRequiresDNSSECValidation: - set requiresDNSSECValidation(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setRequiresDNSSECValidation_, value); - } - - /// HTTPMethod - objc.NSString get HTTPMethod { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPMethod); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPMethod: - set HTTPMethod(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setHTTPMethod_, value.ref.pointer); - } - - /// allHTTPHeaderFields - objc.NSDictionary? get allHTTPHeaderFields { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allHTTPHeaderFields); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setAllHTTPHeaderFields: - set allHTTPHeaderFields(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAllHTTPHeaderFields_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setValue:forHTTPHeaderField: - void setValue_forHTTPHeaderField_(objc.NSString? value, objc.NSString field) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_setValue_forHTTPHeaderField_, - value?.ref.pointer ?? ffi.nullptr, field.ref.pointer); - } - - /// addValue:forHTTPHeaderField: - void addValue_forHTTPHeaderField_(objc.NSString value, objc.NSString field) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_addValue_forHTTPHeaderField_, - value.ref.pointer, field.ref.pointer); - } - - /// HTTPBody - objc.NSData? get HTTPBody { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBody); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPBody: - set HTTPBody(objc.NSData? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setHTTPBody_, value?.ref.pointer ?? ffi.nullptr); - } - - /// HTTPBodyStream - objc.NSInputStream? get HTTPBodyStream { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPBodyStream); - return _ret.address == 0 - ? null - : objc.NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPBodyStream: - set HTTPBodyStream(objc.NSInputStream? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setHTTPBodyStream_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// HTTPShouldHandleCookies - bool get HTTPShouldHandleCookies { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldHandleCookies); - } - - /// setHTTPShouldHandleCookies: - set HTTPShouldHandleCookies(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldHandleCookies_, value); - } - - /// HTTPShouldUsePipelining - bool get HTTPShouldUsePipelining { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldUsePipelining); - } - - /// setHTTPShouldUsePipelining: - set HTTPShouldUsePipelining(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldUsePipelining_, value); - } - - /// requestWithURL: - static NSMutableURLRequest requestWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableURLRequest, _sel_requestWithURL_, URL.ref.pointer); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// supportsSecureCoding - static bool getSupportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableURLRequest, _sel_supportsSecureCoding); - } - - /// requestWithURL:cachePolicy:timeoutInterval: - static NSMutableURLRequest requestWithURL_cachePolicy_timeoutInterval_( - objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, - double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - _class_NSMutableURLRequest, - _sel_requestWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithURL: - NSMutableURLRequest initWithURL_(objc.NSURL URL) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, URL.ref.pointer); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithURL:cachePolicy:timeoutInterval: - NSMutableURLRequest initWithURL_cachePolicy_timeoutInterval_(objc.NSURL URL, - NSURLRequestCachePolicy cachePolicy, double timeoutInterval) { - final _ret = _objc_msgSend_191svj( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_cachePolicy_timeoutInterval_, - URL.ref.pointer, - cachePolicy.value, - timeoutInterval); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// init - NSMutableURLRequest init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSMutableURLRequest new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableURLRequest, _sel_new); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSMutableURLRequest allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMutableURLRequest, _sel_allocWithZone_, zone); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSMutableURLRequest alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableURLRequest, _sel_alloc); - return NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSMutableURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSMutableURLRequest, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSMutableURLRequest, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSMutableURLRequest, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableURLRequest, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableURLRequest, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSMutableURLRequest, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableURLRequest, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableURLRequest, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSMutableURLRequest self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSMutableURLRequest retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSMutableURLRequest autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSMutableURLRequest.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithCoder: - NSMutableURLRequest? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableURLRequest.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_setProperty_forKey_inRequest_ = - objc.registerName("setProperty:forKey:inRequest:"); -late final _sel_removePropertyForKey_inRequest_ = - objc.registerName("removePropertyForKey:inRequest:"); -late final _sel_registerClass_ = objc.registerName("registerClass:"); -late final _sel_unregisterClass_ = objc.registerName("unregisterClass:"); -late final _sel_canInitWithTask_ = objc.registerName("canInitWithTask:"); -late final _sel_initWithTask_cachedResponse_client_ = - objc.registerName("initWithTask:cachedResponse:client:"); -late final _sel_task = objc.registerName("task"); - -/// NSURLProtocol -class NSURLProtocol extends objc.NSObject { - NSURLProtocol._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLProtocol] that points to the same underlying object as [other]. - NSURLProtocol.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLProtocol] that wraps the given raw object pointer. - NSURLProtocol.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLProtocol]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLProtocol); - } - - /// initWithRequest:cachedResponse:client: - NSURLProtocol initWithRequest_cachedResponse_client_(NSURLRequest request, - NSCachedURLResponse? cachedResponse, objc.ObjCObjectBase? client) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithRequest_cachedResponse_client_, - request.ref.pointer, - cachedResponse?.ref.pointer ?? ffi.nullptr, - client?.ref.pointer ?? ffi.nullptr); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// client - objc.ObjCObjectBase? get client { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_client); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// request - NSURLRequest get request { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_request); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// cachedResponse - NSCachedURLResponse? get cachedResponse { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_cachedResponse); - return _ret.address == 0 - ? null - : NSCachedURLResponse.castFromPointer(_ret, - retain: true, release: true); - } - - /// canInitWithRequest: - static bool canInitWithRequest_(NSURLRequest request) { - return _objc_msgSend_l8lotg( - _class_NSURLProtocol, _sel_canInitWithRequest_, request.ref.pointer); - } - - /// canonicalRequestForRequest: - static NSURLRequest canonicalRequestForRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7(_class_NSURLProtocol, - _sel_canonicalRequestForRequest_, request.ref.pointer); - return NSURLRequest.castFromPointer(_ret, retain: true, release: true); - } - - /// requestIsCacheEquivalent:toRequest: - static bool requestIsCacheEquivalent_toRequest_( - NSURLRequest a, NSURLRequest b) { - return _objc_msgSend_1ywe6ev(_class_NSURLProtocol, - _sel_requestIsCacheEquivalent_toRequest_, a.ref.pointer, b.ref.pointer); - } - - /// startLoading - void startLoading() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_startLoading); - } - - /// stopLoading - void stopLoading() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stopLoading); - } - - /// propertyForKey:inRequest: - static objc.ObjCObjectBase? propertyForKey_inRequest_( - objc.NSString key, NSURLRequest request) { - final _ret = _objc_msgSend_iq11qg(_class_NSURLProtocol, - _sel_propertyForKey_inRequest_, key.ref.pointer, request.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setProperty:forKey:inRequest: - static void setProperty_forKey_inRequest_(objc.ObjCObjectBase value, - objc.NSString key, NSMutableURLRequest request) { - _objc_msgSend_tenbla( - _class_NSURLProtocol, - _sel_setProperty_forKey_inRequest_, - value.ref.pointer, - key.ref.pointer, - request.ref.pointer); - } - - /// removePropertyForKey:inRequest: - static void removePropertyForKey_inRequest_( - objc.NSString key, NSMutableURLRequest request) { - _objc_msgSend_1tjlcwl( - _class_NSURLProtocol, - _sel_removePropertyForKey_inRequest_, - key.ref.pointer, - request.ref.pointer); - } - - /// registerClass: - static bool registerClass_(objc.ObjCObjectBase protocolClass) { - return _objc_msgSend_l8lotg( - _class_NSURLProtocol, _sel_registerClass_, protocolClass.ref.pointer); - } - - /// unregisterClass: - static void unregisterClass_(objc.ObjCObjectBase protocolClass) { - _objc_msgSend_ukcdfq( - _class_NSURLProtocol, _sel_unregisterClass_, protocolClass.ref.pointer); - } - - /// canInitWithTask: - static bool canInitWithTask_(NSURLSessionTask task) { - return _objc_msgSend_l8lotg( - _class_NSURLProtocol, _sel_canInitWithTask_, task.ref.pointer); - } - - /// initWithTask:cachedResponse:client: - NSURLProtocol initWithTask_cachedResponse_client_(NSURLSessionTask task, - NSCachedURLResponse? cachedResponse, objc.ObjCObjectBase? client) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithTask_cachedResponse_client_, - task.ref.pointer, - cachedResponse?.ref.pointer ?? ffi.nullptr, - client?.ref.pointer ?? ffi.nullptr); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// task - NSURLSessionTask? get task { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_task); - return _ret.address == 0 - ? null - : NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLProtocol init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLProtocol new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtocol, _sel_new); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSURLProtocol allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLProtocol, _sel_allocWithZone_, zone); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLProtocol alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLProtocol, _sel_alloc); - return NSURLProtocol.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLProtocol, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLProtocol, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLProtocol, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLProtocol, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLProtocol, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLProtocol, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLProtocol, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtocol, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLProtocol, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLProtocol self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLProtocol.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLProtocol retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLProtocol.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLProtocol autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLProtocol.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSXMLParser = objc.getClass("NSXMLParser"); -late final _sel_initWithContentsOfURL_ = - objc.registerName("initWithContentsOfURL:"); -late final _sel_initWithData_ = objc.registerName("initWithData:"); -late final _sel_initWithStream_ = objc.registerName("initWithStream:"); -late final _sel_shouldProcessNamespaces = - objc.registerName("shouldProcessNamespaces"); -late final _sel_setShouldProcessNamespaces_ = - objc.registerName("setShouldProcessNamespaces:"); -late final _sel_shouldReportNamespacePrefixes = - objc.registerName("shouldReportNamespacePrefixes"); -late final _sel_setShouldReportNamespacePrefixes_ = - objc.registerName("setShouldReportNamespacePrefixes:"); - -enum NSXMLParserExternalEntityResolvingPolicy { - NSXMLParserResolveExternalEntitiesNever(0), - NSXMLParserResolveExternalEntitiesNoNetwork(1), - NSXMLParserResolveExternalEntitiesSameOriginOnly(2), - NSXMLParserResolveExternalEntitiesAlways(3); - - final int value; - const NSXMLParserExternalEntityResolvingPolicy(this.value); - - static NSXMLParserExternalEntityResolvingPolicy fromValue(int value) => - switch (value) { - 0 => NSXMLParserResolveExternalEntitiesNever, - 1 => NSXMLParserResolveExternalEntitiesNoNetwork, - 2 => NSXMLParserResolveExternalEntitiesSameOriginOnly, - 3 => NSXMLParserResolveExternalEntitiesAlways, - _ => throw ArgumentError( - "Unknown value for NSXMLParserExternalEntityResolvingPolicy: $value"), - }; -} - -late final _sel_externalEntityResolvingPolicy = - objc.registerName("externalEntityResolvingPolicy"); -final _objc_msgSend_6drw9t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setExternalEntityResolvingPolicy_ = - objc.registerName("setExternalEntityResolvingPolicy:"); -final _objc_msgSend_1277g64 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_allowedExternalEntityURLs = - objc.registerName("allowedExternalEntityURLs"); -late final _sel_setAllowedExternalEntityURLs_ = - objc.registerName("setAllowedExternalEntityURLs:"); -late final _sel_parse = objc.registerName("parse"); -late final _sel_abortParsing = objc.registerName("abortParsing"); -late final _sel_parserError = objc.registerName("parserError"); -late final _sel_shouldResolveExternalEntities = - objc.registerName("shouldResolveExternalEntities"); -late final _sel_setShouldResolveExternalEntities_ = - objc.registerName("setShouldResolveExternalEntities:"); -late final _sel_publicID = objc.registerName("publicID"); -late final _sel_systemID = objc.registerName("systemID"); -late final _sel_lineNumber = objc.registerName("lineNumber"); -late final _sel_columnNumber = objc.registerName("columnNumber"); - -/// NSXMLParser -class NSXMLParser extends objc.NSObject { - NSXMLParser._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLParser] that points to the same underlying object as [other]. - NSXMLParser.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLParser] that wraps the given raw object pointer. - NSXMLParser.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLParser]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLParser); - } - - /// initWithContentsOfURL: - NSXMLParser? initWithContentsOfURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithData: - NSXMLParser initWithData_(objc.NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithData_, data.ref.pointer); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithStream: - NSXMLParser initWithStream_(objc.NSInputStream stream) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithStream_, stream.ref.pointer); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// shouldProcessNamespaces - bool get shouldProcessNamespaces { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_shouldProcessNamespaces); - } - - /// setShouldProcessNamespaces: - set shouldProcessNamespaces(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldProcessNamespaces_, value); - } - - /// shouldReportNamespacePrefixes - bool get shouldReportNamespacePrefixes { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_shouldReportNamespacePrefixes); - } - - /// setShouldReportNamespacePrefixes: - set shouldReportNamespacePrefixes(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldReportNamespacePrefixes_, value); - } - - /// externalEntityResolvingPolicy - NSXMLParserExternalEntityResolvingPolicy get externalEntityResolvingPolicy { - final _ret = _objc_msgSend_6drw9t( - this.ref.pointer, _sel_externalEntityResolvingPolicy); - return NSXMLParserExternalEntityResolvingPolicy.fromValue(_ret); - } - - /// setExternalEntityResolvingPolicy: - set externalEntityResolvingPolicy( - NSXMLParserExternalEntityResolvingPolicy value) { - return _objc_msgSend_1277g64( - this.ref.pointer, _sel_setExternalEntityResolvingPolicy_, value.value); - } - - /// allowedExternalEntityURLs - objc.NSSet? get allowedExternalEntityURLs { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allowedExternalEntityURLs); - return _ret.address == 0 - ? null - : objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setAllowedExternalEntityURLs: - set allowedExternalEntityURLs(objc.NSSet? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setAllowedExternalEntityURLs_, value?.ref.pointer ?? ffi.nullptr); - } - - /// parse - bool parse() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_parse); - } - - /// abortParsing - void abortParsing() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_abortParsing); - } - - /// parserError - objc.NSError? get parserError { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_parserError); - return _ret.address == 0 - ? null - : objc.NSError.castFromPointer(_ret, retain: true, release: true); - } - - /// shouldResolveExternalEntities - bool get shouldResolveExternalEntities { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_shouldResolveExternalEntities); - } - - /// setShouldResolveExternalEntities: - set shouldResolveExternalEntities(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldResolveExternalEntities_, value); - } - - /// publicID - objc.NSString? get publicID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_publicID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// systemID - objc.NSString? get systemID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_systemID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// lineNumber - int get lineNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_lineNumber); - } - - /// columnNumber - int get columnNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_columnNumber); - } - - /// init - NSXMLParser init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSXMLParser new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLParser, _sel_new); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSXMLParser allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSXMLParser, _sel_allocWithZone_, zone); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSXMLParser alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLParser, _sel_alloc); - return NSXMLParser.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSXMLParser, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSXMLParser, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSXMLParser, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSXMLParser, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLParser, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSXMLParser, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSXMLParser, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLParser, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSXMLParser, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSXMLParser self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSXMLParser.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSXMLParser retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSXMLParser.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSXMLParser autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSXMLParser.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSFileWrapper = objc.getClass("NSFileWrapper"); - -enum NSFileWrapperReadingOptions { - NSFileWrapperReadingImmediate(1), - NSFileWrapperReadingWithoutMapping(2); - - final int value; - const NSFileWrapperReadingOptions(this.value); - - static NSFileWrapperReadingOptions fromValue(int value) => switch (value) { - 1 => NSFileWrapperReadingImmediate, - 2 => NSFileWrapperReadingWithoutMapping, - _ => throw ArgumentError( - "Unknown value for NSFileWrapperReadingOptions: $value"), - }; -} - -late final _sel_initWithURL_options_error_ = - objc.registerName("initWithURL:options:error:"); -final _objc_msgSend_g0dcla = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_initDirectoryWithFileWrappers_ = - objc.registerName("initDirectoryWithFileWrappers:"); -late final _sel_initRegularFileWithContents_ = - objc.registerName("initRegularFileWithContents:"); -late final _sel_initSymbolicLinkWithDestinationURL_ = - objc.registerName("initSymbolicLinkWithDestinationURL:"); -late final _sel_initWithSerializedRepresentation_ = - objc.registerName("initWithSerializedRepresentation:"); -late final _sel_isDirectory = objc.registerName("isDirectory"); -late final _sel_isRegularFile = objc.registerName("isRegularFile"); -late final _sel_isSymbolicLink = objc.registerName("isSymbolicLink"); -late final _sel_preferredFilename = objc.registerName("preferredFilename"); -late final _sel_setPreferredFilename_ = - objc.registerName("setPreferredFilename:"); -late final _sel_filename = objc.registerName("filename"); -late final _sel_setFilename_ = objc.registerName("setFilename:"); -late final _sel_fileAttributes = objc.registerName("fileAttributes"); -late final _sel_setFileAttributes_ = objc.registerName("setFileAttributes:"); -late final _sel_matchesContentsOfURL_ = - objc.registerName("matchesContentsOfURL:"); -late final _sel_readFromURL_options_error_ = - objc.registerName("readFromURL:options:error:"); -final _objc_msgSend_138eppz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); - -enum NSFileWrapperWritingOptions { - NSFileWrapperWritingAtomic(1), - NSFileWrapperWritingWithNameUpdating(2); - - final int value; - const NSFileWrapperWritingOptions(this.value); - - static NSFileWrapperWritingOptions fromValue(int value) => switch (value) { - 1 => NSFileWrapperWritingAtomic, - 2 => NSFileWrapperWritingWithNameUpdating, - _ => throw ArgumentError( - "Unknown value for NSFileWrapperWritingOptions: $value"), - }; -} - -late final _sel_writeToURL_options_originalContentsURL_error_ = - objc.registerName("writeToURL:options:originalContentsURL:error:"); -final _objc_msgSend_nrvb12 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_serializedRepresentation = - objc.registerName("serializedRepresentation"); -late final _sel_addFileWrapper_ = objc.registerName("addFileWrapper:"); -late final _sel_addRegularFileWithContents_preferredFilename_ = - objc.registerName("addRegularFileWithContents:preferredFilename:"); -late final _sel_removeFileWrapper_ = objc.registerName("removeFileWrapper:"); -late final _sel_fileWrappers = objc.registerName("fileWrappers"); -late final _sel_keyForFileWrapper_ = objc.registerName("keyForFileWrapper:"); -late final _sel_regularFileContents = objc.registerName("regularFileContents"); -late final _sel_symbolicLinkDestinationURL = - objc.registerName("symbolicLinkDestinationURL"); -late final _sel_initSymbolicLinkWithDestination_ = - objc.registerName("initSymbolicLinkWithDestination:"); -late final _sel_needsToBeUpdatedFromPath_ = - objc.registerName("needsToBeUpdatedFromPath:"); -late final _sel_updateFromPath_ = objc.registerName("updateFromPath:"); -late final _sel_writeToFile_atomically_updateFilenames_ = - objc.registerName("writeToFile:atomically:updateFilenames:"); -final _objc_msgSend_1vcrzki = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Bool)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool, - bool)>(); -late final _sel_addFileWithPath_ = objc.registerName("addFileWithPath:"); -late final _sel_addSymbolicLinkWithDestination_preferredFilename_ = - objc.registerName("addSymbolicLinkWithDestination:preferredFilename:"); -late final _sel_symbolicLinkDestination = - objc.registerName("symbolicLinkDestination"); - -/// NSFileWrapper -class NSFileWrapper extends objc.NSObject { - NSFileWrapper._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSFileWrapper] that points to the same underlying object as [other]. - NSFileWrapper.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSFileWrapper] that wraps the given raw object pointer. - NSFileWrapper.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSFileWrapper]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSFileWrapper); - } - - /// initWithURL:options:error: - NSFileWrapper? initWithURL_options_error_( - objc.NSURL url, - NSFileWrapperReadingOptions options, - ffi.Pointer> outError) { - final _ret = _objc_msgSend_g0dcla( - this.ref.retainAndReturnPointer(), - _sel_initWithURL_options_error_, - url.ref.pointer, - options.value, - outError); - return _ret.address == 0 - ? null - : NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initDirectoryWithFileWrappers: - NSFileWrapper initDirectoryWithFileWrappers_( - objc.NSDictionary childrenByPreferredName) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), - _sel_initDirectoryWithFileWrappers_, - childrenByPreferredName.ref.pointer); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initRegularFileWithContents: - NSFileWrapper initRegularFileWithContents_(objc.NSData contents) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initRegularFileWithContents_, contents.ref.pointer); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initSymbolicLinkWithDestinationURL: - NSFileWrapper initSymbolicLinkWithDestinationURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initSymbolicLinkWithDestinationURL_, url.ref.pointer); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithSerializedRepresentation: - NSFileWrapper? initWithSerializedRepresentation_( - objc.NSData serializeRepresentation) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), - _sel_initWithSerializedRepresentation_, - serializeRepresentation.ref.pointer); - return _ret.address == 0 - ? null - : NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSFileWrapper? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// isDirectory - bool get directory { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isDirectory); - } - - /// isRegularFile - bool get regularFile { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isRegularFile); - } - - /// isSymbolicLink - bool get symbolicLink { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isSymbolicLink); - } - - /// preferredFilename - objc.NSString? get preferredFilename { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_preferredFilename); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPreferredFilename: - set preferredFilename(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setPreferredFilename_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// filename - objc.NSString? get filename { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_filename); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setFilename: - set filename(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFilename_, value?.ref.pointer ?? ffi.nullptr); - } - - /// fileAttributes - objc.NSDictionary get fileAttributes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileAttributes); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setFileAttributes: - set fileAttributes(objc.NSDictionary value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setFileAttributes_, value.ref.pointer); - } - - /// matchesContentsOfURL: - bool matchesContentsOfURL_(objc.NSURL url) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_matchesContentsOfURL_, url.ref.pointer); - } - - /// readFromURL:options:error: - bool readFromURL_options_error_( - objc.NSURL url, - NSFileWrapperReadingOptions options, - ffi.Pointer> outError) { - return _objc_msgSend_138eppz( - this.ref.pointer, - _sel_readFromURL_options_error_, - url.ref.pointer, - options.value, - outError); - } - - /// writeToURL:options:originalContentsURL:error: - bool writeToURL_options_originalContentsURL_error_( - objc.NSURL url, - NSFileWrapperWritingOptions options, - objc.NSURL? originalContentsURL, - ffi.Pointer> outError) { - return _objc_msgSend_nrvb12( - this.ref.pointer, - _sel_writeToURL_options_originalContentsURL_error_, - url.ref.pointer, - options.value, - originalContentsURL?.ref.pointer ?? ffi.nullptr, - outError); - } - - /// serializedRepresentation - objc.NSData? get serializedRepresentation { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_serializedRepresentation); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// addFileWrapper: - objc.NSString addFileWrapper_(NSFileWrapper child) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_addFileWrapper_, child.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addRegularFileWithContents:preferredFilename: - objc.NSString addRegularFileWithContents_preferredFilename_( - objc.NSData data, objc.NSString fileName) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_addRegularFileWithContents_preferredFilename_, - data.ref.pointer, - fileName.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// removeFileWrapper: - void removeFileWrapper_(NSFileWrapper child) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeFileWrapper_, child.ref.pointer); - } - - /// fileWrappers - objc.NSDictionary? get fileWrappers { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileWrappers); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// keyForFileWrapper: - objc.NSString? keyForFileWrapper_(NSFileWrapper child) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_keyForFileWrapper_, child.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// regularFileContents - objc.NSData? get regularFileContents { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_regularFileContents); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// symbolicLinkDestinationURL - objc.NSURL? get symbolicLinkDestinationURL { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_symbolicLinkDestinationURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithPath: - objc.ObjCObjectBase? initWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// initSymbolicLinkWithDestination: - objc.ObjCObjectBase initSymbolicLinkWithDestination_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initSymbolicLinkWithDestination_, path.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// needsToBeUpdatedFromPath: - bool needsToBeUpdatedFromPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_needsToBeUpdatedFromPath_, path.ref.pointer); - } - - /// updateFromPath: - bool updateFromPath_(objc.NSString path) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_updateFromPath_, path.ref.pointer); - } - - /// writeToFile:atomically:updateFilenames: - bool writeToFile_atomically_updateFilenames_( - objc.NSString path, bool atomicFlag, bool updateFilenamesFlag) { - return _objc_msgSend_1vcrzki( - this.ref.pointer, - _sel_writeToFile_atomically_updateFilenames_, - path.ref.pointer, - atomicFlag, - updateFilenamesFlag); - } - - /// addFileWithPath: - objc.NSString addFileWithPath_(objc.NSString path) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_addFileWithPath_, path.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addSymbolicLinkWithDestination:preferredFilename: - objc.NSString addSymbolicLinkWithDestination_preferredFilename_( - objc.NSString path, objc.NSString filename) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_addSymbolicLinkWithDestination_preferredFilename_, - path.ref.pointer, - filename.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// symbolicLinkDestination - objc.NSString symbolicLinkDestination() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_symbolicLinkDestination); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSFileWrapper init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSFileWrapper new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileWrapper, _sel_new); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSFileWrapper allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSFileWrapper, _sel_allocWithZone_, zone); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSFileWrapper alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSFileWrapper, _sel_alloc); - return NSFileWrapper.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSFileWrapper, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSFileWrapper, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSFileWrapper, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSFileWrapper, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSFileWrapper, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSFileWrapper, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSFileWrapper, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileWrapper, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSFileWrapper, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSFileWrapper self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSFileWrapper.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSFileWrapper retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSFileWrapper.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSFileWrapper autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSFileWrapper.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSFileWrapper, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _class_NSURLSession = objc.getClass("NSURLSession"); -late final _sel_sharedSession = objc.registerName("sharedSession"); -late final _class_NSURLSessionConfiguration = - objc.getClass("NSURLSessionConfiguration"); -late final _sel_defaultSessionConfiguration = - objc.registerName("defaultSessionConfiguration"); -late final _sel_ephemeralSessionConfiguration = - objc.registerName("ephemeralSessionConfiguration"); -late final _sel_backgroundSessionConfigurationWithIdentifier_ = - objc.registerName("backgroundSessionConfigurationWithIdentifier:"); -late final _sel_identifier = objc.registerName("identifier"); -late final _sel_requestCachePolicy = objc.registerName("requestCachePolicy"); -late final _sel_setRequestCachePolicy_ = - objc.registerName("setRequestCachePolicy:"); -late final _sel_timeoutIntervalForRequest = - objc.registerName("timeoutIntervalForRequest"); -late final _sel_setTimeoutIntervalForRequest_ = - objc.registerName("setTimeoutIntervalForRequest:"); -late final _sel_timeoutIntervalForResource = - objc.registerName("timeoutIntervalForResource"); -late final _sel_setTimeoutIntervalForResource_ = - objc.registerName("setTimeoutIntervalForResource:"); -late final _sel_waitsForConnectivity = - objc.registerName("waitsForConnectivity"); -late final _sel_setWaitsForConnectivity_ = - objc.registerName("setWaitsForConnectivity:"); -late final _sel_isDiscretionary = objc.registerName("isDiscretionary"); -late final _sel_setDiscretionary_ = objc.registerName("setDiscretionary:"); -late final _sel_sharedContainerIdentifier = - objc.registerName("sharedContainerIdentifier"); -late final _sel_setSharedContainerIdentifier_ = - objc.registerName("setSharedContainerIdentifier:"); -late final _sel_sessionSendsLaunchEvents = - objc.registerName("sessionSendsLaunchEvents"); -late final _sel_setSessionSendsLaunchEvents_ = - objc.registerName("setSessionSendsLaunchEvents:"); -late final _sel_connectionProxyDictionary = - objc.registerName("connectionProxyDictionary"); -late final _sel_setConnectionProxyDictionary_ = - objc.registerName("setConnectionProxyDictionary:"); - -enum SSLProtocol { - kSSLProtocolUnknown(0), - kTLSProtocol1(4), - kTLSProtocol11(7), - kTLSProtocol12(8), - kDTLSProtocol1(9), - kTLSProtocol13(10), - kDTLSProtocol12(11), - kTLSProtocolMaxSupported(999), - kSSLProtocol2(1), - kSSLProtocol3(2), - kSSLProtocol3Only(3), - kTLSProtocol1Only(5), - kSSLProtocolAll(6); - - final int value; - const SSLProtocol(this.value); - - static SSLProtocol fromValue(int value) => switch (value) { - 0 => kSSLProtocolUnknown, - 4 => kTLSProtocol1, - 7 => kTLSProtocol11, - 8 => kTLSProtocol12, - 9 => kDTLSProtocol1, - 10 => kTLSProtocol13, - 11 => kDTLSProtocol12, - 999 => kTLSProtocolMaxSupported, - 1 => kSSLProtocol2, - 2 => kSSLProtocol3, - 3 => kSSLProtocol3Only, - 5 => kTLSProtocol1Only, - 6 => kSSLProtocolAll, - _ => throw ArgumentError("Unknown value for SSLProtocol: $value"), - }; -} - -late final _sel_TLSMinimumSupportedProtocol = - objc.registerName("TLSMinimumSupportedProtocol"); -final _objc_msgSend_ewo6ux = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setTLSMinimumSupportedProtocol_ = - objc.registerName("setTLSMinimumSupportedProtocol:"); -final _objc_msgSend_hcgw10 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_TLSMaximumSupportedProtocol = - objc.registerName("TLSMaximumSupportedProtocol"); -late final _sel_setTLSMaximumSupportedProtocol_ = - objc.registerName("setTLSMaximumSupportedProtocol:"); - -enum tls_protocol_version_t { - tls_protocol_version_TLSv10(769), - tls_protocol_version_TLSv11(770), - tls_protocol_version_TLSv12(771), - tls_protocol_version_TLSv13(772), - tls_protocol_version_DTLSv10(-257), - tls_protocol_version_DTLSv12(-259); - - final int value; - const tls_protocol_version_t(this.value); - - static tls_protocol_version_t fromValue(int value) => switch (value) { - 769 => tls_protocol_version_TLSv10, - 770 => tls_protocol_version_TLSv11, - 771 => tls_protocol_version_TLSv12, - 772 => tls_protocol_version_TLSv13, - -257 => tls_protocol_version_DTLSv10, - -259 => tls_protocol_version_DTLSv12, - _ => throw ArgumentError( - "Unknown value for tls_protocol_version_t: $value"), - }; -} - -late final _sel_TLSMinimumSupportedProtocolVersion = - objc.registerName("TLSMinimumSupportedProtocolVersion"); -final _objc_msgSend_a6qtz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Uint16 Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setTLSMinimumSupportedProtocolVersion_ = - objc.registerName("setTLSMinimumSupportedProtocolVersion:"); -final _objc_msgSend_yb8bfm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Uint16)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_TLSMaximumSupportedProtocolVersion = - objc.registerName("TLSMaximumSupportedProtocolVersion"); -late final _sel_setTLSMaximumSupportedProtocolVersion_ = - objc.registerName("setTLSMaximumSupportedProtocolVersion:"); -late final _sel_HTTPShouldSetCookies = - objc.registerName("HTTPShouldSetCookies"); -late final _sel_setHTTPShouldSetCookies_ = - objc.registerName("setHTTPShouldSetCookies:"); -late final _sel_HTTPCookieAcceptPolicy = - objc.registerName("HTTPCookieAcceptPolicy"); -late final _sel_setHTTPCookieAcceptPolicy_ = - objc.registerName("setHTTPCookieAcceptPolicy:"); -late final _sel_HTTPAdditionalHeaders = - objc.registerName("HTTPAdditionalHeaders"); -late final _sel_setHTTPAdditionalHeaders_ = - objc.registerName("setHTTPAdditionalHeaders:"); -late final _sel_HTTPMaximumConnectionsPerHost = - objc.registerName("HTTPMaximumConnectionsPerHost"); -late final _sel_setHTTPMaximumConnectionsPerHost_ = - objc.registerName("setHTTPMaximumConnectionsPerHost:"); -late final _sel_HTTPCookieStorage = objc.registerName("HTTPCookieStorage"); -late final _sel_setHTTPCookieStorage_ = - objc.registerName("setHTTPCookieStorage:"); -late final _sel_URLCredentialStorage = - objc.registerName("URLCredentialStorage"); -late final _sel_setURLCredentialStorage_ = - objc.registerName("setURLCredentialStorage:"); -late final _sel_URLCache = objc.registerName("URLCache"); -late final _sel_setURLCache_ = objc.registerName("setURLCache:"); -late final _sel_shouldUseExtendedBackgroundIdleMode = - objc.registerName("shouldUseExtendedBackgroundIdleMode"); -late final _sel_setShouldUseExtendedBackgroundIdleMode_ = - objc.registerName("setShouldUseExtendedBackgroundIdleMode:"); -late final _sel_protocolClasses = objc.registerName("protocolClasses"); -late final _sel_setProtocolClasses_ = objc.registerName("setProtocolClasses:"); - -enum NSURLSessionMultipathServiceType { - NSURLSessionMultipathServiceTypeNone(0), - NSURLSessionMultipathServiceTypeHandover(1), - NSURLSessionMultipathServiceTypeInteractive(2), - NSURLSessionMultipathServiceTypeAggregate(3); - - final int value; - const NSURLSessionMultipathServiceType(this.value); - - static NSURLSessionMultipathServiceType fromValue(int value) => - switch (value) { - 0 => NSURLSessionMultipathServiceTypeNone, - 1 => NSURLSessionMultipathServiceTypeHandover, - 2 => NSURLSessionMultipathServiceTypeInteractive, - 3 => NSURLSessionMultipathServiceTypeAggregate, - _ => throw ArgumentError( - "Unknown value for NSURLSessionMultipathServiceType: $value"), - }; -} - -late final _sel_multipathServiceType = - objc.registerName("multipathServiceType"); -final _objc_msgSend_zqvllq = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setMultipathServiceType_ = - objc.registerName("setMultipathServiceType:"); -final _objc_msgSend_1ngj1qh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_backgroundSessionConfiguration_ = - objc.registerName("backgroundSessionConfiguration:"); - -/// NSURLSessionConfiguration -class NSURLSessionConfiguration extends objc.NSObject { - NSURLSessionConfiguration._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionConfiguration] that points to the same underlying object as [other]. - NSURLSessionConfiguration.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionConfiguration] that wraps the given raw object pointer. - NSURLSessionConfiguration.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionConfiguration]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionConfiguration); - } - - /// defaultSessionConfiguration - static NSURLSessionConfiguration getDefaultSessionConfiguration() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_defaultSessionConfiguration); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// ephemeralSessionConfiguration - static NSURLSessionConfiguration getEphemeralSessionConfiguration() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_ephemeralSessionConfiguration); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// backgroundSessionConfigurationWithIdentifier: - static NSURLSessionConfiguration - backgroundSessionConfigurationWithIdentifier_(objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7( - _class_NSURLSessionConfiguration, - _sel_backgroundSessionConfigurationWithIdentifier_, - identifier.ref.pointer); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// identifier - objc.NSString? get identifier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_identifier); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// requestCachePolicy - NSURLRequestCachePolicy get requestCachePolicy { - final _ret = - _objc_msgSend_2xak1q(this.ref.pointer, _sel_requestCachePolicy); - return NSURLRequestCachePolicy.fromValue(_ret); - } - - /// setRequestCachePolicy: - set requestCachePolicy(NSURLRequestCachePolicy value) { - return _objc_msgSend_12vaadl( - this.ref.pointer, _sel_setRequestCachePolicy_, value.value); - } - - /// timeoutIntervalForRequest - double get timeoutIntervalForRequest { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_timeoutIntervalForRequest) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_timeoutIntervalForRequest); - } - - /// setTimeoutIntervalForRequest: - set timeoutIntervalForRequest(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setTimeoutIntervalForRequest_, value); - } - - /// timeoutIntervalForResource - double get timeoutIntervalForResource { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_timeoutIntervalForResource) - : _objc_msgSend_10noklm( - this.ref.pointer, _sel_timeoutIntervalForResource); - } - - /// setTimeoutIntervalForResource: - set timeoutIntervalForResource(double value) { - return _objc_msgSend_suh039( - this.ref.pointer, _sel_setTimeoutIntervalForResource_, value); - } - - /// networkServiceType - NSURLRequestNetworkServiceType get networkServiceType { - final _ret = - _objc_msgSend_ttt73t(this.ref.pointer, _sel_networkServiceType); - return NSURLRequestNetworkServiceType.fromValue(_ret); - } - - /// setNetworkServiceType: - set networkServiceType(NSURLRequestNetworkServiceType value) { - return _objc_msgSend_br89tg( - this.ref.pointer, _sel_setNetworkServiceType_, value.value); - } - - /// allowsCellularAccess - bool get allowsCellularAccess { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_allowsCellularAccess); - } - - /// setAllowsCellularAccess: - set allowsCellularAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsCellularAccess_, value); - } - - /// allowsExpensiveNetworkAccess - bool get allowsExpensiveNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsExpensiveNetworkAccess); - } - - /// setAllowsExpensiveNetworkAccess: - set allowsExpensiveNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsExpensiveNetworkAccess_, value); - } - - /// allowsConstrainedNetworkAccess - bool get allowsConstrainedNetworkAccess { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_allowsConstrainedNetworkAccess); - } - - /// setAllowsConstrainedNetworkAccess: - set allowsConstrainedNetworkAccess(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setAllowsConstrainedNetworkAccess_, value); - } - - /// requiresDNSSECValidation - bool get requiresDNSSECValidation { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_requiresDNSSECValidation); - } - - /// setRequiresDNSSECValidation: - set requiresDNSSECValidation(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setRequiresDNSSECValidation_, value); - } - - /// waitsForConnectivity - bool get waitsForConnectivity { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_waitsForConnectivity); - } - - /// setWaitsForConnectivity: - set waitsForConnectivity(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setWaitsForConnectivity_, value); - } - - /// isDiscretionary - bool get discretionary { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isDiscretionary); - } - - /// setDiscretionary: - set discretionary(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setDiscretionary_, value); - } - - /// sharedContainerIdentifier - objc.NSString? get sharedContainerIdentifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sharedContainerIdentifier); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSharedContainerIdentifier: - set sharedContainerIdentifier(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setSharedContainerIdentifier_, value?.ref.pointer ?? ffi.nullptr); - } - - /// sessionSendsLaunchEvents - bool get sessionSendsLaunchEvents { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_sessionSendsLaunchEvents); - } - - /// setSessionSendsLaunchEvents: - set sessionSendsLaunchEvents(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setSessionSendsLaunchEvents_, value); - } - - /// connectionProxyDictionary - objc.NSDictionary? get connectionProxyDictionary { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_connectionProxyDictionary); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setConnectionProxyDictionary: - set connectionProxyDictionary(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setConnectionProxyDictionary_, value?.ref.pointer ?? ffi.nullptr); - } - - /// TLSMinimumSupportedProtocol - SSLProtocol get TLSMinimumSupportedProtocol { - final _ret = _objc_msgSend_ewo6ux( - this.ref.pointer, _sel_TLSMinimumSupportedProtocol); - return SSLProtocol.fromValue(_ret); - } - - /// setTLSMinimumSupportedProtocol: - set TLSMinimumSupportedProtocol(SSLProtocol value) { - return _objc_msgSend_hcgw10( - this.ref.pointer, _sel_setTLSMinimumSupportedProtocol_, value.value); - } - - /// TLSMaximumSupportedProtocol - SSLProtocol get TLSMaximumSupportedProtocol { - final _ret = _objc_msgSend_ewo6ux( - this.ref.pointer, _sel_TLSMaximumSupportedProtocol); - return SSLProtocol.fromValue(_ret); - } - - /// setTLSMaximumSupportedProtocol: - set TLSMaximumSupportedProtocol(SSLProtocol value) { - return _objc_msgSend_hcgw10( - this.ref.pointer, _sel_setTLSMaximumSupportedProtocol_, value.value); - } - - /// TLSMinimumSupportedProtocolVersion - tls_protocol_version_t get TLSMinimumSupportedProtocolVersion { - final _ret = _objc_msgSend_a6qtz( - this.ref.pointer, _sel_TLSMinimumSupportedProtocolVersion); - return tls_protocol_version_t.fromValue(_ret); - } - - /// setTLSMinimumSupportedProtocolVersion: - set TLSMinimumSupportedProtocolVersion(tls_protocol_version_t value) { - return _objc_msgSend_yb8bfm(this.ref.pointer, - _sel_setTLSMinimumSupportedProtocolVersion_, value.value); - } - - /// TLSMaximumSupportedProtocolVersion - tls_protocol_version_t get TLSMaximumSupportedProtocolVersion { - final _ret = _objc_msgSend_a6qtz( - this.ref.pointer, _sel_TLSMaximumSupportedProtocolVersion); - return tls_protocol_version_t.fromValue(_ret); - } - - /// setTLSMaximumSupportedProtocolVersion: - set TLSMaximumSupportedProtocolVersion(tls_protocol_version_t value) { - return _objc_msgSend_yb8bfm(this.ref.pointer, - _sel_setTLSMaximumSupportedProtocolVersion_, value.value); - } - - /// HTTPShouldUsePipelining - bool get HTTPShouldUsePipelining { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldUsePipelining); - } - - /// setHTTPShouldUsePipelining: - set HTTPShouldUsePipelining(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldUsePipelining_, value); - } - - /// HTTPShouldSetCookies - bool get HTTPShouldSetCookies { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_HTTPShouldSetCookies); - } - - /// setHTTPShouldSetCookies: - set HTTPShouldSetCookies(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setHTTPShouldSetCookies_, value); - } - - /// HTTPCookieAcceptPolicy - NSHTTPCookieAcceptPolicy get HTTPCookieAcceptPolicy { - final _ret = - _objc_msgSend_1jpuqgg(this.ref.pointer, _sel_HTTPCookieAcceptPolicy); - return NSHTTPCookieAcceptPolicy.fromValue(_ret); - } - - /// setHTTPCookieAcceptPolicy: - set HTTPCookieAcceptPolicy(NSHTTPCookieAcceptPolicy value) { - return _objc_msgSend_199e8fv( - this.ref.pointer, _sel_setHTTPCookieAcceptPolicy_, value.value); - } - - /// HTTPAdditionalHeaders - objc.NSDictionary? get HTTPAdditionalHeaders { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPAdditionalHeaders); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setHTTPAdditionalHeaders: - set HTTPAdditionalHeaders(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setHTTPAdditionalHeaders_, value?.ref.pointer ?? ffi.nullptr); - } - - /// HTTPMaximumConnectionsPerHost - int get HTTPMaximumConnectionsPerHost { - return _objc_msgSend_z1fx1b( - this.ref.pointer, _sel_HTTPMaximumConnectionsPerHost); - } - - /// setHTTPMaximumConnectionsPerHost: - set HTTPMaximumConnectionsPerHost(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setHTTPMaximumConnectionsPerHost_, value); - } - - /// HTTPCookieStorage - NSHTTPCookieStorage? get HTTPCookieStorage { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_HTTPCookieStorage); - return _ret.address == 0 - ? null - : NSHTTPCookieStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// setHTTPCookieStorage: - set HTTPCookieStorage(NSHTTPCookieStorage? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setHTTPCookieStorage_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// URLCredentialStorage - NSURLCredentialStorage? get URLCredentialStorage { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URLCredentialStorage); - return _ret.address == 0 - ? null - : NSURLCredentialStorage.castFromPointer(_ret, - retain: true, release: true); - } - - /// setURLCredentialStorage: - set URLCredentialStorage(NSURLCredentialStorage? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setURLCredentialStorage_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// URLCache - NSURLCache? get URLCache { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URLCache); - return _ret.address == 0 - ? null - : NSURLCache.castFromPointer(_ret, retain: true, release: true); - } - - /// setURLCache: - set URLCache(NSURLCache? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setURLCache_, value?.ref.pointer ?? ffi.nullptr); - } - - /// shouldUseExtendedBackgroundIdleMode - bool get shouldUseExtendedBackgroundIdleMode { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_shouldUseExtendedBackgroundIdleMode); - } - - /// setShouldUseExtendedBackgroundIdleMode: - set shouldUseExtendedBackgroundIdleMode(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setShouldUseExtendedBackgroundIdleMode_, value); - } - - /// protocolClasses - objc.NSArray? get protocolClasses { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_protocolClasses); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setProtocolClasses: - set protocolClasses(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setProtocolClasses_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// multipathServiceType - NSURLSessionMultipathServiceType get multipathServiceType { - final _ret = - _objc_msgSend_zqvllq(this.ref.pointer, _sel_multipathServiceType); - return NSURLSessionMultipathServiceType.fromValue(_ret); - } - - /// setMultipathServiceType: - set multipathServiceType(NSURLSessionMultipathServiceType value) { - return _objc_msgSend_1ngj1qh( - this.ref.pointer, _sel_setMultipathServiceType_, value.value); - } - - /// init - NSURLSessionConfiguration init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionConfiguration new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionConfiguration, _sel_new); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// backgroundSessionConfiguration: - static NSURLSessionConfiguration backgroundSessionConfiguration_( - objc.NSString identifier) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionConfiguration, - _sel_backgroundSessionConfiguration_, identifier.ref.pointer); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// allocWithZone: - static NSURLSessionConfiguration allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionConfiguration, _sel_allocWithZone_, zone); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionConfiguration alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionConfiguration, _sel_alloc); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionConfiguration, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionConfiguration, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionConfiguration, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionConfiguration, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionConfiguration, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionConfiguration, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionConfiguration, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionConfiguration, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionConfiguration self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionConfiguration retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionConfiguration autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_sessionWithConfiguration_ = - objc.registerName("sessionWithConfiguration:"); -late final _sel_sessionWithConfiguration_delegate_delegateQueue_ = - objc.registerName("sessionWithConfiguration:delegate:delegateQueue:"); -late final _sel_delegateQueue = objc.registerName("delegateQueue"); -late final _sel_configuration = objc.registerName("configuration"); -late final _sel_sessionDescription = objc.registerName("sessionDescription"); -late final _sel_setSessionDescription_ = - objc.registerName("setSessionDescription:"); -late final _sel_finishTasksAndInvalidate = - objc.registerName("finishTasksAndInvalidate"); -late final _sel_invalidateAndCancel = objc.registerName("invalidateAndCancel"); -late final _sel_resetWithCompletionHandler_ = - objc.registerName("resetWithCompletionHandler:"); -late final _sel_flushWithCompletionHandler_ = - objc.registerName("flushWithCompletionHandler:"); -void _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSArray_NSArray_NSArray { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSArray, objc.NSArray, - objc.NSArray)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSArray, objc.NSArray, objc.NSArray) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - objc.NSArray.castFromPointer(arg0, retain: true, release: true), - objc.NSArray.castFromPointer(arg1, retain: true, release: true), - objc.NSArray.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(objc.NSArray, objc.NSArray, objc.NSArray) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - objc.NSArray.castFromPointer(arg0, - retain: false, release: true), - objc.NSArray.castFromPointer(arg1, - retain: false, release: true), - objc.NSArray.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSArray, objc.NSArray, - objc.NSArray)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSArray_NSArray_NSArray_CallExtension on objc - .ObjCBlock { - void call(objc.NSArray arg0, objc.NSArray arg1, objc.NSArray arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2.ref.pointer); -} - -late final _sel_getTasksWithCompletionHandler_ = - objc.registerName("getTasksWithCompletionHandler:"); -void _ObjCBlock_ffiVoid_NSArray1_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray1_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray1_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray1_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSArray1_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSArray1_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSArray1_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSArray1_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSArray1_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSArray1 { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSArray1_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSArray) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray1_closureCallable, - (ffi.Pointer arg0) => fn( - objc.NSArray.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSArray) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSArray1_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn( - objc.NSArray.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSArray1_CallExtension - on objc.ObjCBlock { - void call(objc.NSArray arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_getAllTasksWithCompletionHandler_ = - objc.registerName("getAllTasksWithCompletionHandler:"); -late final _sel_dataTaskWithRequest_ = - objc.registerName("dataTaskWithRequest:"); -late final _sel_dataTaskWithURL_ = objc.registerName("dataTaskWithURL:"); -late final _class_NSURLSessionUploadTask = - objc.getClass("NSURLSessionUploadTask"); -void _ObjCBlock_ffiVoid_NSData_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSData_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSData_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSData { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSData_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSData?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_closureCallable, - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSData.castFromPointer(arg0, - retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(objc.NSData?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => fn(arg0.address == 0 - ? null - : objc.NSData.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSData_CallExtension - on objc.ObjCBlock { - void call(objc.NSData? arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_cancelByProducingResumeData_ = - objc.registerName("cancelByProducingResumeData:"); - -/// NSURLSessionUploadTask -class NSURLSessionUploadTask extends NSURLSessionDataTask { - NSURLSessionUploadTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionUploadTask] that points to the same underlying object as [other]. - NSURLSessionUploadTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionUploadTask] that wraps the given raw object pointer. - NSURLSessionUploadTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionUploadTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionUploadTask); - } - - /// init - NSURLSessionUploadTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionUploadTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionUploadTask, _sel_new); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelByProducingResumeData: - void cancelByProducingResumeData_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_cancelByProducingResumeData_, - completionHandler.ref.pointer); - } - - /// allocWithZone: - static NSURLSessionUploadTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionUploadTask, _sel_allocWithZone_, zone); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionUploadTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionUploadTask, _sel_alloc); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionUploadTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionUploadTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionUploadTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionUploadTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionUploadTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionUploadTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionUploadTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionUploadTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionUploadTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionUploadTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionUploadTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionUploadTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_uploadTaskWithRequest_fromFile_ = - objc.registerName("uploadTaskWithRequest:fromFile:"); -late final _sel_uploadTaskWithRequest_fromData_ = - objc.registerName("uploadTaskWithRequest:fromData:"); -late final _sel_uploadTaskWithResumeData_ = - objc.registerName("uploadTaskWithResumeData:"); -late final _sel_uploadTaskWithStreamedRequest_ = - objc.registerName("uploadTaskWithStreamedRequest:"); -late final _class_NSURLSessionDownloadTask = - objc.getClass("NSURLSessionDownloadTask"); - -/// NSURLSessionDownloadTask -class NSURLSessionDownloadTask extends NSURLSessionTask { - NSURLSessionDownloadTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionDownloadTask] that points to the same underlying object as [other]. - NSURLSessionDownloadTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionDownloadTask] that wraps the given raw object pointer. - NSURLSessionDownloadTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionDownloadTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionDownloadTask); - } - - /// cancelByProducingResumeData: - void cancelByProducingResumeData_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_cancelByProducingResumeData_, - completionHandler.ref.pointer); - } - - /// init - NSURLSessionDownloadTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionDownloadTask new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionDownloadTask, _sel_new); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionDownloadTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionDownloadTask, _sel_allocWithZone_, zone); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionDownloadTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionDownloadTask, _sel_alloc); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionDownloadTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionDownloadTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDownloadTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionDownloadTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionDownloadTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionDownloadTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionDownloadTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDownloadTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionDownloadTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionDownloadTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionDownloadTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionDownloadTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_downloadTaskWithRequest_ = - objc.registerName("downloadTaskWithRequest:"); -late final _sel_downloadTaskWithURL_ = - objc.registerName("downloadTaskWithURL:"); -late final _sel_downloadTaskWithResumeData_ = - objc.registerName("downloadTaskWithResumeData:"); -late final _class_NSURLSessionStreamTask = - objc.getClass("NSURLSessionStreamTask"); -void _ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Bool arg1, ffi.Pointer arg2)>>() - .asFunction< - void Function(ffi.Pointer, bool, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_bool_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer _ObjCBlock_ffiVoid_NSData_bool_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_bool_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - bool arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - bool, ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSData_bool_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSData, ffi.Bool, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Bool arg1, ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSData_bool_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock - fromFunction(void Function(objc.NSData, bool, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_bool_NSError_closureCallable, - (ffi.Pointer arg0, bool arg1, - ffi.Pointer arg2) => - fn( - objc.NSData.castFromPointer(arg0, retain: true, release: true), - arg1, - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock - listener(void Function(objc.NSData, bool, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_bool_NSError_listenerCallable.nativeFunction - .cast(), - (ffi.Pointer arg0, bool arg1, - ffi.Pointer arg2) => - fn( - objc.NSData.castFromPointer(arg0, retain: false, release: true), - arg1, - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_hfhq9m(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSData, ffi.Bool, objc.NSError?)>(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSData_bool_NSError_CallExtension - on objc.ObjCBlock { - void call(objc.NSData arg0, bool arg1, objc.NSError? arg2) => ref - .pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Bool arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - bool, - ffi.Pointer)>()( - ref.pointer, arg0.ref.pointer, arg1, arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_readDataOfMinLength_maxLength_timeout_completionHandler_ = objc - .registerName("readDataOfMinLength:maxLength:timeout:completionHandler:"); -final _objc_msgSend_15i4521 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - double, - ffi.Pointer)>(); -late final _sel_writeData_timeout_completionHandler_ = - objc.registerName("writeData:timeout:completionHandler:"); -final _objc_msgSend_5qmwfe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer)>(); -late final _sel_captureStreams = objc.registerName("captureStreams"); -late final _sel_closeWrite = objc.registerName("closeWrite"); -late final _sel_closeRead = objc.registerName("closeRead"); -late final _sel_startSecureConnection = - objc.registerName("startSecureConnection"); -late final _sel_stopSecureConnection = - objc.registerName("stopSecureConnection"); - -/// NSURLSessionStreamTask -class NSURLSessionStreamTask extends NSURLSessionTask { - NSURLSessionStreamTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionStreamTask] that points to the same underlying object as [other]. - NSURLSessionStreamTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionStreamTask] that wraps the given raw object pointer. - NSURLSessionStreamTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionStreamTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionStreamTask); - } - - /// readDataOfMinLength:maxLength:timeout:completionHandler: - void readDataOfMinLength_maxLength_timeout_completionHandler_( - int minBytes, - int maxBytes, - double timeout, - objc.ObjCBlock - completionHandler) { - _objc_msgSend_15i4521( - this.ref.pointer, - _sel_readDataOfMinLength_maxLength_timeout_completionHandler_, - minBytes, - maxBytes, - timeout, - completionHandler.ref.pointer); - } - - /// writeData:timeout:completionHandler: - void writeData_timeout_completionHandler_(objc.NSData data, double timeout, - objc.ObjCBlock completionHandler) { - _objc_msgSend_5qmwfe( - this.ref.pointer, - _sel_writeData_timeout_completionHandler_, - data.ref.pointer, - timeout, - completionHandler.ref.pointer); - } - - /// captureStreams - void captureStreams() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_captureStreams); - } - - /// closeWrite - void closeWrite() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_closeWrite); - } - - /// closeRead - void closeRead() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_closeRead); - } - - /// startSecureConnection - void startSecureConnection() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_startSecureConnection); - } - - /// stopSecureConnection - void stopSecureConnection() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stopSecureConnection); - } - - /// init - NSURLSessionStreamTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionStreamTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionStreamTask, _sel_new); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionStreamTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionStreamTask, _sel_allocWithZone_, zone); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionStreamTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionStreamTask, _sel_alloc); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionStreamTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionStreamTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionStreamTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionStreamTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionStreamTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionStreamTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionStreamTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionStreamTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionStreamTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionStreamTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionStreamTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionStreamTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_streamTaskWithHostName_port_ = - objc.registerName("streamTaskWithHostName:port:"); -final _objc_msgSend_spwp90 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _class_NSNetService = objc.getClass("NSNetService"); -late final _sel_initWithDomain_type_name_port_ = - objc.registerName("initWithDomain:type:name:port:"); -final _objc_msgSend_1vcjoth = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Int)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_initWithDomain_type_name_ = - objc.registerName("initWithDomain:type:name:"); -late final _sel_includesPeerToPeer = objc.registerName("includesPeerToPeer"); -late final _sel_setIncludesPeerToPeer_ = - objc.registerName("setIncludesPeerToPeer:"); -late final _sel_type = objc.registerName("type"); -late final _sel_addresses = objc.registerName("addresses"); - -enum NSNetServiceOptions { - NSNetServiceNoAutoRename(1), - NSNetServiceListenForConnections(2); - - final int value; - const NSNetServiceOptions(this.value); - - static NSNetServiceOptions fromValue(int value) => switch (value) { - 1 => NSNetServiceNoAutoRename, - 2 => NSNetServiceListenForConnections, - _ => - throw ArgumentError("Unknown value for NSNetServiceOptions: $value"), - }; -} - -late final _sel_publishWithOptions_ = objc.registerName("publishWithOptions:"); -final _objc_msgSend_hj2tkj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_resolve = objc.registerName("resolve"); -late final _sel_stop = objc.registerName("stop"); -late final _sel_dictionaryFromTXTRecordData_ = - objc.registerName("dictionaryFromTXTRecordData:"); -late final _sel_dataFromTXTRecordDictionary_ = - objc.registerName("dataFromTXTRecordDictionary:"); -late final _sel_resolveWithTimeout_ = objc.registerName("resolveWithTimeout:"); -late final _sel_getInputStream_outputStream_ = - objc.registerName("getInputStream:outputStream:"); -final _objc_msgSend_1xn13sz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>)>(); -late final _sel_setTXTRecordData_ = objc.registerName("setTXTRecordData:"); -late final _sel_TXTRecordData = objc.registerName("TXTRecordData"); -late final _sel_startMonitoring = objc.registerName("startMonitoring"); -late final _sel_stopMonitoring = objc.registerName("stopMonitoring"); - -/// NSNetService -class NSNetService extends objc.NSObject { - NSNetService._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSNetService] that points to the same underlying object as [other]. - NSNetService.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSNetService] that wraps the given raw object pointer. - NSNetService.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSNetService]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSNetService); - } - - /// initWithDomain:type:name:port: - NSNetService initWithDomain_type_name_port_( - objc.NSString domain, objc.NSString type, objc.NSString name, int port) { - final _ret = _objc_msgSend_1vcjoth( - this.ref.retainAndReturnPointer(), - _sel_initWithDomain_type_name_port_, - domain.ref.pointer, - type.ref.pointer, - name.ref.pointer, - port); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithDomain:type:name: - NSNetService initWithDomain_type_name_( - objc.NSString domain, objc.NSString type, objc.NSString name) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithDomain_type_name_, - domain.ref.pointer, - type.ref.pointer, - name.ref.pointer); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// scheduleInRunLoop:forMode: - void scheduleInRunLoop_forMode_(objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// removeFromRunLoop:forMode: - void removeFromRunLoop_forMode_(objc.NSRunLoop aRunLoop, objc.NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeFromRunLoop_forMode_, - aRunLoop.ref.pointer, mode.ref.pointer); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDelegate: - set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); - } - - /// includesPeerToPeer - bool get includesPeerToPeer { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_includesPeerToPeer); - } - - /// setIncludesPeerToPeer: - set includesPeerToPeer(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setIncludesPeerToPeer_, value); - } - - /// name - objc.NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// type - objc.NSString get type { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_type); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// domain - objc.NSString get domain { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_domain); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// hostName - objc.NSString? get hostName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_hostName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addresses - objc.NSArray? get addresses { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_addresses); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// port - int get port { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_port); - } - - /// publish - void publish() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_publish); - } - - /// publishWithOptions: - void publishWithOptions_(NSNetServiceOptions options) { - _objc_msgSend_hj2tkj( - this.ref.pointer, _sel_publishWithOptions_, options.value); - } - - /// resolve - void resolve() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_resolve); - } - - /// stop - void stop() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stop); - } - - /// dictionaryFromTXTRecordData: - static objc.NSDictionary dictionaryFromTXTRecordData_(objc.NSData txtData) { - final _ret = _objc_msgSend_juohf7(_class_NSNetService, - _sel_dictionaryFromTXTRecordData_, txtData.ref.pointer); - return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// dataFromTXTRecordDictionary: - static objc.NSData dataFromTXTRecordDictionary_( - objc.NSDictionary txtDictionary) { - final _ret = _objc_msgSend_juohf7(_class_NSNetService, - _sel_dataFromTXTRecordDictionary_, txtDictionary.ref.pointer); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// resolveWithTimeout: - void resolveWithTimeout_(double timeout) { - _objc_msgSend_suh039(this.ref.pointer, _sel_resolveWithTimeout_, timeout); - } - - /// getInputStream:outputStream: - bool getInputStream_outputStream_( - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - return _objc_msgSend_1xn13sz(this.ref.pointer, - _sel_getInputStream_outputStream_, inputStream, outputStream); - } - - /// setTXTRecordData: - bool setTXTRecordData_(objc.NSData? recordData) { - return _objc_msgSend_l8lotg(this.ref.pointer, _sel_setTXTRecordData_, - recordData?.ref.pointer ?? ffi.nullptr); - } - - /// TXTRecordData - objc.NSData? TXTRecordData() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_TXTRecordData); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// startMonitoring - void startMonitoring() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_startMonitoring); - } - - /// stopMonitoring - void stopMonitoring() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_stopMonitoring); - } - - /// init - NSNetService init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSNetService new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNetService, _sel_new); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSNetService allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSNetService, _sel_allocWithZone_, zone); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSNetService alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNetService, _sel_alloc); - return NSNetService.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSNetService, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSNetService, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSNetService, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSNetService, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSNetService, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSNetService, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSNetService, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNetService, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSNetService, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSNetService self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSNetService.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSNetService retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSNetService.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSNetService autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSNetService.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_streamTaskWithNetService_ = - objc.registerName("streamTaskWithNetService:"); -late final _class_NSURLSessionWebSocketTask = - objc.getClass("NSURLSessionWebSocketTask"); -late final _class_NSURLSessionWebSocketMessage = - objc.getClass("NSURLSessionWebSocketMessage"); - -enum NSURLSessionWebSocketMessageType { - NSURLSessionWebSocketMessageTypeData(0), - NSURLSessionWebSocketMessageTypeString(1); - - final int value; - const NSURLSessionWebSocketMessageType(this.value); - - static NSURLSessionWebSocketMessageType fromValue(int value) => - switch (value) { - 0 => NSURLSessionWebSocketMessageTypeData, - 1 => NSURLSessionWebSocketMessageTypeString, - _ => throw ArgumentError( - "Unknown value for NSURLSessionWebSocketMessageType: $value"), - }; -} - -final _objc_msgSend_1kew1r = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); - -/// NSURLSessionWebSocketMessage -class NSURLSessionWebSocketMessage extends objc.NSObject { - NSURLSessionWebSocketMessage._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionWebSocketMessage] that points to the same underlying object as [other]. - NSURLSessionWebSocketMessage.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionWebSocketMessage] that wraps the given raw object pointer. - NSURLSessionWebSocketMessage.castFromPointer( - ffi.Pointer other, - {bool retain = false, - bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionWebSocketMessage]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_NSURLSessionWebSocketMessage); - } - - /// initWithData: - NSURLSessionWebSocketMessage initWithData_(objc.NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithData_, data.ref.pointer); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithString: - NSURLSessionWebSocketMessage initWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithString_, string.ref.pointer); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// type - NSURLSessionWebSocketMessageType get type { - final _ret = _objc_msgSend_1kew1r(this.ref.pointer, _sel_type); - return NSURLSessionWebSocketMessageType.fromValue(_ret); - } - - /// data - objc.NSData? get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// string - objc.NSString? get string { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_string); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLSessionWebSocketMessage init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionWebSocketMessage new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketMessage, _sel_new); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionWebSocketMessage allocWithZone_( - ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionWebSocketMessage, _sel_allocWithZone_, zone); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionWebSocketMessage alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketMessage, _sel_alloc); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionWebSocketMessage, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionWebSocketMessage, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_NSURLSessionWebSocketMessage, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionWebSocketMessage, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionWebSocketMessage, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionWebSocketMessage, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionWebSocketMessage, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketMessage, - _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionWebSocketMessage, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionWebSocketMessage self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionWebSocketMessage retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionWebSocketMessage autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionWebSocketMessage.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_sendMessage_completionHandler_ = - objc.registerName("sendMessage:completionHandler:"); -void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as void Function(ffi.Pointer, - ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerCallable = - ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSURLSessionWebSocketMessage?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => fn( - arg0.address == 0 - ? null - : NSURLSessionWebSocketMessage.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : objc.NSError.castFromPointer(arg1, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> - listener(void Function(NSURLSessionWebSocketMessage?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, - ffi.Pointer arg1) => - fn( - arg0.address == 0 - ? null - : NSURLSessionWebSocketMessage.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : objc.NSError.castFromPointer(arg1, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_CallExtension - on objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> { - void call(NSURLSessionWebSocketMessage? arg0, objc.NSError? arg1) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, arg1?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_receiveMessageWithCompletionHandler_ = - objc.registerName("receiveMessageWithCompletionHandler:"); -late final _sel_sendPingWithPongReceiveHandler_ = - objc.registerName("sendPingWithPongReceiveHandler:"); - -enum NSURLSessionWebSocketCloseCode { - NSURLSessionWebSocketCloseCodeInvalid(0), - NSURLSessionWebSocketCloseCodeNormalClosure(1000), - NSURLSessionWebSocketCloseCodeGoingAway(1001), - NSURLSessionWebSocketCloseCodeProtocolError(1002), - NSURLSessionWebSocketCloseCodeUnsupportedData(1003), - NSURLSessionWebSocketCloseCodeNoStatusReceived(1005), - NSURLSessionWebSocketCloseCodeAbnormalClosure(1006), - NSURLSessionWebSocketCloseCodeInvalidFramePayloadData(1007), - NSURLSessionWebSocketCloseCodePolicyViolation(1008), - NSURLSessionWebSocketCloseCodeMessageTooBig(1009), - NSURLSessionWebSocketCloseCodeMandatoryExtensionMissing(1010), - NSURLSessionWebSocketCloseCodeInternalServerError(1011), - NSURLSessionWebSocketCloseCodeTLSHandshakeFailure(1015); - - final int value; - const NSURLSessionWebSocketCloseCode(this.value); - - static NSURLSessionWebSocketCloseCode fromValue(int value) => switch (value) { - 0 => NSURLSessionWebSocketCloseCodeInvalid, - 1000 => NSURLSessionWebSocketCloseCodeNormalClosure, - 1001 => NSURLSessionWebSocketCloseCodeGoingAway, - 1002 => NSURLSessionWebSocketCloseCodeProtocolError, - 1003 => NSURLSessionWebSocketCloseCodeUnsupportedData, - 1005 => NSURLSessionWebSocketCloseCodeNoStatusReceived, - 1006 => NSURLSessionWebSocketCloseCodeAbnormalClosure, - 1007 => NSURLSessionWebSocketCloseCodeInvalidFramePayloadData, - 1008 => NSURLSessionWebSocketCloseCodePolicyViolation, - 1009 => NSURLSessionWebSocketCloseCodeMessageTooBig, - 1010 => NSURLSessionWebSocketCloseCodeMandatoryExtensionMissing, - 1011 => NSURLSessionWebSocketCloseCodeInternalServerError, - 1015 => NSURLSessionWebSocketCloseCodeTLSHandshakeFailure, - _ => throw ArgumentError( - "Unknown value for NSURLSessionWebSocketCloseCode: $value"), - }; -} - -late final _sel_cancelWithCloseCode_reason_ = - objc.registerName("cancelWithCloseCode:reason:"); -final _objc_msgSend_18im7ej = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_maximumMessageSize = objc.registerName("maximumMessageSize"); -late final _sel_setMaximumMessageSize_ = - objc.registerName("setMaximumMessageSize:"); -late final _sel_closeCode = objc.registerName("closeCode"); -final _objc_msgSend_a13zbl = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_closeReason = objc.registerName("closeReason"); - -/// NSURLSessionWebSocketTask -class NSURLSessionWebSocketTask extends NSURLSessionTask { - NSURLSessionWebSocketTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSessionWebSocketTask] that points to the same underlying object as [other]. - NSURLSessionWebSocketTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSessionWebSocketTask] that wraps the given raw object pointer. - NSURLSessionWebSocketTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSessionWebSocketTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionWebSocketTask); - } - - /// sendMessage:completionHandler: - void sendMessage_completionHandler_(NSURLSessionWebSocketMessage message, - objc.ObjCBlock completionHandler) { - _objc_msgSend_cmbt6k(this.ref.pointer, _sel_sendMessage_completionHandler_, - message.ref.pointer, completionHandler.ref.pointer); - } - - /// receiveMessageWithCompletionHandler: - void receiveMessageWithCompletionHandler_( - objc.ObjCBlock< - ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> - completionHandler) { - _objc_msgSend_4daxhl( - this.ref.pointer, - _sel_receiveMessageWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// sendPingWithPongReceiveHandler: - void sendPingWithPongReceiveHandler_( - objc.ObjCBlock pongReceiveHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_sendPingWithPongReceiveHandler_, - pongReceiveHandler.ref.pointer); - } - - /// cancelWithCloseCode:reason: - void cancelWithCloseCode_reason_( - NSURLSessionWebSocketCloseCode closeCode, objc.NSData? reason) { - _objc_msgSend_18im7ej(this.ref.pointer, _sel_cancelWithCloseCode_reason_, - closeCode.value, reason?.ref.pointer ?? ffi.nullptr); - } - - /// maximumMessageSize - int get maximumMessageSize { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_maximumMessageSize); - } - - /// setMaximumMessageSize: - set maximumMessageSize(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setMaximumMessageSize_, value); - } - - /// closeCode - NSURLSessionWebSocketCloseCode get closeCode { - final _ret = _objc_msgSend_a13zbl(this.ref.pointer, _sel_closeCode); - return NSURLSessionWebSocketCloseCode.fromValue(_ret); - } - - /// closeReason - objc.NSData? get closeReason { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_closeReason); - return _ret.address == 0 - ? null - : objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSURLSessionWebSocketTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSURLSessionWebSocketTask new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketTask, _sel_new); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSURLSessionWebSocketTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSURLSessionWebSocketTask, _sel_allocWithZone_, zone); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSURLSessionWebSocketTask alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSURLSessionWebSocketTask, _sel_alloc); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSessionWebSocketTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSessionWebSocketTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionWebSocketTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSURLSessionWebSocketTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSessionWebSocketTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSessionWebSocketTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSessionWebSocketTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionWebSocketTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSessionWebSocketTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSessionWebSocketTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// retain - NSURLSessionWebSocketTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// autorelease - NSURLSessionWebSocketTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } -} - -late final _sel_webSocketTaskWithURL_ = - objc.registerName("webSocketTaskWithURL:"); -late final _sel_webSocketTaskWithURL_protocols_ = - objc.registerName("webSocketTaskWithURL:protocols:"); -late final _sel_webSocketTaskWithRequest_ = - objc.registerName("webSocketTaskWithRequest:"); -void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSData?, NSURLResponse?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 ? null : objc.NSData.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : NSURLResponse.castFromPointer(arg1, retain: true, release: true), - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(objc.NSData?, NSURLResponse?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.NSData.castFromPointer(arg0, - retain: false, release: true), - arg1.address == 0 - ? null - : NSURLResponse.castFromPointer(arg1, - retain: false, release: true), - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_CallExtension on objc - .ObjCBlock { - void call(objc.NSData? arg0, NSURLResponse? arg1, objc.NSError? arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, - arg1?.ref.pointer ?? ffi.nullptr, - arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_dataTaskWithRequest_completionHandler_ = - objc.registerName("dataTaskWithRequest:completionHandler:"); -late final _sel_dataTaskWithURL_completionHandler_ = - objc.registerName("dataTaskWithURL:completionHandler:"); -late final _sel_uploadTaskWithRequest_fromFile_completionHandler_ = - objc.registerName("uploadTaskWithRequest:fromFile:completionHandler:"); -final _objc_msgSend_37obke = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_uploadTaskWithRequest_fromData_completionHandler_ = - objc.registerName("uploadTaskWithRequest:fromData:completionHandler:"); -late final _sel_uploadTaskWithResumeData_completionHandler_ = - objc.registerName("uploadTaskWithResumeData:completionHandler:"); -void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); -ffi.Pointer - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer))(arg0, arg1, arg2); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)> - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerCallable = ffi - .NativeCallable< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, - objc.NSError?)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(objc.NSURL?, NSURLResponse?, objc.NSError?) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureCallable, - (ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 ? null : objc.NSURL.castFromPointer(arg0, retain: true, release: true), - arg1.address == 0 ? null : NSURLResponse.castFromPointer(arg1, retain: true, release: true), - arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc - .ObjCBlock - listener(void Function(objc.NSURL?, NSURLResponse?, objc.NSError?) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerCallable - .nativeFunction - .cast(), - (ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer arg2) => - fn( - arg0.address == 0 - ? null - : objc.NSURL - .castFromPointer(arg0, retain: false, release: true), - arg1.address == 0 - ? null - : NSURLResponse.castFromPointer(arg1, - retain: false, release: true), - arg2.address == 0 - ? null - : objc.NSError.castFromPointer(arg2, - retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, - objc.NSError?)>(wrapper, retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_CallExtension on objc - .ObjCBlock { - void call(objc.NSURL? arg0, NSURLResponse? arg1, objc.NSError? arg2) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer arg2)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>()( - ref.pointer, - arg0?.ref.pointer ?? ffi.nullptr, - arg1?.ref.pointer ?? ffi.nullptr, - arg2?.ref.pointer ?? ffi.nullptr); -} - -late final _sel_downloadTaskWithRequest_completionHandler_ = - objc.registerName("downloadTaskWithRequest:completionHandler:"); -late final _sel_downloadTaskWithURL_completionHandler_ = - objc.registerName("downloadTaskWithURL:completionHandler:"); -late final _sel_downloadTaskWithResumeData_completionHandler_ = - objc.registerName("downloadTaskWithResumeData:completionHandler:"); - -/// NSURLSession -class NSURLSession extends objc.NSObject { - NSURLSession._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSURLSession] that points to the same underlying object as [other]. - NSURLSession.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSURLSession] that wraps the given raw object pointer. - NSURLSession.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSURLSession]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSession); - } - - /// sharedSession - static NSURLSession getSharedSession() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSession, _sel_sharedSession); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// sessionWithConfiguration: - static NSURLSession sessionWithConfiguration_( - NSURLSessionConfiguration configuration) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSession, - _sel_sessionWithConfiguration_, configuration.ref.pointer); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// sessionWithConfiguration:delegate:delegateQueue: - static NSURLSession sessionWithConfiguration_delegate_delegateQueue_( - NSURLSessionConfiguration configuration, - objc.ObjCObjectBase? delegate, - NSOperationQueue? queue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSURLSession, - _sel_sessionWithConfiguration_delegate_delegateQueue_, - configuration.ref.pointer, - delegate?.ref.pointer ?? ffi.nullptr, - queue?.ref.pointer ?? ffi.nullptr); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// delegateQueue - NSOperationQueue get delegateQueue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegateQueue); - return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); - } - - /// delegate - objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// configuration - NSURLSessionConfiguration get configuration { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_configuration); - return NSURLSessionConfiguration.castFromPointer(_ret, - retain: true, release: true); - } - - /// sessionDescription - objc.NSString? get sessionDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sessionDescription); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSessionDescription: - set sessionDescription(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setSessionDescription_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// finishTasksAndInvalidate - void finishTasksAndInvalidate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_finishTasksAndInvalidate); - } - - /// invalidateAndCancel - void invalidateAndCancel() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_invalidateAndCancel); - } - - /// resetWithCompletionHandler: - void resetWithCompletionHandler_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_resetWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// flushWithCompletionHandler: - void flushWithCompletionHandler_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_flushWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// getTasksWithCompletionHandler: - void getTasksWithCompletionHandler_( - objc.ObjCBlock< - ffi.Void Function(objc.NSArray, objc.NSArray, objc.NSArray)> - completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, _sel_getTasksWithCompletionHandler_, - completionHandler.ref.pointer); - } - - /// getAllTasksWithCompletionHandler: - void getAllTasksWithCompletionHandler_( - objc.ObjCBlock completionHandler) { - _objc_msgSend_4daxhl(this.ref.pointer, - _sel_getAllTasksWithCompletionHandler_, completionHandler.ref.pointer); - } - - /// dataTaskWithRequest: - NSURLSessionDataTask dataTaskWithRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dataTaskWithRequest_, request.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// dataTaskWithURL: - NSURLSessionDataTask dataTaskWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_dataTaskWithURL_, url.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromFile: - NSURLSessionUploadTask uploadTaskWithRequest_fromFile_( - NSURLRequest request, objc.NSURL fileURL) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromFile_, - request.ref.pointer, - fileURL.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromData: - NSURLSessionUploadTask uploadTaskWithRequest_fromData_( - NSURLRequest request, objc.NSData bodyData) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromData_, - request.ref.pointer, - bodyData.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithResumeData: - NSURLSessionUploadTask uploadTaskWithResumeData_(objc.NSData resumeData) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_uploadTaskWithResumeData_, resumeData.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithStreamedRequest: - NSURLSessionUploadTask uploadTaskWithStreamedRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_uploadTaskWithStreamedRequest_, request.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithRequest: - NSURLSessionDownloadTask downloadTaskWithRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_downloadTaskWithRequest_, request.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithURL: - NSURLSessionDownloadTask downloadTaskWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_downloadTaskWithURL_, url.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithResumeData: - NSURLSessionDownloadTask downloadTaskWithResumeData_(objc.NSData resumeData) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_downloadTaskWithResumeData_, resumeData.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// streamTaskWithHostName:port: - NSURLSessionStreamTask streamTaskWithHostName_port_( - objc.NSString hostname, int port) { - final _ret = _objc_msgSend_spwp90(this.ref.pointer, - _sel_streamTaskWithHostName_port_, hostname.ref.pointer, port); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// streamTaskWithNetService: - NSURLSessionStreamTask streamTaskWithNetService_(NSNetService service) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_streamTaskWithNetService_, service.ref.pointer); - return NSURLSessionStreamTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// webSocketTaskWithURL: - NSURLSessionWebSocketTask webSocketTaskWithURL_(objc.NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_webSocketTaskWithURL_, url.ref.pointer); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// webSocketTaskWithURL:protocols: - NSURLSessionWebSocketTask webSocketTaskWithURL_protocols_( - objc.NSURL url, objc.NSArray protocols) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_webSocketTaskWithURL_protocols_, - url.ref.pointer, - protocols.ref.pointer); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// webSocketTaskWithRequest: - NSURLSessionWebSocketTask webSocketTaskWithRequest_(NSURLRequest request) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_webSocketTaskWithRequest_, request.ref.pointer); - return NSURLSessionWebSocketTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSURLSession init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSURLSession new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSession, _sel_new); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// dataTaskWithRequest:completionHandler: - NSURLSessionDataTask dataTaskWithRequest_completionHandler_( - NSURLRequest request, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_dataTaskWithRequest_completionHandler_, - request.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// dataTaskWithURL:completionHandler: - NSURLSessionDataTask dataTaskWithURL_completionHandler_( - objc.NSURL url, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_dataTaskWithURL_completionHandler_, - url.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDataTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromFile:completionHandler: - NSURLSessionUploadTask uploadTaskWithRequest_fromFile_completionHandler_( - NSURLRequest request, - objc.NSURL fileURL, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_37obke( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromFile_completionHandler_, - request.ref.pointer, - fileURL.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithRequest:fromData:completionHandler: - NSURLSessionUploadTask uploadTaskWithRequest_fromData_completionHandler_( - NSURLRequest request, - objc.NSData? bodyData, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_37obke( - this.ref.pointer, - _sel_uploadTaskWithRequest_fromData_completionHandler_, - request.ref.pointer, - bodyData?.ref.pointer ?? ffi.nullptr, - completionHandler.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// uploadTaskWithResumeData:completionHandler: - NSURLSessionUploadTask uploadTaskWithResumeData_completionHandler_( - objc.NSData resumeData, - objc.ObjCBlock< - ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_uploadTaskWithResumeData_completionHandler_, - resumeData.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionUploadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithRequest:completionHandler: - NSURLSessionDownloadTask downloadTaskWithRequest_completionHandler_( - NSURLRequest request, - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_downloadTaskWithRequest_completionHandler_, - request.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithURL:completionHandler: - NSURLSessionDownloadTask downloadTaskWithURL_completionHandler_( - objc.NSURL url, - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_downloadTaskWithURL_completionHandler_, - url.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// downloadTaskWithResumeData:completionHandler: - NSURLSessionDownloadTask downloadTaskWithResumeData_completionHandler_( - objc.NSData resumeData, - objc.ObjCBlock< - ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> - completionHandler) { - final _ret = _objc_msgSend_1kkhn3j( - this.ref.pointer, - _sel_downloadTaskWithResumeData_completionHandler_, - resumeData.ref.pointer, - completionHandler.ref.pointer); - return NSURLSessionDownloadTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// allocWithZone: - static NSURLSession allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLSession, _sel_allocWithZone_, zone); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSURLSession alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLSession, _sel_alloc); - return NSURLSession.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSURLSession, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSURLSession, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSURLSession, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSURLSession, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLSession, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLSession, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSURLSession, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSession, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURLSession, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSURLSession self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSURLSession retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSURLSession autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSURLSession.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSProtocolChecker = objc.getClass("NSProtocolChecker"); -late final _sel_target = objc.registerName("target"); -late final _sel_protocolCheckerWithTarget_protocol_ = - objc.registerName("protocolCheckerWithTarget:protocol:"); -late final _sel_initWithTarget_protocol_ = - objc.registerName("initWithTarget:protocol:"); - -/// NSProtocolChecker -class NSProtocolChecker extends objc.NSProxy { - NSProtocolChecker._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSProtocolChecker] that points to the same underlying object as [other]. - NSProtocolChecker.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSProtocolChecker] that wraps the given raw object pointer. - NSProtocolChecker.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSProtocolChecker]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSProtocolChecker); - } - - /// protocol - objc.Protocol get protocol { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_protocol); - return objc.Protocol.castFromPointer(_ret, retain: true, release: true); - } - - /// target - objc.NSObject? get target { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_target); - return _ret.address == 0 - ? null - : objc.NSObject.castFromPointer(_ret, retain: true, release: true); - } - - /// protocolCheckerWithTarget:protocol: - static NSProtocolChecker protocolCheckerWithTarget_protocol_( - objc.NSObject anObject, objc.Protocol aProtocol) { - final _ret = _objc_msgSend_iq11qg( - _class_NSProtocolChecker, - _sel_protocolCheckerWithTarget_protocol_, - anObject.ref.pointer, - aProtocol.ref.pointer); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithTarget:protocol: - NSProtocolChecker initWithTarget_protocol_( - objc.NSObject anObject, objc.Protocol aProtocol) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithTarget_protocol_, - anObject.ref.pointer, - aProtocol.ref.pointer); - return NSProtocolChecker.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static objc.ObjCObjectBase alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProtocolChecker, _sel_alloc); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// self - NSProtocolChecker self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSProtocolChecker retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSProtocolChecker autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSProtocolChecker.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSTask = objc.getClass("NSTask"); -late final _sel_setExecutableURL_ = objc.registerName("setExecutableURL:"); -late final _sel_setArguments_ = objc.registerName("setArguments:"); -late final _sel_setEnvironment_ = objc.registerName("setEnvironment:"); -late final _sel_currentDirectoryURL = objc.registerName("currentDirectoryURL"); -late final _sel_setCurrentDirectoryURL_ = - objc.registerName("setCurrentDirectoryURL:"); -late final _sel_standardInput = objc.registerName("standardInput"); -late final _sel_setStandardInput_ = objc.registerName("setStandardInput:"); -late final _sel_standardOutput = objc.registerName("standardOutput"); -late final _sel_setStandardOutput_ = objc.registerName("setStandardOutput:"); -late final _sel_standardError = objc.registerName("standardError"); -late final _sel_setStandardError_ = objc.registerName("setStandardError:"); -late final _sel_launchAndReturnError_ = - objc.registerName("launchAndReturnError:"); -late final _sel_interrupt = objc.registerName("interrupt"); -late final _sel_terminate = objc.registerName("terminate"); -late final _sel_isRunning = objc.registerName("isRunning"); -late final _sel_terminationStatus = objc.registerName("terminationStatus"); - -enum NSTaskTerminationReason { - NSTaskTerminationReasonExit(1), - NSTaskTerminationReasonUncaughtSignal(2); - - final int value; - const NSTaskTerminationReason(this.value); - - static NSTaskTerminationReason fromValue(int value) => switch (value) { - 1 => NSTaskTerminationReasonExit, - 2 => NSTaskTerminationReasonUncaughtSignal, - _ => throw ArgumentError( - "Unknown value for NSTaskTerminationReason: $value"), - }; -} - -late final _sel_terminationReason = objc.registerName("terminationReason"); -final _objc_msgSend_19wfngj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -void _ObjCBlock_ffiVoid_NSTask_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTask_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTask_fnPtrTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTask_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0) => - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiVoid_NSTask_closureCallable = - ffi.Pointer.fromFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>( - _ObjCBlock_ffiVoid_NSTask_closureTrampoline) - .cast(); -void _ObjCBlock_ffiVoid_NSTask_listenerTrampoline( - ffi.Pointer block, ffi.Pointer arg0) { - (objc.getBlockClosure(block) as void Function( - ffi.Pointer))(arg0); - objc.objectRelease(block.cast()); -} - -ffi.NativeCallable< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)> - _ObjCBlock_ffiVoid_NSTask_listenerCallable = ffi.NativeCallable< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>.listener( - _ObjCBlock_ffiVoid_NSTask_listenerTrampoline) - ..keepIsolateAlive = false; - -/// Construction methods for `objc.ObjCBlock`. -abstract final class ObjCBlock_ffiVoid_NSTask { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock castFromPointer( - ffi.Pointer pointer, - {bool retain = false, - bool release = false}) => - objc.ObjCBlock(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock( - objc.newPointerBlock( - _ObjCBlock_ffiVoid_NSTask_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock fromFunction( - void Function(NSTask) fn) => - objc.ObjCBlock( - objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTask_closureCallable, - (ffi.Pointer arg0) => fn( - NSTask.castFromPointer(arg0, retain: true, release: true))), - retain: false, - release: true); - - /// Creates a listener block from a Dart function. - /// - /// This is based on FFI's NativeCallable.listener, and has the same - /// capabilities and limitations. This block can be invoked from any thread, - /// but only supports void functions, and is not run synchronously. See - /// NativeCallable.listener for more details. - /// - /// Note that unlike the default behavior of NativeCallable.listener, listener - /// blocks do not keep the isolate alive. - static objc.ObjCBlock listener( - void Function(NSTask) fn) { - final raw = objc.newClosureBlock( - _ObjCBlock_ffiVoid_NSTask_listenerCallable.nativeFunction.cast(), - (ffi.Pointer arg0) => - fn(NSTask.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); - objc.objectRelease(raw.cast()); - return objc.ObjCBlock(wrapper, - retain: false, release: true); - } -} - -/// Call operator for `objc.ObjCBlock`. -extension ObjCBlock_ffiVoid_NSTask_CallExtension - on objc.ObjCBlock { - void call(NSTask arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); -} - -late final _sel_terminationHandler = objc.registerName("terminationHandler"); -late final _sel_setTerminationHandler_ = - objc.registerName("setTerminationHandler:"); -late final _sel_launchedTaskWithExecutableURL_arguments_error_terminationHandler_ = - objc.registerName( - "launchedTaskWithExecutableURL:arguments:error:terminationHandler:"); -final _objc_msgSend_1rgs79u = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>(); -late final _sel_waitUntilExit = objc.registerName("waitUntilExit"); -late final _sel_launchPath = objc.registerName("launchPath"); -late final _sel_setLaunchPath_ = objc.registerName("setLaunchPath:"); -late final _sel_setCurrentDirectoryPath_ = - objc.registerName("setCurrentDirectoryPath:"); -late final _sel_launch = objc.registerName("launch"); -late final _sel_launchedTaskWithLaunchPath_arguments_ = - objc.registerName("launchedTaskWithLaunchPath:arguments:"); - -/// NSTask -class NSTask extends objc.NSObject { - NSTask._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSTask] that points to the same underlying object as [other]. - NSTask.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSTask] that wraps the given raw object pointer. - NSTask.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSTask]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSTask); - } - - /// init - NSTask init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// executableURL - objc.NSURL? get executableURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executableURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setExecutableURL: - set executableURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setExecutableURL_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// arguments - objc.NSArray? get arguments { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_arguments); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setArguments: - set arguments(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setArguments_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// environment - objc.NSDictionary? get environment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_environment); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setEnvironment: - set environment(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setEnvironment_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// currentDirectoryURL - objc.NSURL? get currentDirectoryURL { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDirectoryURL); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrentDirectoryURL: - set currentDirectoryURL(objc.NSURL? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCurrentDirectoryURL_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// standardInput - objc.ObjCObjectBase? get standardInput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardInput); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setStandardInput: - set standardInput(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStandardInput_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// standardOutput - objc.ObjCObjectBase? get standardOutput { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardOutput); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setStandardOutput: - set standardOutput(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStandardOutput_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// standardError - objc.ObjCObjectBase? get standardError { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardError); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setStandardError: - set standardError(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStandardError_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// launchAndReturnError: - bool launchAndReturnError_(ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_launchAndReturnError_, error); - } - - /// interrupt - void interrupt() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_interrupt); - } - - /// terminate - void terminate() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_terminate); - } - - /// suspend - bool suspend() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_suspend); - } - - /// resume - bool resume() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_resume); - } - - /// processIdentifier - int get processIdentifier { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_processIdentifier); - } - - /// isRunning - bool get running { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isRunning); - } - - /// terminationStatus - int get terminationStatus { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_terminationStatus); - } - - /// terminationReason - NSTaskTerminationReason get terminationReason { - final _ret = - _objc_msgSend_19wfngj(this.ref.pointer, _sel_terminationReason); - return NSTaskTerminationReason.fromValue(_ret); - } - - /// terminationHandler - objc.ObjCBlock? get terminationHandler { - final _ret = - _objc_msgSend_2osec1(this.ref.pointer, _sel_terminationHandler); - return _ret.address == 0 - ? null - : ObjCBlock_ffiVoid_NSTask.castFromPointer(_ret, - retain: true, release: true); - } - - /// setTerminationHandler: - set terminationHandler(objc.ObjCBlock? value) { - return _objc_msgSend_4daxhl(this.ref.pointer, _sel_setTerminationHandler_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// qualityOfService - NSQualityOfService get qualityOfService { - final _ret = _objc_msgSend_17dnyeh(this.ref.pointer, _sel_qualityOfService); - return NSQualityOfService.fromValue(_ret); - } - - /// setQualityOfService: - set qualityOfService(NSQualityOfService value) { - return _objc_msgSend_1fcr8u4( - this.ref.pointer, _sel_setQualityOfService_, value.value); - } - - /// launchedTaskWithExecutableURL:arguments:error:terminationHandler: - static NSTask? - launchedTaskWithExecutableURL_arguments_error_terminationHandler_( - objc.NSURL url, - objc.NSArray arguments, - ffi.Pointer> error, - objc.ObjCBlock? terminationHandler) { - final _ret = _objc_msgSend_1rgs79u( - _class_NSTask, - _sel_launchedTaskWithExecutableURL_arguments_error_terminationHandler_, - url.ref.pointer, - arguments.ref.pointer, - error, - terminationHandler?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// waitUntilExit - void waitUntilExit() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_waitUntilExit); - } - - /// launchPath - objc.NSString? get launchPath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_launchPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setLaunchPath: - set launchPath(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setLaunchPath_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// currentDirectoryPath - objc.NSString get currentDirectoryPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_currentDirectoryPath); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCurrentDirectoryPath: - set currentDirectoryPath(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setCurrentDirectoryPath_, value.ref.pointer); - } - - /// launch - void launch() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_launch); - } - - /// launchedTaskWithLaunchPath:arguments: - static NSTask launchedTaskWithLaunchPath_arguments_( - objc.NSString path, objc.NSArray arguments) { - final _ret = _objc_msgSend_iq11qg( - _class_NSTask, - _sel_launchedTaskWithLaunchPath_arguments_, - path.ref.pointer, - arguments.ref.pointer); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSTask new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTask, _sel_new); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSTask allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSTask, _sel_allocWithZone_, zone); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSTask alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSTask, _sel_alloc); - return NSTask.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSTask, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSTask, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSTask, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSTask, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSTask, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSTask, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSTask, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSTask, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSTask, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSTask self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSTask retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSTask autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSTask.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSXMLNode = objc.getClass("NSXMLNode"); - -enum NSXMLNodeKind { - NSXMLInvalidKind(0), - NSXMLDocumentKind(1), - NSXMLElementKind(2), - NSXMLAttributeKind(3), - NSXMLNamespaceKind(4), - NSXMLProcessingInstructionKind(5), - NSXMLCommentKind(6), - NSXMLTextKind(7), - NSXMLDTDKind(8), - NSXMLEntityDeclarationKind(9), - NSXMLAttributeDeclarationKind(10), - NSXMLElementDeclarationKind(11), - NSXMLNotationDeclarationKind(12); - - final int value; - const NSXMLNodeKind(this.value); - - static NSXMLNodeKind fromValue(int value) => switch (value) { - 0 => NSXMLInvalidKind, - 1 => NSXMLDocumentKind, - 2 => NSXMLElementKind, - 3 => NSXMLAttributeKind, - 4 => NSXMLNamespaceKind, - 5 => NSXMLProcessingInstructionKind, - 6 => NSXMLCommentKind, - 7 => NSXMLTextKind, - 8 => NSXMLDTDKind, - 9 => NSXMLEntityDeclarationKind, - 10 => NSXMLAttributeDeclarationKind, - 11 => NSXMLElementDeclarationKind, - 12 => NSXMLNotationDeclarationKind, - _ => throw ArgumentError("Unknown value for NSXMLNodeKind: $value"), - }; -} - -late final _sel_initWithKind_ = objc.registerName("initWithKind:"); -final _objc_msgSend_ayvqtd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); - -enum NSXMLNodeOptions { - NSXMLNodeOptionsNone(0), - NSXMLNodeIsCDATA(1), - NSXMLNodeExpandEmptyElement(2), - NSXMLNodeCompactEmptyElement(4), - NSXMLNodeUseSingleQuotes(8), - NSXMLNodeUseDoubleQuotes(16), - NSXMLNodeNeverEscapeContents(32), - NSXMLDocumentTidyHTML(512), - NSXMLDocumentTidyXML(1024), - NSXMLDocumentValidate(8192), - NSXMLNodeLoadExternalEntitiesAlways(16384), - NSXMLNodeLoadExternalEntitiesSameOriginOnly(32768), - NSXMLNodeLoadExternalEntitiesNever(524288), - NSXMLDocumentXInclude(65536), - NSXMLNodePrettyPrint(131072), - NSXMLDocumentIncludeContentTypeDeclaration(262144), - NSXMLNodePreserveNamespaceOrder(1048576), - NSXMLNodePreserveAttributeOrder(2097152), - NSXMLNodePreserveEntities(4194304), - NSXMLNodePreservePrefixes(8388608), - NSXMLNodePreserveCDATA(16777216), - NSXMLNodePreserveWhitespace(33554432), - NSXMLNodePreserveDTD(67108864), - NSXMLNodePreserveCharacterReferences(134217728), - NSXMLNodePromoteSignificantWhitespace(268435456), - NSXMLNodePreserveEmptyElements(6), - NSXMLNodePreserveQuotes(24), - NSXMLNodePreserveAll(4293918750); - - final int value; - const NSXMLNodeOptions(this.value); - - static NSXMLNodeOptions fromValue(int value) => switch (value) { - 0 => NSXMLNodeOptionsNone, - 1 => NSXMLNodeIsCDATA, - 2 => NSXMLNodeExpandEmptyElement, - 4 => NSXMLNodeCompactEmptyElement, - 8 => NSXMLNodeUseSingleQuotes, - 16 => NSXMLNodeUseDoubleQuotes, - 32 => NSXMLNodeNeverEscapeContents, - 512 => NSXMLDocumentTidyHTML, - 1024 => NSXMLDocumentTidyXML, - 8192 => NSXMLDocumentValidate, - 16384 => NSXMLNodeLoadExternalEntitiesAlways, - 32768 => NSXMLNodeLoadExternalEntitiesSameOriginOnly, - 524288 => NSXMLNodeLoadExternalEntitiesNever, - 65536 => NSXMLDocumentXInclude, - 131072 => NSXMLNodePrettyPrint, - 262144 => NSXMLDocumentIncludeContentTypeDeclaration, - 1048576 => NSXMLNodePreserveNamespaceOrder, - 2097152 => NSXMLNodePreserveAttributeOrder, - 4194304 => NSXMLNodePreserveEntities, - 8388608 => NSXMLNodePreservePrefixes, - 16777216 => NSXMLNodePreserveCDATA, - 33554432 => NSXMLNodePreserveWhitespace, - 67108864 => NSXMLNodePreserveDTD, - 134217728 => NSXMLNodePreserveCharacterReferences, - 268435456 => NSXMLNodePromoteSignificantWhitespace, - 6 => NSXMLNodePreserveEmptyElements, - 24 => NSXMLNodePreserveQuotes, - 4293918750 => NSXMLNodePreserveAll, - _ => throw ArgumentError("Unknown value for NSXMLNodeOptions: $value"), - }; -} - -late final _sel_initWithKind_options_ = - objc.registerName("initWithKind:options:"); -final _objc_msgSend_hddv7u = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -late final _sel_document = objc.registerName("document"); -late final _sel_documentWithRootElement_ = - objc.registerName("documentWithRootElement:"); -late final _sel_elementWithName_ = objc.registerName("elementWithName:"); -late final _sel_elementWithName_URI_ = - objc.registerName("elementWithName:URI:"); -late final _sel_elementWithName_stringValue_ = - objc.registerName("elementWithName:stringValue:"); -late final _sel_elementWithName_children_attributes_ = - objc.registerName("elementWithName:children:attributes:"); -late final _sel_attributeWithName_stringValue_ = - objc.registerName("attributeWithName:stringValue:"); -late final _sel_attributeWithName_URI_stringValue_ = - objc.registerName("attributeWithName:URI:stringValue:"); -late final _sel_namespaceWithName_stringValue_ = - objc.registerName("namespaceWithName:stringValue:"); -late final _sel_processingInstructionWithName_stringValue_ = - objc.registerName("processingInstructionWithName:stringValue:"); -late final _sel_commentWithStringValue_ = - objc.registerName("commentWithStringValue:"); -late final _sel_textWithStringValue_ = - objc.registerName("textWithStringValue:"); -late final _sel_DTDNodeWithXMLString_ = - objc.registerName("DTDNodeWithXMLString:"); -final _objc_msgSend_1edk5dx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_objectValue = objc.registerName("objectValue"); -late final _sel_setObjectValue_ = objc.registerName("setObjectValue:"); -late final _sel_stringValue = objc.registerName("stringValue"); -late final _sel_setStringValue_ = objc.registerName("setStringValue:"); -late final _sel_setStringValue_resolvingEntities_ = - objc.registerName("setStringValue:resolvingEntities:"); -late final _sel_index = objc.registerName("index"); -late final _sel_level = objc.registerName("level"); -late final _class_NSXMLDocument = objc.getClass("NSXMLDocument"); -late final _sel_initWithXMLString_options_error_ = - objc.registerName("initWithXMLString:options:error:"); -final _objc_msgSend_1go5rz8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -late final _sel_initWithContentsOfURL_options_error_ = - objc.registerName("initWithContentsOfURL:options:error:"); -late final _sel_initWithData_options_error_ = - objc.registerName("initWithData:options:error:"); -late final _sel_initWithRootElement_ = - objc.registerName("initWithRootElement:"); -late final _sel_replacementClassForClass_ = - objc.registerName("replacementClassForClass:"); -late final _sel_characterEncoding = objc.registerName("characterEncoding"); -late final _sel_setCharacterEncoding_ = - objc.registerName("setCharacterEncoding:"); -late final _sel_setVersion_ = objc.registerName("setVersion:"); -late final _sel_isStandalone = objc.registerName("isStandalone"); -late final _sel_setStandalone_ = objc.registerName("setStandalone:"); - -enum NSXMLDocumentContentKind { - NSXMLDocumentXMLKind(0), - NSXMLDocumentXHTMLKind(1), - NSXMLDocumentHTMLKind(2), - NSXMLDocumentTextKind(3); - - final int value; - const NSXMLDocumentContentKind(this.value); - - static NSXMLDocumentContentKind fromValue(int value) => switch (value) { - 0 => NSXMLDocumentXMLKind, - 1 => NSXMLDocumentXHTMLKind, - 2 => NSXMLDocumentHTMLKind, - 3 => NSXMLDocumentTextKind, - _ => throw ArgumentError( - "Unknown value for NSXMLDocumentContentKind: $value"), - }; -} - -late final _sel_documentContentKind = objc.registerName("documentContentKind"); -final _objc_msgSend_vx3pa9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDocumentContentKind_ = - objc.registerName("setDocumentContentKind:"); -final _objc_msgSend_zmck60 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setMIMEType_ = objc.registerName("setMIMEType:"); -late final _class_NSXMLDTD = objc.getClass("NSXMLDTD"); -late final _sel_setPublicID_ = objc.registerName("setPublicID:"); -late final _sel_setSystemID_ = objc.registerName("setSystemID:"); -late final _sel_insertChild_atIndex_ = - objc.registerName("insertChild:atIndex:"); -late final _sel_insertChildren_atIndex_ = - objc.registerName("insertChildren:atIndex:"); -late final _sel_removeChildAtIndex_ = objc.registerName("removeChildAtIndex:"); -late final _sel_setChildren_ = objc.registerName("setChildren:"); -late final _sel_addChild_ = objc.registerName("addChild:"); -late final _sel_replaceChildAtIndex_withNode_ = - objc.registerName("replaceChildAtIndex:withNode:"); -final _objc_msgSend_1a4j45m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _class_NSXMLDTDNode = objc.getClass("NSXMLDTDNode"); -late final _sel_initWithXMLString_ = objc.registerName("initWithXMLString:"); - -enum NSXMLDTDNodeKind { - NSXMLEntityGeneralKind(1), - NSXMLEntityParsedKind(2), - NSXMLEntityUnparsedKind(3), - NSXMLEntityParameterKind(4), - NSXMLEntityPredefined(5), - NSXMLAttributeCDATAKind(6), - NSXMLAttributeIDKind(7), - NSXMLAttributeIDRefKind(8), - NSXMLAttributeIDRefsKind(9), - NSXMLAttributeEntityKind(10), - NSXMLAttributeEntitiesKind(11), - NSXMLAttributeNMTokenKind(12), - NSXMLAttributeNMTokensKind(13), - NSXMLAttributeEnumerationKind(14), - NSXMLAttributeNotationKind(15), - NSXMLElementDeclarationUndefinedKind(16), - NSXMLElementDeclarationEmptyKind(17), - NSXMLElementDeclarationAnyKind(18), - NSXMLElementDeclarationMixedKind(19), - NSXMLElementDeclarationElementKind(20); - - final int value; - const NSXMLDTDNodeKind(this.value); - - static NSXMLDTDNodeKind fromValue(int value) => switch (value) { - 1 => NSXMLEntityGeneralKind, - 2 => NSXMLEntityParsedKind, - 3 => NSXMLEntityUnparsedKind, - 4 => NSXMLEntityParameterKind, - 5 => NSXMLEntityPredefined, - 6 => NSXMLAttributeCDATAKind, - 7 => NSXMLAttributeIDKind, - 8 => NSXMLAttributeIDRefKind, - 9 => NSXMLAttributeIDRefsKind, - 10 => NSXMLAttributeEntityKind, - 11 => NSXMLAttributeEntitiesKind, - 12 => NSXMLAttributeNMTokenKind, - 13 => NSXMLAttributeNMTokensKind, - 14 => NSXMLAttributeEnumerationKind, - 15 => NSXMLAttributeNotationKind, - 16 => NSXMLElementDeclarationUndefinedKind, - 17 => NSXMLElementDeclarationEmptyKind, - 18 => NSXMLElementDeclarationAnyKind, - 19 => NSXMLElementDeclarationMixedKind, - 20 => NSXMLElementDeclarationElementKind, - _ => throw ArgumentError("Unknown value for NSXMLDTDNodeKind: $value"), - }; -} - -late final _sel_DTDKind = objc.registerName("DTDKind"); -final _objc_msgSend_q8besf = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_setDTDKind_ = objc.registerName("setDTDKind:"); -final _objc_msgSend_g68b2i = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_isExternal = objc.registerName("isExternal"); -late final _sel_notationName = objc.registerName("notationName"); -late final _sel_setNotationName_ = objc.registerName("setNotationName:"); -late final _sel_localNameForName_ = objc.registerName("localNameForName:"); -late final _sel_prefixForName_ = objc.registerName("prefixForName:"); -late final _sel_predefinedNamespaceForPrefix_ = - objc.registerName("predefinedNamespaceForPrefix:"); - -/// NSXMLDTDNode -class NSXMLDTDNode extends NSXMLNode { - NSXMLDTDNode._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLDTDNode] that points to the same underlying object as [other]. - NSXMLDTDNode.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLDTDNode] that wraps the given raw object pointer. - NSXMLDTDNode.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLDTDNode]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLDTDNode); - } - - /// initWithXMLString: - NSXMLDTDNode? initWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLDTDNode initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// init - NSXMLDTDNode init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// DTDKind - NSXMLDTDNodeKind get DTDKind { - final _ret = _objc_msgSend_q8besf(this.ref.pointer, _sel_DTDKind); - return NSXMLDTDNodeKind.fromValue(_ret); - } - - /// setDTDKind: - set DTDKind(NSXMLDTDNodeKind value) { - return _objc_msgSend_g68b2i( - this.ref.pointer, _sel_setDTDKind_, value.value); - } - - /// isExternal - bool get external1 { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isExternal); - } - - /// publicID - objc.NSString? get publicID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_publicID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPublicID: - set publicID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPublicID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// systemID - objc.NSString? get systemID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_systemID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSystemID: - set systemID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setSystemID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// notationName - objc.NSString? get notationName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_notationName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setNotationName: - set notationName(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setNotationName_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// initWithKind: - NSXMLDTDNode initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLDTDNode.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLDTDNode, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLDTDNode, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTDNode, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTDNode, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTDNode, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTDNode, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTDNode, - _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_entityDeclarationForName_ = - objc.registerName("entityDeclarationForName:"); -late final _sel_notationDeclarationForName_ = - objc.registerName("notationDeclarationForName:"); -late final _sel_elementDeclarationForName_ = - objc.registerName("elementDeclarationForName:"); -late final _sel_attributeDeclarationForName_elementName_ = - objc.registerName("attributeDeclarationForName:elementName:"); -late final _sel_predefinedEntityDeclarationForName_ = - objc.registerName("predefinedEntityDeclarationForName:"); - -/// NSXMLDTD -class NSXMLDTD extends NSXMLNode { - NSXMLDTD._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLDTD] that points to the same underlying object as [other]. - NSXMLDTD.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLDTD] that wraps the given raw object pointer. - NSXMLDTD.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLDTD]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLDTD); - } - - /// init - NSXMLDTD init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLDTD initWithKind_options_(NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL:options:error: - NSXMLDTD? initWithContentsOfURL_options_error_(objc.NSURL url, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_options_error_, - url.ref.pointer, - mask.value, - error); - return _ret.address == 0 - ? null - : NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithData:options:error: - NSXMLDTD? initWithData_options_error_(objc.NSData data, NSXMLNodeOptions mask, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8(this.ref.retainAndReturnPointer(), - _sel_initWithData_options_error_, data.ref.pointer, mask.value, error); - return _ret.address == 0 - ? null - : NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// publicID - objc.NSString? get publicID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_publicID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setPublicID: - set publicID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setPublicID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// systemID - objc.NSString? get systemID { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_systemID); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setSystemID: - set systemID(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setSystemID_, value?.ref.pointer ?? ffi.nullptr); - } - - /// insertChild:atIndex: - void insertChild_atIndex_(NSXMLNode child, int index) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertChild_atIndex_, child.ref.pointer, index); - } - - /// insertChildren:atIndex: - void insertChildren_atIndex_(objc.NSArray children, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertChildren_atIndex_, - children.ref.pointer, index); - } - - /// removeChildAtIndex: - void removeChildAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeChildAtIndex_, index); - } - - /// setChildren: - void setChildren_(objc.NSArray? children) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildren_, - children?.ref.pointer ?? ffi.nullptr); - } - - /// addChild: - void addChild_(NSXMLNode child) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addChild_, child.ref.pointer); - } - - /// replaceChildAtIndex:withNode: - void replaceChildAtIndex_withNode_(int index, NSXMLNode node) { - _objc_msgSend_1a4j45m(this.ref.pointer, _sel_replaceChildAtIndex_withNode_, - index, node.ref.pointer); - } - - /// entityDeclarationForName: - NSXMLDTDNode? entityDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_entityDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// notationDeclarationForName: - NSXMLDTDNode? notationDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_notationDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// elementDeclarationForName: - NSXMLDTDNode? elementDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_elementDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// attributeDeclarationForName:elementName: - NSXMLDTDNode? attributeDeclarationForName_elementName_( - objc.NSString name, objc.NSString elementName) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_attributeDeclarationForName_elementName_, - name.ref.pointer, - elementName.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedEntityDeclarationForName: - static NSXMLDTDNode? predefinedEntityDeclarationForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDTD, - _sel_predefinedEntityDeclarationForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLDTDNode.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithKind: - NSXMLDTD initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLDTD.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLDTD, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLDTD, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTD, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDTD, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDTD, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDTD, _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_DTD = objc.registerName("DTD"); -late final _sel_setDTD_ = objc.registerName("setDTD:"); -late final _sel_setRootElement_ = objc.registerName("setRootElement:"); -late final _sel_rootElement = objc.registerName("rootElement"); -late final _sel_XMLData = objc.registerName("XMLData"); -late final _sel_XMLDataWithOptions_ = objc.registerName("XMLDataWithOptions:"); -final _objc_msgSend_uvkejp = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_objectByApplyingXSLT_arguments_error_ = - objc.registerName("objectByApplyingXSLT:arguments:error:"); -final _objc_msgSend_1lpsn5w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -late final _sel_objectByApplyingXSLTString_arguments_error_ = - objc.registerName("objectByApplyingXSLTString:arguments:error:"); -late final _sel_objectByApplyingXSLTAtURL_arguments_error_ = - objc.registerName("objectByApplyingXSLTAtURL:arguments:error:"); -late final _sel_validateAndReturnError_ = - objc.registerName("validateAndReturnError:"); - -/// NSXMLDocument -class NSXMLDocument extends NSXMLNode { - NSXMLDocument._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLDocument] that points to the same underlying object as [other]. - NSXMLDocument.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLDocument] that wraps the given raw object pointer. - NSXMLDocument.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLDocument]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLDocument); - } - - /// init - NSXMLDocument init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithXMLString:options:error: - NSXMLDocument? initWithXMLString_options_error_(objc.NSString string, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8( - this.ref.retainAndReturnPointer(), - _sel_initWithXMLString_options_error_, - string.ref.pointer, - mask.value, - error); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL:options:error: - NSXMLDocument? initWithContentsOfURL_options_error_(objc.NSURL url, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8( - this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_options_error_, - url.ref.pointer, - mask.value, - error); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithData:options:error: - NSXMLDocument? initWithData_options_error_(objc.NSData data, - NSXMLNodeOptions mask, ffi.Pointer> error) { - final _ret = _objc_msgSend_1go5rz8(this.ref.retainAndReturnPointer(), - _sel_initWithData_options_error_, data.ref.pointer, mask.value, error); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithRootElement: - NSXMLDocument initWithRootElement_(NSXMLElement? element) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithRootElement_, element?.ref.pointer ?? ffi.nullptr); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// replacementClassForClass: - static objc.ObjCObjectBase replacementClassForClass_( - objc.ObjCObjectBase cls) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_replacementClassForClass_, cls.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// characterEncoding - objc.NSString? get characterEncoding { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_characterEncoding); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setCharacterEncoding: - set characterEncoding(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setCharacterEncoding_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// version - objc.NSString? get version { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_version); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setVersion: - set version(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setVersion_, value?.ref.pointer ?? ffi.nullptr); - } - - /// isStandalone - bool get standalone { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isStandalone); - } - - /// setStandalone: - set standalone(bool value) { - return _objc_msgSend_117qins(this.ref.pointer, _sel_setStandalone_, value); - } - - /// documentContentKind - NSXMLDocumentContentKind get documentContentKind { - final _ret = - _objc_msgSend_vx3pa9(this.ref.pointer, _sel_documentContentKind); - return NSXMLDocumentContentKind.fromValue(_ret); - } - - /// setDocumentContentKind: - set documentContentKind(NSXMLDocumentContentKind value) { - return _objc_msgSend_zmck60( - this.ref.pointer, _sel_setDocumentContentKind_, value.value); - } - - /// MIMEType - objc.NSString? get MIMEType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_MIMEType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setMIMEType: - set MIMEType(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setMIMEType_, value?.ref.pointer ?? ffi.nullptr); - } - - /// DTD - NSXMLDTD? get DTD { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_DTD); - return _ret.address == 0 - ? null - : NSXMLDTD.castFromPointer(_ret, retain: true, release: true); - } - - /// setDTD: - set DTD(NSXMLDTD? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDTD_, value?.ref.pointer ?? ffi.nullptr); - } - - /// setRootElement: - void setRootElement_(NSXMLElement root) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setRootElement_, root.ref.pointer); - } - - /// rootElement - NSXMLElement? rootElement() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootElement); - return _ret.address == 0 - ? null - : NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } - - /// insertChild:atIndex: - void insertChild_atIndex_(NSXMLNode child, int index) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertChild_atIndex_, child.ref.pointer, index); - } - - /// insertChildren:atIndex: - void insertChildren_atIndex_(objc.NSArray children, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertChildren_atIndex_, - children.ref.pointer, index); - } - - /// removeChildAtIndex: - void removeChildAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeChildAtIndex_, index); - } - - /// setChildren: - void setChildren_(objc.NSArray? children) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildren_, - children?.ref.pointer ?? ffi.nullptr); - } - - /// addChild: - void addChild_(NSXMLNode child) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addChild_, child.ref.pointer); - } - - /// replaceChildAtIndex:withNode: - void replaceChildAtIndex_withNode_(int index, NSXMLNode node) { - _objc_msgSend_1a4j45m(this.ref.pointer, _sel_replaceChildAtIndex_withNode_, - index, node.ref.pointer); - } - - /// XMLData - objc.NSData get XMLData { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_XMLData); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// XMLDataWithOptions: - objc.NSData XMLDataWithOptions_(NSXMLNodeOptions options) { - final _ret = _objc_msgSend_uvkejp( - this.ref.pointer, _sel_XMLDataWithOptions_, options.value); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// objectByApplyingXSLT:arguments:error: - objc.ObjCObjectBase? objectByApplyingXSLT_arguments_error_( - objc.NSData xslt, - objc.NSDictionary? arguments, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectByApplyingXSLT_arguments_error_, - xslt.ref.pointer, - arguments?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectByApplyingXSLTString:arguments:error: - objc.ObjCObjectBase? objectByApplyingXSLTString_arguments_error_( - objc.NSString xslt, - objc.NSDictionary? arguments, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectByApplyingXSLTString_arguments_error_, - xslt.ref.pointer, - arguments?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectByApplyingXSLTAtURL:arguments:error: - objc.ObjCObjectBase? objectByApplyingXSLTAtURL_arguments_error_( - objc.NSURL xsltURL, - objc.NSDictionary? argument, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectByApplyingXSLTAtURL_arguments_error_, - xsltURL.ref.pointer, - argument?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// validateAndReturnError: - bool validateAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_validateAndReturnError_, error); - } - - /// initWithKind: - NSXMLDocument initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLDocument initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLDocument.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLDocument, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLDocument, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDocument, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLDocument, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLDocument, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLDocument, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLDocument, - _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _sel_rootDocument = objc.registerName("rootDocument"); -late final _sel_parent = objc.registerName("parent"); -late final _sel_childCount = objc.registerName("childCount"); -late final _sel_children = objc.registerName("children"); -late final _sel_childAtIndex_ = objc.registerName("childAtIndex:"); -late final _sel_previousSibling = objc.registerName("previousSibling"); -late final _sel_nextSibling = objc.registerName("nextSibling"); -late final _sel_previousNode = objc.registerName("previousNode"); -late final _sel_nextNode = objc.registerName("nextNode"); -late final _sel_detach = objc.registerName("detach"); -late final _sel_XPath = objc.registerName("XPath"); -late final _sel_localName = objc.registerName("localName"); -late final _sel_prefix = objc.registerName("prefix"); -late final _sel_URI = objc.registerName("URI"); -late final _sel_setURI_ = objc.registerName("setURI:"); -late final _sel_XMLString = objc.registerName("XMLString"); -late final _sel_XMLStringWithOptions_ = - objc.registerName("XMLStringWithOptions:"); -late final _sel_canonicalXMLStringPreservingComments_ = - objc.registerName("canonicalXMLStringPreservingComments:"); -late final _sel_nodesForXPath_error_ = - objc.registerName("nodesForXPath:error:"); -late final _sel_objectsForXQuery_constants_error_ = - objc.registerName("objectsForXQuery:constants:error:"); -late final _sel_objectsForXQuery_error_ = - objc.registerName("objectsForXQuery:error:"); - -/// NSXMLNode -class NSXMLNode extends objc.NSObject { - NSXMLNode._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLNode] that points to the same underlying object as [other]. - NSXMLNode.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLNode] that wraps the given raw object pointer. - NSXMLNode.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLNode]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLNode); - } - - /// init - NSXMLNode init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind: - NSXMLNode initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLNode initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLNode, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLNode, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLNode, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLNode, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLNode, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// kind - NSXMLNodeKind get kind { - final _ret = _objc_msgSend_1edk5dx(this.ref.pointer, _sel_kind); - return NSXMLNodeKind.fromValue(_ret); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setName: - set name(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); - } - - /// objectValue - objc.ObjCObjectBase? get objectValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectValue); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setObjectValue: - set objectValue(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setObjectValue_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// stringValue - objc.NSString? get stringValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_stringValue); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setStringValue: - set stringValue(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setStringValue_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setStringValue:resolvingEntities: - void setStringValue_resolvingEntities_(objc.NSString string, bool resolve) { - _objc_msgSend_1n1qwdd(this.ref.pointer, - _sel_setStringValue_resolvingEntities_, string.ref.pointer, resolve); - } - - /// index - int get index { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_index); - } - - /// level - int get level { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_level); - } - - /// rootDocument - NSXMLDocument? get rootDocument { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_rootDocument); - return _ret.address == 0 - ? null - : NSXMLDocument.castFromPointer(_ret, retain: true, release: true); - } - - /// parent - NSXMLNode? get parent { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_parent); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// childCount - int get childCount { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_childCount); - } - - /// children - objc.NSArray? get children { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_children); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// childAtIndex: - NSXMLNode? childAtIndex_(int index) { - final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_childAtIndex_, index); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// previousSibling - NSXMLNode? get previousSibling { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_previousSibling); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// nextSibling - NSXMLNode? get nextSibling { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nextSibling); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// previousNode - NSXMLNode? get previousNode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_previousNode); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// nextNode - NSXMLNode? get nextNode { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nextNode); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// detach - void detach() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_detach); - } - - /// XPath - objc.NSString? get XPath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_XPath); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// localName - objc.NSString? get localName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefix - objc.NSString? get prefix { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_prefix); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// URI - objc.NSString? get URI { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URI); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setURI: - set URI(objc.NSString? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setURI_, value?.ref.pointer ?? ffi.nullptr); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLNode, _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// description - objc.NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// XMLString - objc.NSString get XMLString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_XMLString); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// XMLStringWithOptions: - objc.NSString XMLStringWithOptions_(NSXMLNodeOptions options) { - final _ret = _objc_msgSend_uvkejp( - this.ref.pointer, _sel_XMLStringWithOptions_, options.value); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// canonicalXMLStringPreservingComments: - objc.NSString canonicalXMLStringPreservingComments_(bool comments) { - final _ret = _objc_msgSend_1upz917( - this.ref.pointer, _sel_canonicalXMLStringPreservingComments_, comments); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// nodesForXPath:error: - objc.NSArray? nodesForXPath_error_( - objc.NSString xpath, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh( - this.ref.pointer, _sel_nodesForXPath_error_, xpath.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// objectsForXQuery:constants:error: - objc.NSArray? objectsForXQuery_constants_error_( - objc.NSString xquery, - objc.NSDictionary? constants, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - this.ref.pointer, - _sel_objectsForXQuery_constants_error_, - xquery.ref.pointer, - constants?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// objectsForXQuery:error: - objc.NSArray? objectsForXQuery_error_( - objc.NSString xquery, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_objectsForXQuery_error_, xquery.ref.pointer, error); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSXMLNode new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_new); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSXMLNode allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSXMLNode, _sel_allocWithZone_, zone); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSXMLNode alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_alloc); - return NSXMLNode.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSXMLNode, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSXMLNode, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSXMLNode, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSXMLNode, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLNode, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSXMLNode, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSXMLNode, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLNode, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSXMLNode, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSXMLNode self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSXMLNode retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSXMLNode autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSXMLElement = objc.getClass("NSXMLElement"); -late final _sel_initWithName_URI_ = objc.registerName("initWithName:URI:"); -late final _sel_initWithName_stringValue_ = - objc.registerName("initWithName:stringValue:"); -late final _sel_initWithXMLString_error_ = - objc.registerName("initWithXMLString:error:"); -late final _sel_elementsForName_ = objc.registerName("elementsForName:"); -late final _sel_elementsForLocalName_URI_ = - objc.registerName("elementsForLocalName:URI:"); -late final _sel_addAttribute_ = objc.registerName("addAttribute:"); -late final _sel_removeAttributeForName_ = - objc.registerName("removeAttributeForName:"); -late final _sel_attributes = objc.registerName("attributes"); -late final _sel_setAttributes_ = objc.registerName("setAttributes:"); -late final _sel_setAttributesWithDictionary_ = - objc.registerName("setAttributesWithDictionary:"); -late final _sel_attributeForName_ = objc.registerName("attributeForName:"); -late final _sel_attributeForLocalName_URI_ = - objc.registerName("attributeForLocalName:URI:"); -late final _sel_addNamespace_ = objc.registerName("addNamespace:"); -late final _sel_removeNamespaceForPrefix_ = - objc.registerName("removeNamespaceForPrefix:"); -late final _sel_namespaces = objc.registerName("namespaces"); -late final _sel_setNamespaces_ = objc.registerName("setNamespaces:"); -late final _sel_namespaceForPrefix_ = objc.registerName("namespaceForPrefix:"); -late final _sel_resolveNamespaceForName_ = - objc.registerName("resolveNamespaceForName:"); -late final _sel_resolvePrefixForNamespaceURI_ = - objc.registerName("resolvePrefixForNamespaceURI:"); -late final _sel_normalizeAdjacentTextNodesPreservingCDATA_ = - objc.registerName("normalizeAdjacentTextNodesPreservingCDATA:"); -late final _sel_setAttributesAsDictionary_ = - objc.registerName("setAttributesAsDictionary:"); - -/// NSXMLElement -class NSXMLElement extends NSXMLNode { - NSXMLElement._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSXMLElement] that points to the same underlying object as [other]. - NSXMLElement.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSXMLElement] that wraps the given raw object pointer. - NSXMLElement.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSXMLElement]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSXMLElement); - } - - /// initWithName: - NSXMLElement initWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithName_, name.ref.pointer); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithName:URI: - NSXMLElement initWithName_URI_(objc.NSString name, objc.NSString? URI) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithName_URI_, - name.ref.pointer, - URI?.ref.pointer ?? ffi.nullptr); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithName:stringValue: - NSXMLElement initWithName_stringValue_( - objc.NSString name, objc.NSString? string) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithName_stringValue_, - name.ref.pointer, - string?.ref.pointer ?? ffi.nullptr); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithXMLString:error: - NSXMLElement? initWithXMLString_error_( - objc.NSString string, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.retainAndReturnPointer(), - _sel_initWithXMLString_error_, string.ref.pointer, error); - return _ret.address == 0 - ? null - : NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind:options: - NSXMLElement initWithKind_options_( - NSXMLNodeKind kind, NSXMLNodeOptions options) { - final _ret = _objc_msgSend_hddv7u(this.ref.retainAndReturnPointer(), - _sel_initWithKind_options_, kind.value, options.value); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// elementsForName: - objc.NSArray elementsForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_elementsForName_, name.ref.pointer); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// elementsForLocalName:URI: - objc.NSArray elementsForLocalName_URI_( - objc.NSString localName, objc.NSString? URI) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_elementsForLocalName_URI_, - localName.ref.pointer, - URI?.ref.pointer ?? ffi.nullptr); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// addAttribute: - void addAttribute_(NSXMLNode attribute) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addAttribute_, attribute.ref.pointer); - } - - /// removeAttributeForName: - void removeAttributeForName_(objc.NSString name) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeAttributeForName_, name.ref.pointer); - } - - /// attributes - objc.NSArray? get attributes { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributes); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setAttributes: - set attributes(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAttributes_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// setAttributesWithDictionary: - void setAttributesWithDictionary_(objc.NSDictionary attributes) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAttributesWithDictionary_, - attributes.ref.pointer); - } - - /// attributeForName: - NSXMLNode? attributeForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_attributeForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// attributeForLocalName:URI: - NSXMLNode? attributeForLocalName_URI_( - objc.NSString localName, objc.NSString? URI) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_attributeForLocalName_URI_, - localName.ref.pointer, - URI?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// addNamespace: - void addNamespace_(NSXMLNode aNamespace) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addNamespace_, aNamespace.ref.pointer); - } - - /// removeNamespaceForPrefix: - void removeNamespaceForPrefix_(objc.NSString name) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeNamespaceForPrefix_, name.ref.pointer); - } - - /// namespaces - objc.NSArray? get namespaces { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_namespaces); - return _ret.address == 0 - ? null - : objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// setNamespaces: - set namespaces(objc.NSArray? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setNamespaces_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// namespaceForPrefix: - NSXMLNode? namespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_namespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// resolveNamespaceForName: - NSXMLNode? resolveNamespaceForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_resolveNamespaceForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// resolvePrefixForNamespaceURI: - objc.NSString? resolvePrefixForNamespaceURI_(objc.NSString namespaceURI) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_resolvePrefixForNamespaceURI_, namespaceURI.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// insertChild:atIndex: - void insertChild_atIndex_(NSXMLNode child, int index) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertChild_atIndex_, child.ref.pointer, index); - } - - /// insertChildren:atIndex: - void insertChildren_atIndex_(objc.NSArray children, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertChildren_atIndex_, - children.ref.pointer, index); - } - - /// removeChildAtIndex: - void removeChildAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeChildAtIndex_, index); - } - - /// setChildren: - void setChildren_(objc.NSArray? children) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildren_, - children?.ref.pointer ?? ffi.nullptr); - } - - /// addChild: - void addChild_(NSXMLNode child) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addChild_, child.ref.pointer); - } - - /// replaceChildAtIndex:withNode: - void replaceChildAtIndex_withNode_(int index, NSXMLNode node) { - _objc_msgSend_1a4j45m(this.ref.pointer, _sel_replaceChildAtIndex_withNode_, - index, node.ref.pointer); - } - - /// normalizeAdjacentTextNodesPreservingCDATA: - void normalizeAdjacentTextNodesPreservingCDATA_(bool preserve) { - _objc_msgSend_117qins(this.ref.pointer, - _sel_normalizeAdjacentTextNodesPreservingCDATA_, preserve); - } - - /// setAttributesAsDictionary: - void setAttributesAsDictionary_(objc.NSDictionary attributes) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setAttributesAsDictionary_, - attributes.ref.pointer); - } - - /// init - NSXMLElement init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithKind: - NSXMLElement initWithKind_(NSXMLNodeKind kind) { - final _ret = _objc_msgSend_ayvqtd( - this.ref.retainAndReturnPointer(), _sel_initWithKind_, kind.value); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// document - static objc.ObjCObjectBase document() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLElement, _sel_document); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// documentWithRootElement: - static objc.ObjCObjectBase documentWithRootElement_(NSXMLElement element) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_documentWithRootElement_, element.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName: - static objc.ObjCObjectBase elementWithName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_elementWithName_, name.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:URI: - static objc.ObjCObjectBase elementWithName_URI_( - objc.NSString name, objc.NSString URI) { - final _ret = _objc_msgSend_iq11qg(_class_NSXMLElement, - _sel_elementWithName_URI_, name.ref.pointer, URI.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:stringValue: - static objc.ObjCObjectBase elementWithName_stringValue_( - objc.NSString name, objc.NSString string) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_elementWithName_stringValue_, - name.ref.pointer, - string.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// elementWithName:children:attributes: - static objc.ObjCObjectBase elementWithName_children_attributes_( - objc.NSString name, objc.NSArray? children, objc.NSArray? attributes) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLElement, - _sel_elementWithName_children_attributes_, - name.ref.pointer, - children?.ref.pointer ?? ffi.nullptr, - attributes?.ref.pointer ?? ffi.nullptr); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:stringValue: - static objc.ObjCObjectBase attributeWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_attributeWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// attributeWithName:URI:stringValue: - static objc.ObjCObjectBase attributeWithName_URI_stringValue_( - objc.NSString name, objc.NSString URI, objc.NSString stringValue) { - final _ret = _objc_msgSend_aud7dn( - _class_NSXMLElement, - _sel_attributeWithName_URI_stringValue_, - name.ref.pointer, - URI.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// namespaceWithName:stringValue: - static objc.ObjCObjectBase namespaceWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_namespaceWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// processingInstructionWithName:stringValue: - static objc.ObjCObjectBase processingInstructionWithName_stringValue_( - objc.NSString name, objc.NSString stringValue) { - final _ret = _objc_msgSend_iq11qg( - _class_NSXMLElement, - _sel_processingInstructionWithName_stringValue_, - name.ref.pointer, - stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// commentWithStringValue: - static objc.ObjCObjectBase commentWithStringValue_( - objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_commentWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// textWithStringValue: - static objc.ObjCObjectBase textWithStringValue_(objc.NSString stringValue) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_textWithStringValue_, stringValue.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// DTDNodeWithXMLString: - static objc.ObjCObjectBase? DTDNodeWithXMLString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_DTDNodeWithXMLString_, string.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// localNameForName: - static objc.NSString localNameForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_localNameForName_, name.ref.pointer); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// prefixForName: - static objc.NSString? prefixForName_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7( - _class_NSXMLElement, _sel_prefixForName_, name.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// predefinedNamespaceForPrefix: - static NSXMLNode? predefinedNamespaceForPrefix_(objc.NSString name) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_predefinedNamespaceForPrefix_, name.ref.pointer); - return _ret.address == 0 - ? null - : NSXMLNode.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSXMLElement new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLElement, _sel_new); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSXMLElement allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSXMLElement, _sel_allocWithZone_, zone); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSXMLElement alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSXMLElement, _sel_alloc); - return NSXMLElement.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSXMLElement, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSXMLElement, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSXMLElement, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSXMLElement, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSXMLElement, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSXMLElement, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSXMLElement, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLElement, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSXMLElement, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSXMLElement self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSXMLElement retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSXMLElement autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSXMLElement.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSHost = objc.getClass("NSHost"); -late final _sel_currentHost = objc.registerName("currentHost"); -late final _sel_hostWithName_ = objc.registerName("hostWithName:"); -late final _sel_hostWithAddress_ = objc.registerName("hostWithAddress:"); -late final _sel_isEqualToHost_ = objc.registerName("isEqualToHost:"); -late final _sel_names = objc.registerName("names"); -late final _sel_address = objc.registerName("address"); -late final _sel_localizedName = objc.registerName("localizedName"); -late final _sel_setHostCacheEnabled_ = - objc.registerName("setHostCacheEnabled:"); -late final _sel_isHostCacheEnabled = objc.registerName("isHostCacheEnabled"); -late final _sel_flushHostCache = objc.registerName("flushHostCache"); - -/// NSHost -class NSHost extends objc.NSObject { - NSHost._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSHost] that points to the same underlying object as [other]. - NSHost.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSHost] that wraps the given raw object pointer. - NSHost.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSHost]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSHost); - } - - /// currentHost - static NSHost currentHost() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHost, _sel_currentHost); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// hostWithName: - static NSHost hostWithName_(objc.NSString? name) { - final _ret = _objc_msgSend_juohf7( - _class_NSHost, _sel_hostWithName_, name?.ref.pointer ?? ffi.nullptr); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// hostWithAddress: - static NSHost hostWithAddress_(objc.NSString address) { - final _ret = _objc_msgSend_juohf7( - _class_NSHost, _sel_hostWithAddress_, address.ref.pointer); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// isEqualToHost: - bool isEqualToHost_(NSHost aHost) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToHost_, aHost.ref.pointer); - } - - /// name - objc.NSString? get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// names - objc.NSArray get names { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_names); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// address - objc.NSString? get address { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_address); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// addresses - objc.NSArray get addresses { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_addresses); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// localizedName - objc.NSString? get localizedName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setHostCacheEnabled: - static void setHostCacheEnabled_(bool flag) { - _objc_msgSend_117qins(_class_NSHost, _sel_setHostCacheEnabled_, flag); - } - - /// isHostCacheEnabled - static bool isHostCacheEnabled() { - return _objc_msgSend_olxnu1(_class_NSHost, _sel_isHostCacheEnabled); - } - - /// flushHostCache - static void flushHostCache() { - _objc_msgSend_ksby9f(_class_NSHost, _sel_flushHostCache); - } - - /// init - NSHost init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSHost new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHost, _sel_new); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSHost allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSHost, _sel_allocWithZone_, zone); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSHost alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSHost, _sel_alloc); - return NSHost.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSHost, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSHost, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSHost, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSHost, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSHost, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSHost, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSHost, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSHost, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSHost, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// self - NSHost self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// retain - NSHost retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } - - /// autorelease - NSHost autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSHost.castFromPointer(_ret, retain: true, release: true); - } -} - -late final _class_NSClassDescription = objc.getClass("NSClassDescription"); -late final _sel_registerClassDescription_forClass_ = - objc.registerName("registerClassDescription:forClass:"); -late final _sel_invalidateClassDescriptionCache = - objc.registerName("invalidateClassDescriptionCache"); -late final _sel_classDescriptionForClass_ = - objc.registerName("classDescriptionForClass:"); -late final _sel_attributeKeys = objc.registerName("attributeKeys"); -late final _sel_toOneRelationshipKeys = - objc.registerName("toOneRelationshipKeys"); -late final _sel_toManyRelationshipKeys = - objc.registerName("toManyRelationshipKeys"); -late final _sel_inverseForRelationshipKey_ = - objc.registerName("inverseForRelationshipKey:"); - -/// NSClassDescription -class NSClassDescription extends objc.NSObject { - NSClassDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSClassDescription] that points to the same underlying object as [other]. - NSClassDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSClassDescription] that wraps the given raw object pointer. - NSClassDescription.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSClassDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSClassDescription); - } - - /// registerClassDescription:forClass: - static void registerClassDescription_forClass_( - NSClassDescription description, objc.ObjCObjectBase aClass) { - _objc_msgSend_1tjlcwl( - _class_NSClassDescription, - _sel_registerClassDescription_forClass_, - description.ref.pointer, - aClass.ref.pointer); - } - - /// invalidateClassDescriptionCache - static void invalidateClassDescriptionCache() { - _objc_msgSend_ksby9f( - _class_NSClassDescription, _sel_invalidateClassDescriptionCache); - } - - /// classDescriptionForClass: - static NSClassDescription? classDescriptionForClass_( - objc.ObjCObjectBase aClass) { - final _ret = _objc_msgSend_juohf7(_class_NSClassDescription, - _sel_classDescriptionForClass_, aClass.ref.pointer); - return _ret.address == 0 - ? null - : NSClassDescription.castFromPointer(_ret, retain: true, release: true); - } - - /// attributeKeys - objc.NSArray get attributeKeys { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_attributeKeys); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// toOneRelationshipKeys - objc.NSArray get toOneRelationshipKeys { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_toOneRelationshipKeys); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// toManyRelationshipKeys - objc.NSArray get toManyRelationshipKeys { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_toManyRelationshipKeys); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// inverseForRelationshipKey: - objc.NSString? inverseForRelationshipKey_(objc.NSString relationshipKey) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_inverseForRelationshipKey_, relationshipKey.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSClassDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSClassDescription new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSClassDescription, _sel_new); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSClassDescription allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSClassDescription, _sel_allocWithZone_, zone); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSClassDescription alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSClassDescription, _sel_alloc); - return NSClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSClassDescription, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSClassDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSClassDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSClassDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSClassDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSClassDescription, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSClassDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_NSScriptClassDescription = - objc.getClass("NSScriptClassDescription"); -late final _sel_initWithSuiteName_className_dictionary_ = - objc.registerName("initWithSuiteName:className:dictionary:"); -late final _sel_suiteName = objc.registerName("suiteName"); -late final _sel_className = objc.registerName("className"); -late final _sel_implementationClassName = - objc.registerName("implementationClassName"); -late final _sel_superclassDescription = - objc.registerName("superclassDescription"); -late final _sel_appleEventCode = objc.registerName("appleEventCode"); -final _objc_msgSend_dzloj4 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_matchesAppleEventCode_ = - objc.registerName("matchesAppleEventCode:"); -final _objc_msgSend_1n8vqu1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _class_NSScriptCommandDescription = - objc.getClass("NSScriptCommandDescription"); -late final _sel_initWithSuiteName_commandName_dictionary_ = - objc.registerName("initWithSuiteName:commandName:dictionary:"); -late final _sel_commandName = objc.registerName("commandName"); -late final _sel_appleEventClassCode = objc.registerName("appleEventClassCode"); -late final _sel_commandClassName = objc.registerName("commandClassName"); -late final _sel_returnType = objc.registerName("returnType"); -late final _sel_appleEventCodeForReturnType = - objc.registerName("appleEventCodeForReturnType"); -late final _sel_argumentNames = objc.registerName("argumentNames"); -late final _sel_typeForArgumentWithName_ = - objc.registerName("typeForArgumentWithName:"); -late final _sel_appleEventCodeForArgumentWithName_ = - objc.registerName("appleEventCodeForArgumentWithName:"); -final _objc_msgSend_t2sarz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_isOptionalArgumentWithName_ = - objc.registerName("isOptionalArgumentWithName:"); -late final _class_NSScriptCommand = objc.getClass("NSScriptCommand"); -late final _sel_initWithCommandDescription_ = - objc.registerName("initWithCommandDescription:"); -late final _sel_commandDescription = objc.registerName("commandDescription"); -late final _sel_directParameter = objc.registerName("directParameter"); -late final _sel_setDirectParameter_ = objc.registerName("setDirectParameter:"); -late final _class_NSScriptObjectSpecifier = - objc.getClass("NSScriptObjectSpecifier"); -late final _class_NSAppleEventDescriptor = - objc.getClass("NSAppleEventDescriptor"); -late final _sel_nullDescriptor = objc.registerName("nullDescriptor"); -late final _sel_descriptorWithDescriptorType_bytes_length_ = - objc.registerName("descriptorWithDescriptorType:bytes:length:"); -final _objc_msgSend_unctjf = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, ffi.Pointer, int)>(); -late final _sel_descriptorWithDescriptorType_data_ = - objc.registerName("descriptorWithDescriptorType:data:"); -final _objc_msgSend_1k5vjgv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -late final _sel_descriptorWithBoolean_ = - objc.registerName("descriptorWithBoolean:"); -late final _sel_descriptorWithEnumCode_ = - objc.registerName("descriptorWithEnumCode:"); -late final _sel_descriptorWithInt32_ = - objc.registerName("descriptorWithInt32:"); -late final _sel_descriptorWithDouble_ = - objc.registerName("descriptorWithDouble:"); -late final _sel_descriptorWithTypeCode_ = - objc.registerName("descriptorWithTypeCode:"); -late final _sel_descriptorWithString_ = - objc.registerName("descriptorWithString:"); -late final _sel_descriptorWithDate_ = objc.registerName("descriptorWithDate:"); -late final _sel_descriptorWithFileURL_ = - objc.registerName("descriptorWithFileURL:"); -late final _sel_appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID_ = - objc.registerName( - "appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:"); -final _objc_msgSend_1iwlq4o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.UnsignedInt, - ffi.Pointer, - ffi.Short, - ffi.Int)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - ffi.Pointer, - int, - int)>(); -late final _sel_listDescriptor = objc.registerName("listDescriptor"); -late final _sel_recordDescriptor = objc.registerName("recordDescriptor"); -late final _sel_currentProcessDescriptor = - objc.registerName("currentProcessDescriptor"); -late final _sel_descriptorWithProcessIdentifier_ = - objc.registerName("descriptorWithProcessIdentifier:"); -late final _sel_descriptorWithBundleIdentifier_ = - objc.registerName("descriptorWithBundleIdentifier:"); -late final _sel_descriptorWithApplicationURL_ = - objc.registerName("descriptorWithApplicationURL:"); - -final class OpaqueAEDataStorageType extends ffi.Opaque {} - -@ffi.Packed(2) -final class AEDesc extends ffi.Struct { - @ffi.UnsignedInt() - external int descriptorType; - - external ffi.Pointer> dataHandle; -} - -late final _sel_initWithAEDescNoCopy_ = - objc.registerName("initWithAEDescNoCopy:"); -final _objc_msgSend_10xxpbh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_initWithDescriptorType_bytes_length_ = - objc.registerName("initWithDescriptorType:bytes:length:"); -late final _sel_initWithDescriptorType_data_ = - objc.registerName("initWithDescriptorType:data:"); -late final _sel_initWithEventClass_eventID_targetDescriptor_returnID_transactionID_ = - objc.registerName( - "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:"); -late final _sel_initListDescriptor = objc.registerName("initListDescriptor"); -late final _sel_initRecordDescriptor = - objc.registerName("initRecordDescriptor"); -late final _sel_aeDesc = objc.registerName("aeDesc"); -final _objc_msgSend_jg6irx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_descriptorType = objc.registerName("descriptorType"); -late final _sel_booleanValue = objc.registerName("booleanValue"); -final _objc_msgSend_1cswds = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedChar Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -late final _sel_enumCodeValue = objc.registerName("enumCodeValue"); -late final _sel_int32Value = objc.registerName("int32Value"); -late final _sel_typeCodeValue = objc.registerName("typeCodeValue"); -late final _sel_dateValue = objc.registerName("dateValue"); -late final _sel_fileURLValue = objc.registerName("fileURLValue"); -late final _sel_eventClass = objc.registerName("eventClass"); -late final _sel_eventID = objc.registerName("eventID"); -late final _sel_returnID = objc.registerName("returnID"); -late final _sel_transactionID = objc.registerName("transactionID"); -late final _sel_setParamDescriptor_forKeyword_ = - objc.registerName("setParamDescriptor:forKeyword:"); -final _objc_msgSend_1dzwu6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_paramDescriptorForKeyword_ = - objc.registerName("paramDescriptorForKeyword:"); -late final _sel_removeParamDescriptorWithKeyword_ = - objc.registerName("removeParamDescriptorWithKeyword:"); -final _objc_msgSend_l6g8fv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_setAttributeDescriptor_forKeyword_ = - objc.registerName("setAttributeDescriptor:forKeyword:"); -late final _sel_attributeDescriptorForKeyword_ = - objc.registerName("attributeDescriptorForKeyword:"); - -enum NSAppleEventSendOptions { - NSAppleEventSendNoReply(1), - NSAppleEventSendQueueReply(2), - NSAppleEventSendWaitForReply(3), - NSAppleEventSendNeverInteract(16), - NSAppleEventSendCanInteract(32), - NSAppleEventSendAlwaysInteract(48), - NSAppleEventSendCanSwitchLayer(64), - NSAppleEventSendDontRecord(4096), - NSAppleEventSendDontExecute(8192), - NSAppleEventSendDontAnnotate(65536), - NSAppleEventSendDefaultOptions(35); - - final int value; - const NSAppleEventSendOptions(this.value); - - static NSAppleEventSendOptions fromValue(int value) => switch (value) { - 1 => NSAppleEventSendNoReply, - 2 => NSAppleEventSendQueueReply, - 3 => NSAppleEventSendWaitForReply, - 16 => NSAppleEventSendNeverInteract, - 32 => NSAppleEventSendCanInteract, - 48 => NSAppleEventSendAlwaysInteract, - 64 => NSAppleEventSendCanSwitchLayer, - 4096 => NSAppleEventSendDontRecord, - 8192 => NSAppleEventSendDontExecute, - 65536 => NSAppleEventSendDontAnnotate, - 35 => NSAppleEventSendDefaultOptions, - _ => throw ArgumentError( - "Unknown value for NSAppleEventSendOptions: $value"), - }; -} - -late final _sel_sendEventWithOptions_timeout_error_ = - objc.registerName("sendEventWithOptions:timeout:error:"); -final _objc_msgSend_19xj9w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Double, - ffi.Pointer>)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - int, - double, - ffi.Pointer>)>(); -late final _sel_isRecordDescriptor = objc.registerName("isRecordDescriptor"); -late final _sel_numberOfItems = objc.registerName("numberOfItems"); -late final _sel_insertDescriptor_atIndex_ = - objc.registerName("insertDescriptor:atIndex:"); -final _objc_msgSend_da94db = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Long)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -late final _sel_descriptorAtIndex_ = objc.registerName("descriptorAtIndex:"); -late final _sel_removeDescriptorAtIndex_ = - objc.registerName("removeDescriptorAtIndex:"); -late final _sel_setDescriptor_forKeyword_ = - objc.registerName("setDescriptor:forKeyword:"); -late final _sel_descriptorForKeyword_ = - objc.registerName("descriptorForKeyword:"); -late final _sel_removeDescriptorWithKeyword_ = - objc.registerName("removeDescriptorWithKeyword:"); -late final _sel_keywordForDescriptorAtIndex_ = - objc.registerName("keywordForDescriptorAtIndex:"); -final _objc_msgSend_hkgvph = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -late final _sel_coerceToDescriptorType_ = - objc.registerName("coerceToDescriptorType:"); - -/// NSAppleEventDescriptor -class NSAppleEventDescriptor extends objc.NSObject { - NSAppleEventDescriptor._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSAppleEventDescriptor] that points to the same underlying object as [other]. - NSAppleEventDescriptor.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSAppleEventDescriptor] that wraps the given raw object pointer. - NSAppleEventDescriptor.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSAppleEventDescriptor]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSAppleEventDescriptor); - } - - /// nullDescriptor - static NSAppleEventDescriptor nullDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_nullDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDescriptorType:bytes:length: - static NSAppleEventDescriptor? descriptorWithDescriptorType_bytes_length_( - int descriptorType, ffi.Pointer bytes, int byteCount) { - final _ret = _objc_msgSend_unctjf( - _class_NSAppleEventDescriptor, - _sel_descriptorWithDescriptorType_bytes_length_, - descriptorType, - bytes, - byteCount); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDescriptorType:data: - static NSAppleEventDescriptor? descriptorWithDescriptorType_data_( - int descriptorType, objc.NSData? data) { - final _ret = _objc_msgSend_1k5vjgv( - _class_NSAppleEventDescriptor, - _sel_descriptorWithDescriptorType_data_, - descriptorType, - data?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithBoolean: - static NSAppleEventDescriptor descriptorWithBoolean_(int boolean) { - final _ret = _objc_msgSend_1ar9f5m( - _class_NSAppleEventDescriptor, _sel_descriptorWithBoolean_, boolean); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithEnumCode: - static NSAppleEventDescriptor descriptorWithEnumCode_(int enumerator) { - final _ret = _objc_msgSend_pxgym4(_class_NSAppleEventDescriptor, - _sel_descriptorWithEnumCode_, enumerator); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithInt32: - static NSAppleEventDescriptor descriptorWithInt32_(int signedInt) { - final _ret = _objc_msgSend_105o5we( - _class_NSAppleEventDescriptor, _sel_descriptorWithInt32_, signedInt); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDouble: - static NSAppleEventDescriptor descriptorWithDouble_(double doubleValue) { - final _ret = _objc_msgSend_m7jc8y( - _class_NSAppleEventDescriptor, _sel_descriptorWithDouble_, doubleValue); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithTypeCode: - static NSAppleEventDescriptor descriptorWithTypeCode_(int typeCode) { - final _ret = _objc_msgSend_pxgym4( - _class_NSAppleEventDescriptor, _sel_descriptorWithTypeCode_, typeCode); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithString: - static NSAppleEventDescriptor descriptorWithString_(objc.NSString string) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithString_, string.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithDate: - static NSAppleEventDescriptor descriptorWithDate_(objc.NSDate date) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithDate_, date.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithFileURL: - static NSAppleEventDescriptor descriptorWithFileURL_(objc.NSURL fileURL) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithFileURL_, fileURL.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID: - static NSAppleEventDescriptor - appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID_( - int eventClass, - int eventID, - NSAppleEventDescriptor? targetDescriptor, - int returnID, - int transactionID) { - final _ret = _objc_msgSend_1iwlq4o( - _class_NSAppleEventDescriptor, - _sel_appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID_, - eventClass, - eventID, - targetDescriptor?.ref.pointer ?? ffi.nullptr, - returnID, - transactionID); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// listDescriptor - static NSAppleEventDescriptor listDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_listDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// recordDescriptor - static NSAppleEventDescriptor recordDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_recordDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// currentProcessDescriptor - static NSAppleEventDescriptor currentProcessDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_currentProcessDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithProcessIdentifier: - static NSAppleEventDescriptor descriptorWithProcessIdentifier_( - int processIdentifier) { - final _ret = _objc_msgSend_105o5we(_class_NSAppleEventDescriptor, - _sel_descriptorWithProcessIdentifier_, processIdentifier); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithBundleIdentifier: - static NSAppleEventDescriptor descriptorWithBundleIdentifier_( - objc.NSString bundleIdentifier) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithBundleIdentifier_, bundleIdentifier.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptorWithApplicationURL: - static NSAppleEventDescriptor descriptorWithApplicationURL_( - objc.NSURL applicationURL) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_descriptorWithApplicationURL_, applicationURL.ref.pointer); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithAEDescNoCopy: - NSAppleEventDescriptor initWithAEDescNoCopy_(ffi.Pointer aeDesc) { - final _ret = _objc_msgSend_10xxpbh( - this.ref.retainAndReturnPointer(), _sel_initWithAEDescNoCopy_, aeDesc); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithDescriptorType:bytes:length: - NSAppleEventDescriptor? initWithDescriptorType_bytes_length_( - int descriptorType, ffi.Pointer bytes, int byteCount) { - final _ret = _objc_msgSend_unctjf( - this.ref.retainAndReturnPointer(), - _sel_initWithDescriptorType_bytes_length_, - descriptorType, - bytes, - byteCount); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithDescriptorType:data: - NSAppleEventDescriptor? initWithDescriptorType_data_( - int descriptorType, objc.NSData? data) { - final _ret = _objc_msgSend_1k5vjgv( - this.ref.retainAndReturnPointer(), - _sel_initWithDescriptorType_data_, - descriptorType, - data?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithEventClass:eventID:targetDescriptor:returnID:transactionID: - NSAppleEventDescriptor - initWithEventClass_eventID_targetDescriptor_returnID_transactionID_( - int eventClass, - int eventID, - NSAppleEventDescriptor? targetDescriptor, - int returnID, - int transactionID) { - final _ret = _objc_msgSend_1iwlq4o( - this.ref.retainAndReturnPointer(), - _sel_initWithEventClass_eventID_targetDescriptor_returnID_transactionID_, - eventClass, - eventID, - targetDescriptor?.ref.pointer ?? ffi.nullptr, - returnID, - transactionID); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initListDescriptor - NSAppleEventDescriptor initListDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.retainAndReturnPointer(), _sel_initListDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// initRecordDescriptor - NSAppleEventDescriptor initRecordDescriptor() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.retainAndReturnPointer(), _sel_initRecordDescriptor); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// aeDesc - ffi.Pointer get aeDesc { - return _objc_msgSend_jg6irx(this.ref.pointer, _sel_aeDesc); - } - - /// descriptorType - int get descriptorType { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_descriptorType); - } - - /// data - objc.NSData get data { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_data); - return objc.NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// booleanValue - int get booleanValue { - return _objc_msgSend_1cswds(this.ref.pointer, _sel_booleanValue); - } - - /// enumCodeValue - int get enumCodeValue { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_enumCodeValue); - } - - /// int32Value - int get int32Value { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_int32Value); - } - - /// doubleValue - double get doubleValue { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_doubleValue) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_doubleValue); - } - - /// typeCodeValue - int get typeCodeValue { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_typeCodeValue); - } - - /// stringValue - objc.NSString? get stringValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_stringValue); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// dateValue - objc.NSDate? get dateValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dateValue); - return _ret.address == 0 - ? null - : objc.NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// fileURLValue - objc.NSURL? get fileURLValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileURLValue); - return _ret.address == 0 - ? null - : objc.NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// eventClass - int get eventClass { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_eventClass); - } - - /// eventID - int get eventID { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_eventID); - } - - /// returnID - int get returnID { - return _objc_msgSend_157j54x(this.ref.pointer, _sel_returnID); - } - - /// transactionID - int get transactionID { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_transactionID); - } - - /// setParamDescriptor:forKeyword: - void setParamDescriptor_forKeyword_( - NSAppleEventDescriptor descriptor, int keyword) { - _objc_msgSend_1dzwu6(this.ref.pointer, _sel_setParamDescriptor_forKeyword_, - descriptor.ref.pointer, keyword); - } - - /// paramDescriptorForKeyword: - NSAppleEventDescriptor? paramDescriptorForKeyword_(int keyword) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_paramDescriptorForKeyword_, keyword); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeParamDescriptorWithKeyword: - void removeParamDescriptorWithKeyword_(int keyword) { - _objc_msgSend_l6g8fv( - this.ref.pointer, _sel_removeParamDescriptorWithKeyword_, keyword); - } - - /// setAttributeDescriptor:forKeyword: - void setAttributeDescriptor_forKeyword_( - NSAppleEventDescriptor descriptor, int keyword) { - _objc_msgSend_1dzwu6( - this.ref.pointer, - _sel_setAttributeDescriptor_forKeyword_, - descriptor.ref.pointer, - keyword); - } - - /// attributeDescriptorForKeyword: - NSAppleEventDescriptor? attributeDescriptorForKeyword_(int keyword) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_attributeDescriptorForKeyword_, keyword); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// sendEventWithOptions:timeout:error: - NSAppleEventDescriptor? sendEventWithOptions_timeout_error_( - NSAppleEventSendOptions sendOptions, - double timeoutInSeconds, - ffi.Pointer> error) { - final _ret = _objc_msgSend_19xj9w( - this.ref.pointer, - _sel_sendEventWithOptions_timeout_error_, - sendOptions.value, - timeoutInSeconds, - error); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// isRecordDescriptor - bool get isRecordDescriptor { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isRecordDescriptor); - } - - /// numberOfItems - int get numberOfItems { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_numberOfItems); - } - - /// insertDescriptor:atIndex: - void insertDescriptor_atIndex_(NSAppleEventDescriptor descriptor, int index) { - _objc_msgSend_da94db(this.ref.pointer, _sel_insertDescriptor_atIndex_, - descriptor.ref.pointer, index); - } - - /// descriptorAtIndex: - NSAppleEventDescriptor? descriptorAtIndex_(int index) { - final _ret = - _objc_msgSend_crtxa9(this.ref.pointer, _sel_descriptorAtIndex_, index); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeDescriptorAtIndex: - void removeDescriptorAtIndex_(int index) { - _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_removeDescriptorAtIndex_, index); - } - - /// setDescriptor:forKeyword: - void setDescriptor_forKeyword_( - NSAppleEventDescriptor descriptor, int keyword) { - _objc_msgSend_1dzwu6(this.ref.pointer, _sel_setDescriptor_forKeyword_, - descriptor.ref.pointer, keyword); - } - - /// descriptorForKeyword: - NSAppleEventDescriptor? descriptorForKeyword_(int keyword) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_descriptorForKeyword_, keyword); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeDescriptorWithKeyword: - void removeDescriptorWithKeyword_(int keyword) { - _objc_msgSend_l6g8fv( - this.ref.pointer, _sel_removeDescriptorWithKeyword_, keyword); - } - - /// keywordForDescriptorAtIndex: - int keywordForDescriptorAtIndex_(int index) { - return _objc_msgSend_hkgvph( - this.ref.pointer, _sel_keywordForDescriptorAtIndex_, index); - } - - /// coerceToDescriptorType: - NSAppleEventDescriptor? coerceToDescriptorType_(int descriptorType) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_coerceToDescriptorType_, descriptorType); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSAppleEventDescriptor init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSAppleEventDescriptor new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSAppleEventDescriptor, _sel_new); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSAppleEventDescriptor allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSAppleEventDescriptor, _sel_allocWithZone_, zone); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSAppleEventDescriptor alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSAppleEventDescriptor, _sel_alloc); - return NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSAppleEventDescriptor, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSAppleEventDescriptor, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSAppleEventDescriptor, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSAppleEventDescriptor, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSAppleEventDescriptor, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSAppleEventDescriptor, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSAppleEventDescriptor, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSAppleEventDescriptor, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSAppleEventDescriptor, _sel_supportsSecureCoding); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// initWithCoder: - NSAppleEventDescriptor? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: false, release: true); - } -} - -late final _sel_objectSpecifierWithDescriptor_ = - objc.registerName("objectSpecifierWithDescriptor:"); -late final _sel_initWithContainerSpecifier_key_ = - objc.registerName("initWithContainerSpecifier:key:"); -late final _sel_initWithContainerClassDescription_containerSpecifier_key_ = objc - .registerName("initWithContainerClassDescription:containerSpecifier:key:"); -late final _sel_childSpecifier = objc.registerName("childSpecifier"); -late final _sel_setChildSpecifier_ = objc.registerName("setChildSpecifier:"); -late final _sel_containerSpecifier = objc.registerName("containerSpecifier"); -late final _sel_setContainerSpecifier_ = - objc.registerName("setContainerSpecifier:"); -late final _sel_containerIsObjectBeingTested = - objc.registerName("containerIsObjectBeingTested"); -late final _sel_setContainerIsObjectBeingTested_ = - objc.registerName("setContainerIsObjectBeingTested:"); -late final _sel_containerIsRangeContainerObject = - objc.registerName("containerIsRangeContainerObject"); -late final _sel_setContainerIsRangeContainerObject_ = - objc.registerName("setContainerIsRangeContainerObject:"); -late final _sel_key = objc.registerName("key"); -late final _sel_setKey_ = objc.registerName("setKey:"); -late final _sel_containerClassDescription = - objc.registerName("containerClassDescription"); -late final _sel_setContainerClassDescription_ = - objc.registerName("setContainerClassDescription:"); -late final _sel_keyClassDescription = objc.registerName("keyClassDescription"); -late final _sel_indicesOfObjectsByEvaluatingWithContainer_count_ = - objc.registerName("indicesOfObjectsByEvaluatingWithContainer:count:"); -final _objc_msgSend_1e2yezv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -late final _sel_objectsByEvaluatingWithContainers_ = - objc.registerName("objectsByEvaluatingWithContainers:"); -late final _sel_objectsByEvaluatingSpecifier = - objc.registerName("objectsByEvaluatingSpecifier"); -late final _sel_evaluationErrorNumber = - objc.registerName("evaluationErrorNumber"); -late final _sel_setEvaluationErrorNumber_ = - objc.registerName("setEvaluationErrorNumber:"); -late final _sel_evaluationErrorSpecifier = - objc.registerName("evaluationErrorSpecifier"); -late final _sel_descriptor = objc.registerName("descriptor"); - -/// NSScriptObjectSpecifier -class NSScriptObjectSpecifier extends objc.NSObject { - NSScriptObjectSpecifier._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptObjectSpecifier] that points to the same underlying object as [other]. - NSScriptObjectSpecifier.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptObjectSpecifier] that wraps the given raw object pointer. - NSScriptObjectSpecifier.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptObjectSpecifier]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScriptObjectSpecifier); - } - - /// objectSpecifierWithDescriptor: - static NSScriptObjectSpecifier? objectSpecifierWithDescriptor_( - NSAppleEventDescriptor descriptor) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptObjectSpecifier, - _sel_objectSpecifierWithDescriptor_, descriptor.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// initWithContainerSpecifier:key: - NSScriptObjectSpecifier initWithContainerSpecifier_key_( - NSScriptObjectSpecifier container, objc.NSString property) { - final _ret = _objc_msgSend_iq11qg( - this.ref.retainAndReturnPointer(), - _sel_initWithContainerSpecifier_key_, - container.ref.pointer, - property.ref.pointer); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithContainerClassDescription:containerSpecifier:key: - NSScriptObjectSpecifier - initWithContainerClassDescription_containerSpecifier_key_( - NSScriptClassDescription classDesc, - NSScriptObjectSpecifier? container, - objc.NSString property) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithContainerClassDescription_containerSpecifier_key_, - classDesc.ref.pointer, - container?.ref.pointer ?? ffi.nullptr, - property.ref.pointer); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithCoder: - NSScriptObjectSpecifier? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// childSpecifier - NSScriptObjectSpecifier? get childSpecifier { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_childSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// setChildSpecifier: - set childSpecifier(NSScriptObjectSpecifier? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setChildSpecifier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// containerSpecifier - NSScriptObjectSpecifier? get containerSpecifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_containerSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// setContainerSpecifier: - set containerSpecifier(NSScriptObjectSpecifier? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setContainerSpecifier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// containerIsObjectBeingTested - bool get containerIsObjectBeingTested { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_containerIsObjectBeingTested); - } - - /// setContainerIsObjectBeingTested: - set containerIsObjectBeingTested(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setContainerIsObjectBeingTested_, value); - } - - /// containerIsRangeContainerObject - bool get containerIsRangeContainerObject { - return _objc_msgSend_olxnu1( - this.ref.pointer, _sel_containerIsRangeContainerObject); - } - - /// setContainerIsRangeContainerObject: - set containerIsRangeContainerObject(bool value) { - return _objc_msgSend_117qins( - this.ref.pointer, _sel_setContainerIsRangeContainerObject_, value); - } - - /// key - objc.NSString get key { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_key); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setKey: - set key(objc.NSString value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setKey_, value.ref.pointer); - } - - /// containerClassDescription - NSScriptClassDescription? get containerClassDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_containerClassDescription); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// setContainerClassDescription: - set containerClassDescription(NSScriptClassDescription? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, - _sel_setContainerClassDescription_, value?.ref.pointer ?? ffi.nullptr); - } - - /// keyClassDescription - NSScriptClassDescription? get keyClassDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_keyClassDescription); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// indicesOfObjectsByEvaluatingWithContainer:count: - ffi.Pointer indicesOfObjectsByEvaluatingWithContainer_count_( - objc.ObjCObjectBase container, ffi.Pointer count) { - return _objc_msgSend_1e2yezv( - this.ref.pointer, - _sel_indicesOfObjectsByEvaluatingWithContainer_count_, - container.ref.pointer, - count); - } - - /// objectsByEvaluatingWithContainers: - objc.ObjCObjectBase? objectsByEvaluatingWithContainers_( - objc.ObjCObjectBase containers) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_objectsByEvaluatingWithContainers_, containers.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectsByEvaluatingSpecifier - objc.ObjCObjectBase? get objectsByEvaluatingSpecifier { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_objectsByEvaluatingSpecifier); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// evaluationErrorNumber - int get evaluationErrorNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_evaluationErrorNumber); - } - - /// setEvaluationErrorNumber: - set evaluationErrorNumber(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setEvaluationErrorNumber_, value); - } - - /// evaluationErrorSpecifier - NSScriptObjectSpecifier? get evaluationErrorSpecifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_evaluationErrorSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// descriptor - NSAppleEventDescriptor? get descriptor { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_descriptor); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// init - NSScriptObjectSpecifier init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSScriptObjectSpecifier new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptObjectSpecifier, _sel_new); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSScriptObjectSpecifier allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptObjectSpecifier, _sel_allocWithZone_, zone); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSScriptObjectSpecifier alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptObjectSpecifier, _sel_alloc); - return NSScriptObjectSpecifier.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptObjectSpecifier, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptObjectSpecifier, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScriptObjectSpecifier, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSScriptObjectSpecifier, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptObjectSpecifier, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptObjectSpecifier, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptObjectSpecifier, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptObjectSpecifier, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptObjectSpecifier, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_receiversSpecifier = objc.registerName("receiversSpecifier"); -late final _sel_setReceiversSpecifier_ = - objc.registerName("setReceiversSpecifier:"); -late final _sel_evaluatedReceivers = objc.registerName("evaluatedReceivers"); -late final _sel_evaluatedArguments = objc.registerName("evaluatedArguments"); -late final _sel_isWellFormed = objc.registerName("isWellFormed"); -late final _sel_performDefaultImplementation = - objc.registerName("performDefaultImplementation"); -late final _sel_executeCommand = objc.registerName("executeCommand"); -late final _sel_scriptErrorNumber = objc.registerName("scriptErrorNumber"); -late final _sel_setScriptErrorNumber_ = - objc.registerName("setScriptErrorNumber:"); -late final _sel_scriptErrorOffendingObjectDescriptor = - objc.registerName("scriptErrorOffendingObjectDescriptor"); -late final _sel_setScriptErrorOffendingObjectDescriptor_ = - objc.registerName("setScriptErrorOffendingObjectDescriptor:"); -late final _sel_scriptErrorExpectedTypeDescriptor = - objc.registerName("scriptErrorExpectedTypeDescriptor"); -late final _sel_setScriptErrorExpectedTypeDescriptor_ = - objc.registerName("setScriptErrorExpectedTypeDescriptor:"); -late final _sel_scriptErrorString = objc.registerName("scriptErrorString"); -late final _sel_setScriptErrorString_ = - objc.registerName("setScriptErrorString:"); -late final _sel_currentCommand = objc.registerName("currentCommand"); -late final _sel_appleEvent = objc.registerName("appleEvent"); -late final _sel_suspendExecution = objc.registerName("suspendExecution"); -late final _sel_resumeExecutionWithResult_ = - objc.registerName("resumeExecutionWithResult:"); - -/// NSScriptCommand -class NSScriptCommand extends objc.NSObject { - NSScriptCommand._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptCommand] that points to the same underlying object as [other]. - NSScriptCommand.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptCommand] that wraps the given raw object pointer. - NSScriptCommand.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptCommand]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScriptCommand); - } - - /// initWithCommandDescription: - NSScriptCommand initWithCommandDescription_( - NSScriptCommandDescription commandDef) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCommandDescription_, commandDef.ref.pointer); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSScriptCommand? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// commandDescription - NSScriptCommandDescription get commandDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commandDescription); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// directParameter - objc.ObjCObjectBase? get directParameter { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_directParameter); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// setDirectParameter: - set directParameter(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setDirectParameter_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// receiversSpecifier - NSScriptObjectSpecifier? get receiversSpecifier { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_receiversSpecifier); - return _ret.address == 0 - ? null - : NSScriptObjectSpecifier.castFromPointer(_ret, - retain: true, release: true); - } - - /// setReceiversSpecifier: - set receiversSpecifier(NSScriptObjectSpecifier? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setReceiversSpecifier_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// evaluatedReceivers - objc.ObjCObjectBase? get evaluatedReceivers { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_evaluatedReceivers); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// arguments - objc.NSDictionary? get arguments { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_arguments); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// setArguments: - set arguments(objc.NSDictionary? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setArguments_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// evaluatedArguments - objc.NSDictionary? get evaluatedArguments { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_evaluatedArguments); - return _ret.address == 0 - ? null - : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// isWellFormed - bool get wellFormed { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isWellFormed); - } - - /// performDefaultImplementation - objc.ObjCObjectBase? performDefaultImplementation() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_performDefaultImplementation); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// executeCommand - objc.ObjCObjectBase? executeCommand() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_executeCommand); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// scriptErrorNumber - int get scriptErrorNumber { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_scriptErrorNumber); - } - - /// setScriptErrorNumber: - set scriptErrorNumber(int value) { - return _objc_msgSend_ke7qz2( - this.ref.pointer, _sel_setScriptErrorNumber_, value); - } - - /// scriptErrorOffendingObjectDescriptor - NSAppleEventDescriptor? get scriptErrorOffendingObjectDescriptor { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_scriptErrorOffendingObjectDescriptor); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// setScriptErrorOffendingObjectDescriptor: - set scriptErrorOffendingObjectDescriptor(NSAppleEventDescriptor? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setScriptErrorOffendingObjectDescriptor_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// scriptErrorExpectedTypeDescriptor - NSAppleEventDescriptor? get scriptErrorExpectedTypeDescriptor { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_scriptErrorExpectedTypeDescriptor); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// setScriptErrorExpectedTypeDescriptor: - set scriptErrorExpectedTypeDescriptor(NSAppleEventDescriptor? value) { - return _objc_msgSend_ukcdfq( - this.ref.pointer, - _sel_setScriptErrorExpectedTypeDescriptor_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// scriptErrorString - objc.NSString? get scriptErrorString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_scriptErrorString); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// setScriptErrorString: - set scriptErrorString(objc.NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setScriptErrorString_, - value?.ref.pointer ?? ffi.nullptr); - } - - /// currentCommand - static NSScriptCommand? currentCommand() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptCommand, _sel_currentCommand); - return _ret.address == 0 - ? null - : NSScriptCommand.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEvent - NSAppleEventDescriptor? get appleEvent { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_appleEvent); - return _ret.address == 0 - ? null - : NSAppleEventDescriptor.castFromPointer(_ret, - retain: true, release: true); - } - - /// suspendExecution - void suspendExecution() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_suspendExecution); - } - - /// resumeExecutionWithResult: - void resumeExecutionWithResult_(objc.ObjCObjectBase? result) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_resumeExecutionWithResult_, - result?.ref.pointer ?? ffi.nullptr); - } - - /// init - NSScriptCommand init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// new - static NSScriptCommand new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScriptCommand, _sel_new); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSScriptCommand allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptCommand, _sel_allocWithZone_, zone); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// alloc - static NSScriptCommand alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSScriptCommand, _sel_alloc); - return NSScriptCommand.castFromPointer(_ret, retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptCommand, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptCommand, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScriptCommand, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_NSScriptCommand, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptCommand, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptCommand, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptCommand, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommand, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommand, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_createCommandInstance = - objc.registerName("createCommandInstance"); -late final _sel_createCommandInstanceWithZone_ = - objc.registerName("createCommandInstanceWithZone:"); - -/// NSScriptCommandDescription -class NSScriptCommandDescription extends objc.NSObject { - NSScriptCommandDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptCommandDescription] that points to the same underlying object as [other]. - NSScriptCommandDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptCommandDescription] that wraps the given raw object pointer. - NSScriptCommandDescription.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptCommandDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg(obj.ref.pointer, _sel_isKindOfClass_, - _class_NSScriptCommandDescription); - } - - /// init - NSScriptCommandDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithSuiteName:commandName:dictionary: - NSScriptCommandDescription? initWithSuiteName_commandName_dictionary_( - objc.NSString suiteName, - objc.NSString commandName, - objc.NSDictionary? commandDeclaration) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithSuiteName_commandName_dictionary_, - suiteName.ref.pointer, - commandName.ref.pointer, - commandDeclaration?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithCoder: - NSScriptCommandDescription? initWithCoder_(objc.NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// suiteName - objc.NSString get suiteName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suiteName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// commandName - objc.NSString get commandName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commandName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEventClassCode - int get appleEventClassCode { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_appleEventClassCode); - } - - /// appleEventCode - int get appleEventCode { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_appleEventCode); - } - - /// commandClassName - objc.NSString get commandClassName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_commandClassName); - return objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// returnType - objc.NSString? get returnType { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_returnType); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEventCodeForReturnType - int get appleEventCodeForReturnType { - return _objc_msgSend_dzloj4( - this.ref.pointer, _sel_appleEventCodeForReturnType); - } - - /// argumentNames - objc.NSArray get argumentNames { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_argumentNames); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// typeForArgumentWithName: - objc.NSString? typeForArgumentWithName_(objc.NSString argumentName) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_typeForArgumentWithName_, argumentName.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// appleEventCodeForArgumentWithName: - int appleEventCodeForArgumentWithName_(objc.NSString argumentName) { - return _objc_msgSend_t2sarz(this.ref.pointer, - _sel_appleEventCodeForArgumentWithName_, argumentName.ref.pointer); - } - - /// isOptionalArgumentWithName: - bool isOptionalArgumentWithName_(objc.NSString argumentName) { - return _objc_msgSend_l8lotg(this.ref.pointer, - _sel_isOptionalArgumentWithName_, argumentName.ref.pointer); - } - - /// createCommandInstance - NSScriptCommand createCommandInstance() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_createCommandInstance); - return NSScriptCommand.castFromPointer(_ret, retain: true, release: true); - } - - /// createCommandInstanceWithZone: - NSScriptCommand createCommandInstanceWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - this.ref.pointer, _sel_createCommandInstanceWithZone_, zone); - return NSScriptCommand.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSScriptCommandDescription new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptCommandDescription, _sel_new); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSScriptCommandDescription allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptCommandDescription, _sel_allocWithZone_, zone); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSScriptCommandDescription alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptCommandDescription, _sel_alloc); - return NSScriptCommandDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptCommandDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptCommandDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1(_class_NSScriptCommandDescription, - _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSScriptCommandDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptCommandDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptCommandDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptCommandDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommandDescription, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptCommandDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(objc.NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } -} - -late final _sel_supportsCommand_ = objc.registerName("supportsCommand:"); -late final _sel_selectorForCommand_ = objc.registerName("selectorForCommand:"); -final _objc_msgSend_1fdwx8i = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -late final _sel_typeForKey_ = objc.registerName("typeForKey:"); -late final _sel_classDescriptionForKey_ = - objc.registerName("classDescriptionForKey:"); -late final _sel_appleEventCodeForKey_ = - objc.registerName("appleEventCodeForKey:"); -late final _sel_keyWithAppleEventCode_ = - objc.registerName("keyWithAppleEventCode:"); -late final _sel_defaultSubcontainerAttributeKey = - objc.registerName("defaultSubcontainerAttributeKey"); -late final _sel_isLocationRequiredToCreateForKey_ = - objc.registerName("isLocationRequiredToCreateForKey:"); -late final _sel_hasPropertyForKey_ = objc.registerName("hasPropertyForKey:"); -late final _sel_hasOrderedToManyRelationshipForKey_ = - objc.registerName("hasOrderedToManyRelationshipForKey:"); -late final _sel_hasReadablePropertyForKey_ = - objc.registerName("hasReadablePropertyForKey:"); -late final _sel_hasWritablePropertyForKey_ = - objc.registerName("hasWritablePropertyForKey:"); -late final _sel_isReadOnlyKey_ = objc.registerName("isReadOnlyKey:"); - -/// NSScriptClassDescription -class NSScriptClassDescription extends NSClassDescription { - NSScriptClassDescription._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSScriptClassDescription] that points to the same underlying object as [other]. - NSScriptClassDescription.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSScriptClassDescription] that wraps the given raw object pointer. - NSScriptClassDescription.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSScriptClassDescription]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSScriptClassDescription); - } - - /// classDescriptionForClass: - static NSClassDescription? classDescriptionForClass_( - objc.ObjCObjectBase aClass) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptClassDescription, - _sel_classDescriptionForClass_, aClass.ref.pointer); - return _ret.address == 0 - ? null - : NSClassDescription.castFromPointer(_ret, retain: true, release: true); - } - - /// initWithSuiteName:className:dictionary: - NSScriptClassDescription? initWithSuiteName_className_dictionary_( - objc.NSString suiteName, - objc.NSString className, - objc.NSDictionary? classDeclaration) { - final _ret = _objc_msgSend_aud7dn( - this.ref.retainAndReturnPointer(), - _sel_initWithSuiteName_className_dictionary_, - suiteName.ref.pointer, - className.ref.pointer, - classDeclaration?.ref.pointer ?? ffi.nullptr); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// suiteName - objc.NSString? get suiteName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suiteName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// className - objc.NSString? get className { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_className); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// implementationClassName - objc.NSString? get implementationClassName { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_implementationClassName); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// superclassDescription - NSScriptClassDescription? get superclassDescription { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_superclassDescription); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// appleEventCode - int get appleEventCode { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_appleEventCode); - } - - /// matchesAppleEventCode: - bool matchesAppleEventCode_(int appleEventCode) { - return _objc_msgSend_1n8vqu1( - this.ref.pointer, _sel_matchesAppleEventCode_, appleEventCode); - } - - /// supportsCommand: - bool supportsCommand_(NSScriptCommandDescription commandDescription) { - return _objc_msgSend_l8lotg(this.ref.pointer, _sel_supportsCommand_, - commandDescription.ref.pointer); - } - - /// selectorForCommand: - ffi.Pointer selectorForCommand_( - NSScriptCommandDescription commandDescription) { - return _objc_msgSend_1fdwx8i(this.ref.pointer, _sel_selectorForCommand_, - commandDescription.ref.pointer); - } - - /// typeForKey: - objc.NSString? typeForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_typeForKey_, key.ref.pointer); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// classDescriptionForKey: - NSScriptClassDescription? classDescriptionForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_classDescriptionForKey_, key.ref.pointer); - return _ret.address == 0 - ? null - : NSScriptClassDescription.castFromPointer(_ret, - retain: true, release: true); - } - - /// appleEventCodeForKey: - int appleEventCodeForKey_(objc.NSString key) { - return _objc_msgSend_t2sarz( - this.ref.pointer, _sel_appleEventCodeForKey_, key.ref.pointer); - } - - /// keyWithAppleEventCode: - objc.NSString? keyWithAppleEventCode_(int appleEventCode) { - final _ret = _objc_msgSend_pxgym4( - this.ref.pointer, _sel_keyWithAppleEventCode_, appleEventCode); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// defaultSubcontainerAttributeKey - objc.NSString? get defaultSubcontainerAttributeKey { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_defaultSubcontainerAttributeKey); - return _ret.address == 0 - ? null - : objc.NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// isLocationRequiredToCreateForKey: - bool isLocationRequiredToCreateForKey_(objc.NSString toManyRelationshipKey) { - return _objc_msgSend_l8lotg( - this.ref.pointer, - _sel_isLocationRequiredToCreateForKey_, - toManyRelationshipKey.ref.pointer); - } - - /// hasPropertyForKey: - bool hasPropertyForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasPropertyForKey_, key.ref.pointer); - } - - /// hasOrderedToManyRelationshipForKey: - bool hasOrderedToManyRelationshipForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(this.ref.pointer, - _sel_hasOrderedToManyRelationshipForKey_, key.ref.pointer); - } - - /// hasReadablePropertyForKey: - bool hasReadablePropertyForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasReadablePropertyForKey_, key.ref.pointer); - } - - /// hasWritablePropertyForKey: - bool hasWritablePropertyForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasWritablePropertyForKey_, key.ref.pointer); - } - - /// isReadOnlyKey: - bool isReadOnlyKey_(objc.NSString key) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isReadOnlyKey_, key.ref.pointer); - } - - /// registerClassDescription:forClass: - static void registerClassDescription_forClass_( - NSClassDescription description, objc.ObjCObjectBase aClass) { - _objc_msgSend_1tjlcwl( - _class_NSScriptClassDescription, - _sel_registerClassDescription_forClass_, - description.ref.pointer, - aClass.ref.pointer); - } - - /// invalidateClassDescriptionCache - static void invalidateClassDescriptionCache() { - _objc_msgSend_ksby9f( - _class_NSScriptClassDescription, _sel_invalidateClassDescriptionCache); - } - - /// init - NSScriptClassDescription init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// new - static NSScriptClassDescription new1() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptClassDescription, _sel_new); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// allocWithZone: - static NSScriptClassDescription allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSScriptClassDescription, _sel_allocWithZone_, zone); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// alloc - static NSScriptClassDescription alloc() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSScriptClassDescription, _sel_alloc); - return NSScriptClassDescription.castFromPointer(_ret, - retain: false, release: true); - } - - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_NSScriptClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_NSScriptClassDescription, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_NSScriptClassDescription, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1( - _class_NSScriptClassDescription, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSScriptClassDescription, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_NSScriptClassDescription, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_NSScriptClassDescription, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptClassDescription, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSScriptClassDescription, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } -} - -late final _class_SwiftClass = objc.getClass("swift_module.SwiftClass"); -late final _sel_sayHello = objc.registerName("sayHello"); -late final _sel_someField = objc.registerName("someField"); -late final _sel_setSomeField_ = objc.registerName("setSomeField:"); - -/// SwiftClass -class SwiftClass extends objc.NSObject { - SwiftClass._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [SwiftClass] that points to the same underlying object as [other]. - SwiftClass.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); + /// Constructs a [SwiftClass] that points to the same underlying object as [other]. + SwiftClass.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); /// Constructs a [SwiftClass] that wraps the given raw object pointer. SwiftClass.castFromPointer(ffi.Pointer other, @@ -39001,135 +186,67 @@ class SwiftClass extends objc.NSObject { /// Returns whether [obj] is an instance of [SwiftClass]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_SwiftClass); } /// sayHello objc.NSString sayHello() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sayHello); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_sayHello); return objc.NSString.castFromPointer(_ret, retain: true, release: true); } /// someField int get someField { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_someField); + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_someField); } /// setSomeField: set someField(int value) { - return _objc_msgSend_ke7qz2(this.ref.pointer, _sel_setSomeField_, value); + return _objc_msgSend_4sp4xj(this.ref.pointer, _sel_setSomeField_, value); } /// init SwiftClass init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return SwiftClass.castFromPointer(_ret, retain: false, release: true); } /// new static SwiftClass new1() { - final _ret = _objc_msgSend_1unuoxw(_class_SwiftClass, _sel_new); + final _ret = _objc_msgSend_1x359cv(_class_SwiftClass, _sel_new); return SwiftClass.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static SwiftClass allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_SwiftClass, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_SwiftClass, _sel_allocWithZone_, zone); return SwiftClass.castFromPointer(_ret, retain: false, release: true); } /// alloc static SwiftClass alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_SwiftClass, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_SwiftClass, _sel_alloc); return SwiftClass.castFromPointer(_ret, retain: false, release: true); } - /// cancelPreviousPerformRequestsWithTarget:selector:object: - static void cancelPreviousPerformRequestsWithTarget_selector_object_( - objc.ObjCObjectBase aTarget, - ffi.Pointer aSelector, - objc.ObjCObjectBase? anArgument) { - _objc_msgSend_cqxsqq( - _class_SwiftClass, - _sel_cancelPreviousPerformRequestsWithTarget_selector_object_, - aTarget.ref.pointer, - aSelector, - anArgument?.ref.pointer ?? ffi.nullptr); - } - - /// cancelPreviousPerformRequestsWithTarget: - static void cancelPreviousPerformRequestsWithTarget_( - objc.ObjCObjectBase aTarget) { - _objc_msgSend_ukcdfq(_class_SwiftClass, - _sel_cancelPreviousPerformRequestsWithTarget_, aTarget.ref.pointer); - } - - /// accessInstanceVariablesDirectly - static bool getAccessInstanceVariablesDirectly() { - return _objc_msgSend_olxnu1( - _class_SwiftClass, _sel_accessInstanceVariablesDirectly); - } - - /// useStoredAccessor - static bool useStoredAccessor() { - return _objc_msgSend_olxnu1(_class_SwiftClass, _sel_useStoredAccessor); - } - - /// keyPathsForValuesAffectingValueForKey: - static objc.NSSet keyPathsForValuesAffectingValueForKey_(objc.NSString key) { - final _ret = _objc_msgSend_juohf7(_class_SwiftClass, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return objc.NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(objc.NSString key) { - return _objc_msgSend_l8lotg(_class_SwiftClass, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// setKeys:triggerChangeNotificationsForDependentKey: - static void setKeys_triggerChangeNotificationsForDependentKey_( - objc.NSArray keys, objc.NSString dependentKey) { - _objc_msgSend_1tjlcwl( - _class_SwiftClass, - _sel_setKeys_triggerChangeNotificationsForDependentKey_, - keys.ref.pointer, - dependentKey.ref.pointer); - } - - /// classFallbacksForKeyedArchiver - static objc.NSArray classFallbacksForKeyedArchiver() { - final _ret = _objc_msgSend_1unuoxw( - _class_SwiftClass, _sel_classFallbacksForKeyedArchiver); - return objc.NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// classForKeyedUnarchiver - static objc.ObjCObjectBase classForKeyedUnarchiver() { - final _ret = - _objc_msgSend_1unuoxw(_class_SwiftClass, _sel_classForKeyedUnarchiver); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - /// self SwiftClass self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return SwiftClass.castFromPointer(_ret, retain: true, release: true); } /// retain SwiftClass retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return SwiftClass.castFromPointer(_ret, retain: true, release: true); } /// autorelease SwiftClass autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return SwiftClass.castFromPointer(_ret, retain: true, release: true); } } diff --git a/pkgs/ffigen/example/swift/swift_api_bindings.dart.m b/pkgs/ffigen/example/swift/swift_api_bindings.dart.m deleted file mode 100644 index 450d757ee..000000000 --- a/pkgs/ffigen/example/swift/swift_api_bindings.dart.m +++ /dev/null @@ -1,105 +0,0 @@ -#include -#import "third_party/swift_api.h" - -#if !__has_feature(objc_arc) -#error "This file must be compiled with ARC enabled" -#endif - -id objc_retain(id); -id objc_retainBlock(id); - -typedef void (^_ListenerTrampoline)(); -_ListenerTrampoline _wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETURNS_RETAINED { - return ^void() { - objc_retainBlock(block); - block(); - }; -} - -typedef void (^_ListenerTrampoline1)(id arg0, id arg1, BOOL * arg2); -_ListenerTrampoline1 _wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { - return ^void(id arg0, id arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), objc_retain(arg1), arg2); - }; -} - -typedef void (^_ListenerTrampoline2)(void * arg0, id arg1); -_ListenerTrampoline2 _wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { - return ^void(void * arg0, id arg1) { - objc_retainBlock(block); - block(arg0, objc_retain(arg1)); - }; -} - -typedef void (^_ListenerTrampoline3)(id arg0, struct _NSRange arg1, BOOL * arg2); -_ListenerTrampoline3 _wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { - return ^void(id arg0, struct _NSRange arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, arg2); - }; -} - -typedef void (^_ListenerTrampoline4)(id arg0, BOOL arg1, BOOL * arg2); -_ListenerTrampoline4 _wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { - return ^void(id arg0, BOOL arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, arg2); - }; -} - -typedef void (^_ListenerTrampoline5)(id arg0); -_ListenerTrampoline5 _wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { - return ^void(id arg0) { - objc_retainBlock(block); - block(objc_retain(arg0)); - }; -} - -typedef void (^_ListenerTrampoline6)(id arg0, id arg1); -_ListenerTrampoline6 _wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { - return ^void(id arg0, id arg1) { - objc_retainBlock(block); - block(objc_retain(arg0), objc_retain(arg1)); - }; -} - -typedef void (^_ListenerTrampoline7)(void * arg0); -_ListenerTrampoline7 _wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { - return ^void(void * arg0) { - objc_retainBlock(block); - block(arg0); - }; -} - -typedef void (^_ListenerTrampoline8)(BOOL arg0); -_ListenerTrampoline8 _wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { - return ^void(BOOL arg0) { - objc_retainBlock(block); - block(arg0); - }; -} - -typedef void (^_ListenerTrampoline9)(id arg0, NSMatchingFlags arg1, BOOL * arg2); -_ListenerTrampoline9 _wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { - return ^void(id arg0, NSMatchingFlags arg1, BOOL * arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, arg2); - }; -} - -typedef void (^_ListenerTrampoline10)(id arg0, id arg1, id arg2); -_ListenerTrampoline10 _wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { - return ^void(id arg0, id arg1, id arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), objc_retain(arg1), objc_retain(arg2)); - }; -} - -typedef void (^_ListenerTrampoline11)(id arg0, BOOL arg1, id arg2); -_ListenerTrampoline11 _wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { - return ^void(id arg0, BOOL arg1, id arg2) { - objc_retainBlock(block); - block(objc_retain(arg0), arg1, objc_retain(arg2)); - }; -} diff --git a/pkgs/ffigen/example/swift/third_party/swift_api.h b/pkgs/ffigen/example/swift/third_party/swift_api.h index 2c6185a0c..41849f321 100644 --- a/pkgs/ffigen/example/swift/third_party/swift_api.h +++ b/pkgs/ffigen/example/swift/third_party/swift_api.h @@ -1,4 +1,4 @@ -// Generated by Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1) +// Generated by Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) #ifndef SWIFT_MODULE_SWIFT_H #define SWIFT_MODULE_SWIFT_H #pragma clang diagnostic push @@ -40,6 +40,8 @@ #include #endif #if defined(__cplusplus) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module" #if defined(__arm64e__) && __has_include() # include #else @@ -53,6 +55,7 @@ # endif #pragma clang diagnostic pop #endif +#pragma clang diagnostic pop #endif #if !defined(SWIFT_TYPEDEFS) @@ -287,6 +290,7 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); #pragma clang diagnostic ignored "-Wunknown-pragmas" #pragma clang diagnostic ignored "-Wnullability" #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" +#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" #if __has_attribute(external_source_symbol) # pragma push_macro("any") diff --git a/pkgs/ffigen/ffigen.schema.json b/pkgs/ffigen/ffigen.schema.json index 8cb104906..cdbef3b2c 100644 --- a/pkgs/ffigen/ffigen.schema.json +++ b/pkgs/ffigen/ffigen.schema.json @@ -373,6 +373,27 @@ } } }, + "objc-categories": { + "type": "object", + "additionalProperties": false, + "properties": { + "include": { + "$ref": "#/$defs/fullMatchOrRegexpList" + }, + "exclude": { + "$ref": "#/$defs/fullMatchOrRegexpList" + }, + "rename": { + "$ref": "#/$defs/rename" + }, + "member-rename": { + "$ref": "#/$defs/memberRename" + }, + "member-filter": { + "$ref": "#/$defs/memberFilter" + } + } + }, "import": { "type": "object", "additionalProperties": false, @@ -406,6 +427,15 @@ "include-unused-typedefs": { "type": "boolean" }, + "include-transitive-objc-interfaces": { + "type": "boolean" + }, + "include-transitive-objc-protocols": { + "type": "boolean" + }, + "include-transitive-objc-categories": { + "type": "boolean" + }, "generate-for-package-objective-c": { "type": "boolean" }, diff --git a/pkgs/ffigen/lib/ffigen.dart b/pkgs/ffigen/lib/ffigen.dart index 351ffb857..aa1f364e5 100644 --- a/pkgs/ffigen/lib/ffigen.dart +++ b/pkgs/ffigen/lib/ffigen.dart @@ -8,5 +8,12 @@ /// https://pub.dev/packages/ffigen for details. library ffigen; -export 'src/config_provider.dart' show Config, YamlConfig; +export 'src/config_provider.dart' + show + Config, + DeclarationFilters, + ExternalVersions, + Language, + Versions, + YamlConfig; export 'src/ffigen.dart' show FfiGen; diff --git a/pkgs/ffigen/lib/src/code_generator.dart b/pkgs/ffigen/lib/src/code_generator.dart index 139d8cedf..0197d5c04 100644 --- a/pkgs/ffigen/lib/src/code_generator.dart +++ b/pkgs/ffigen/lib/src/code_generator.dart @@ -18,6 +18,7 @@ export 'code_generator/library.dart'; export 'code_generator/native_type.dart'; export 'code_generator/objc_block.dart'; export 'code_generator/objc_built_in_functions.dart'; +export 'code_generator/objc_category.dart'; export 'code_generator/objc_interface.dart'; export 'code_generator/objc_methods.dart'; export 'code_generator/objc_nullable.dart'; diff --git a/pkgs/ffigen/lib/src/code_generator/binding.dart b/pkgs/ffigen/lib/src/code_generator/binding.dart index 18e921d2d..7067bdf86 100644 --- a/pkgs/ffigen/lib/src/code_generator/binding.dart +++ b/pkgs/ffigen/lib/src/code_generator/binding.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../config_provider/config_types.dart' show Declaration; import '../visitor/ast.dart'; import 'binding_string.dart'; @@ -10,11 +11,13 @@ import 'writer.dart'; /// Base class for all Bindings. /// /// Do not extend directly, use [LookUpBinding] or [NoLookUpBinding]. -abstract class Binding extends AstNode { +abstract class Binding extends AstNode implements Declaration { /// Holds the Unified Symbol Resolution string obtained from libclang. + @override final String usr; /// The name as it was in C. + @override final String originalName; /// Binding name to generate, may get changed to resolve name conflicts. @@ -23,6 +26,11 @@ abstract class Binding extends AstNode { final String? dartDoc; final bool isInternal; + /// Whether these bindings should be generated. + /// + /// Set by MarkBindingsVisitation. + bool generateBindings = true; + Binding({ required this.usr, required this.originalName, @@ -44,11 +52,11 @@ abstract class Binding extends AstNode { /// of a ObjCInterface. void sort() {} - /// Whether these bindings should be generated. - bool get generateBindings => true; - @override void visit(Visitation visitation) => visitation.visitBinding(this); + + /// Returns whether this type is imported from package:objective_c. + bool get isObjCImport => false; } /// Base class for bindings which look up symbols in dynamic library. @@ -83,7 +91,4 @@ abstract class NoLookUpBinding extends Binding { @override void visit(Visitation visitation) => visitation.visitNoLookUpBinding(this); - - /// Returns whether this type is imported from package:objective_c. - bool get isObjCImport => false; } diff --git a/pkgs/ffigen/lib/src/code_generator/binding_string.dart b/pkgs/ffigen/lib/src/code_generator/binding_string.dart index 60d3820c9..8eacb05c1 100644 --- a/pkgs/ffigen/lib/src/code_generator/binding_string.dart +++ b/pkgs/ffigen/lib/src/code_generator/binding_string.dart @@ -25,5 +25,6 @@ enum BindingStringType { typeDef, objcInterface, objcProtocol, + objcCategory, objcBlock, } diff --git a/pkgs/ffigen/lib/src/code_generator/compound.dart b/pkgs/ffigen/lib/src/code_generator/compound.dart index 5e42fa102..5b2dfd8d7 100644 --- a/pkgs/ffigen/lib/src/code_generator/compound.dart +++ b/pkgs/ffigen/lib/src/code_generator/compound.dart @@ -113,9 +113,6 @@ abstract class Compound extends BindingType { BindingString toBindingString(Writer w) { final bindingType = isStruct ? BindingStringType.struct : BindingStringType.union; - if (isObjCImport) { - return BindingString(type: bindingType, string: ''); - } final s = StringBuffer(); final enclosingClassName = name; @@ -197,6 +194,9 @@ abstract class Compound extends BindingType { super.visitChildren(visitor); visitor.visitAll(members); } + + @override + void visit(Visitation visitation) => visitation.visitCompound(this); } class CompoundMember extends AstNode { diff --git a/pkgs/ffigen/lib/src/code_generator/constant.dart b/pkgs/ffigen/lib/src/code_generator/constant.dart index 4ad8a9a18..38bdc9f24 100644 --- a/pkgs/ffigen/lib/src/code_generator/constant.dart +++ b/pkgs/ffigen/lib/src/code_generator/constant.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../visitor/ast.dart'; + import 'binding.dart'; import 'binding_string.dart'; import 'utils.dart'; @@ -50,4 +52,38 @@ class Constant extends NoLookUpBinding { return BindingString( type: BindingStringType.constant, string: s.toString()); } + + @override + void visit(Visitation visitation) => visitation.visitConstant(this); +} + +/// A [Constant] defined by an unnamed enum. +class UnnamedEnumConstant extends Constant { + UnnamedEnumConstant({ + super.usr, + super.originalName, + required super.name, + super.dartDoc, + required super.rawType, + required super.rawValue, + }); + + @override + void visit(Visitation visitation) => + visitation.visitUnnamedEnumConstant(this); +} + +/// A [Constant] defined by a macro. +class MacroConstant extends Constant { + MacroConstant({ + super.usr, + super.originalName, + required super.name, + super.dartDoc, + required super.rawType, + required super.rawValue, + }); + + @override + void visit(Visitation visitation) => visitation.visitMacroConstant(this); } diff --git a/pkgs/ffigen/lib/src/code_generator/enum_class.dart b/pkgs/ffigen/lib/src/code_generator/enum_class.dart index ee23fe2fc..586113978 100644 --- a/pkgs/ffigen/lib/src/code_generator/enum_class.dart +++ b/pkgs/ffigen/lib/src/code_generator/enum_class.dart @@ -238,9 +238,6 @@ class EnumClass extends BindingType { @override BindingString toBindingString(Writer w) { final s = StringBuffer(); - if (isObjCImport) { - return const BindingString(type: BindingStringType.enum_, string: ''); - } scanForDuplicates(); writeDartDoc(s); @@ -272,7 +269,7 @@ class EnumClass extends BindingType { @override String getCType(Writer w) { - w.usedEnumCType = true; + w.usedEnumCTypes.add(this); return nativeType.getCType(w); } @@ -325,6 +322,9 @@ class EnumClass extends BindingType { super.visitChildren(visitor); visitor.visit(nativeType); } + + @override + void visit(Visitation visitation) => visitation.visitEnumClass(this); } /// Represents a single value in an enum. diff --git a/pkgs/ffigen/lib/src/code_generator/func.dart b/pkgs/ffigen/lib/src/code_generator/func.dart index 9b4df9f94..eeedbd136 100644 --- a/pkgs/ffigen/lib/src/code_generator/func.dart +++ b/pkgs/ffigen/lib/src/code_generator/func.dart @@ -222,6 +222,9 @@ late final $funcVarName = $funcPointerName.asFunction<$dartType>($isLeafString); visitor.visit(functionType); visitor.visit(_exposedFunctionTypealias); } + + @override + void visit(Visitation visitation) => visitation.visitFunc(this); } /// Represents a Parameter, used in [Func], [Typealias], [ObjCMethod], and @@ -231,6 +234,7 @@ class Parameter extends AstNode { String name; Type type; final bool objCConsumed; + bool isCovariant = false; Parameter({ String? originalName, diff --git a/pkgs/ffigen/lib/src/code_generator/func_type.dart b/pkgs/ffigen/lib/src/code_generator/func_type.dart index d3a3c2bd0..f0c6d9b9e 100644 --- a/pkgs/ffigen/lib/src/code_generator/func_type.dart +++ b/pkgs/ffigen/lib/src/code_generator/func_type.dart @@ -119,6 +119,21 @@ class FunctionType extends Type { visitor.visitAll(parameters); visitor.visitAll(varArgParameters); } + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + if (other is FunctionType) { + return Type.isSupertypeOfVariance( + covariantLeft: [returnType], + covariantRight: [other.returnType], + contravariantLeft: dartTypeParameters.map((p) => p.type).toList(), + contravariantRight: + other.dartTypeParameters.map((p) => p.type).toList(), + ); + } + return false; + } } /// Represents a NativeFunction. @@ -165,4 +180,11 @@ class NativeFunc extends Type { super.visitChildren(visitor); visitor.visit(_type); } + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + if (other is NativeFunc) return type.isSupertypeOf(other.type); + return false; + } } diff --git a/pkgs/ffigen/lib/src/code_generator/global.dart b/pkgs/ffigen/lib/src/code_generator/global.dart index cb8f71e44..5ffef814d 100644 --- a/pkgs/ffigen/lib/src/code_generator/global.dart +++ b/pkgs/ffigen/lib/src/code_generator/global.dart @@ -145,4 +145,7 @@ class Global extends LookUpBinding { super.visitChildren(visitor); visitor.visit(type); } + + @override + void visit(Visitation visitation) => visitation.visitGlobal(this); } diff --git a/pkgs/ffigen/lib/src/code_generator/imports.dart b/pkgs/ffigen/lib/src/code_generator/imports.dart index 81107e38b..046b2c5fe 100644 --- a/pkgs/ffigen/lib/src/code_generator/imports.dart +++ b/pkgs/ffigen/lib/src/code_generator/imports.dart @@ -45,8 +45,17 @@ class ImportedType extends Type { final String nativeType; final String? defaultValue; - ImportedType(this.libraryImport, this.cType, this.dartType, this.nativeType, - [this.defaultValue]); + /// Whether the [dartType] is an import from the [libraryImport]. + final bool importedDartType; + + ImportedType( + this.libraryImport, + this.cType, + this.dartType, + this.nativeType, { + this.defaultValue, + this.importedDartType = false, + }); @override String getCType(Writer w) { @@ -55,7 +64,14 @@ class ImportedType extends Type { } @override - String getFfiDartType(Writer w) => cType == dartType ? getCType(w) : dartType; + String getFfiDartType(Writer w) { + if (importedDartType) { + w.markImportUsed(libraryImport); + return '${libraryImport.prefix}.$dartType'; + } else { + return cType == dartType ? getCType(w) : dartType; + } + } @override String getNativeType({String varName = ''}) => '$nativeType $varName'; @@ -107,34 +123,46 @@ final self = LibraryImport('self', ''); final voidType = ImportedType(ffiImport, 'Void', 'void', 'void'); -final unsignedCharType = - ImportedType(ffiImport, 'UnsignedChar', 'int', 'unsigned char', '0'); +final unsignedCharType = ImportedType( + ffiImport, 'UnsignedChar', 'int', 'unsigned char', + defaultValue: '0'); final signedCharType = - ImportedType(ffiImport, 'SignedChar', 'int', 'char', '0'); -final charType = ImportedType(ffiImport, 'Char', 'int', 'char', '0'); -final unsignedShortType = - ImportedType(ffiImport, 'UnsignedShort', 'int', 'unsigned short', '0'); -final shortType = ImportedType(ffiImport, 'Short', 'int', 'short', '0'); -final unsignedIntType = - ImportedType(ffiImport, 'UnsignedInt', 'int', 'unsigned', '0'); -final intType = ImportedType(ffiImport, 'Int', 'int', 'int', '0'); -final unsignedLongType = - ImportedType(ffiImport, 'UnsignedLong', 'int', 'unsigned long', '0'); -final longType = ImportedType(ffiImport, 'Long', 'int', 'long', '0'); + ImportedType(ffiImport, 'SignedChar', 'int', 'char', defaultValue: '0'); +final charType = + ImportedType(ffiImport, 'Char', 'int', 'char', defaultValue: '0'); +final unsignedShortType = ImportedType( + ffiImport, 'UnsignedShort', 'int', 'unsigned short', + defaultValue: '0'); +final shortType = + ImportedType(ffiImport, 'Short', 'int', 'short', defaultValue: '0'); +final unsignedIntType = ImportedType( + ffiImport, 'UnsignedInt', 'int', 'unsigned', + defaultValue: '0'); +final intType = ImportedType(ffiImport, 'Int', 'int', 'int', defaultValue: '0'); +final unsignedLongType = ImportedType( + ffiImport, 'UnsignedLong', 'int', 'unsigned long', + defaultValue: '0'); +final longType = + ImportedType(ffiImport, 'Long', 'int', 'long', defaultValue: '0'); final unsignedLongLongType = ImportedType( - ffiImport, 'UnsignedLongLong', 'int', 'unsigned long long', '0'); + ffiImport, 'UnsignedLongLong', 'int', 'unsigned long long', + defaultValue: '0'); final longLongType = - ImportedType(ffiImport, 'LongLong', 'int', 'long long', '0'); + ImportedType(ffiImport, 'LongLong', 'int', 'long long', defaultValue: '0'); -final floatType = ImportedType(ffiImport, 'Float', 'double', 'float', '0.0'); -final doubleType = ImportedType(ffiImport, 'Double', 'double', 'double', '0.0'); +final floatType = + ImportedType(ffiImport, 'Float', 'double', 'float', defaultValue: '0.0'); +final doubleType = + ImportedType(ffiImport, 'Double', 'double', 'double', defaultValue: '0.0'); -final sizeType = ImportedType(ffiImport, 'Size', 'int', 'size_t', '0'); -final wCharType = ImportedType(ffiImport, 'WChar', 'int', 'wchar_t', '0'); +final sizeType = + ImportedType(ffiImport, 'Size', 'int', 'size_t', defaultValue: '0'); +final wCharType = + ImportedType(ffiImport, 'WChar', 'int', 'wchar_t', defaultValue: '0'); final objCObjectType = ImportedType(objcPkgImport, 'ObjCObject', 'ObjCObject', 'void'); final objCSelType = ImportedType( - objcPkgImport, 'ObjCSelector', 'ObjCSelector', 'objc_selector'); + objcPkgImport, 'ObjCSelector', 'ObjCSelector', 'struct objc_selector'); final objCBlockType = ImportedType(objcPkgImport, 'ObjCBlockImpl', 'ObjCBlockImpl', 'id'); diff --git a/pkgs/ffigen/lib/src/code_generator/library.dart b/pkgs/ffigen/lib/src/code_generator/library.dart index 9f70a6055..a5909c2f9 100644 --- a/pkgs/ffigen/lib/src/code_generator/library.dart +++ b/pkgs/ffigen/lib/src/code_generator/library.dart @@ -4,84 +4,56 @@ import 'dart:io'; -import 'package:collection/collection.dart'; -import 'package:logging/logging.dart'; +import 'package:dart_style/dart_style.dart'; import 'package:yaml_edit/yaml_edit.dart'; import '../code_generator.dart'; +import '../config_provider/config.dart' show Config; import '../config_provider/config_types.dart'; -import '../visitor/ast.dart'; -import '../visitor/copy_methods_from_super_type.dart'; -import '../visitor/fill_method_dependencies.dart'; -import '../visitor/fix_overridden_methods.dart'; -import '../visitor/list_bindings.dart'; -import 'utils.dart'; import 'writer.dart'; -final _logger = Logger('ffigen.code_generator.library'); - /// Container for all Bindings. class Library { /// List of bindings in this library. - late List bindings; + final List bindings; - final ObjCBuiltInFunctions? objCBuiltInFunctions; + final Writer writer; - late Writer _writer; - Writer get writer => _writer; + Library._(this.bindings, this.writer); - Library({ + static Library fromConfig({ + required Config config, + required List bindings, + }) => + Library( + name: config.wrapperName, + description: config.wrapperDocComment, + bindings: bindings, + header: config.preamble, + generateForPackageObjectiveC: config.generateForPackageObjectiveC, + libraryImports: config.libraryImports.values.toList(), + silenceEnumWarning: config.silenceEnumWarning, + nativeEntryPoints: + config.entryPoints.map((uri) => uri.toFilePath()).toList(), + ); + + factory Library({ required String name, String? description, required List bindings, String? header, - bool sort = false, bool generateForPackageObjectiveC = false, - PackingValue? Function(Declaration)? packingOverride, List? libraryImports, bool silenceEnumWarning = false, List nativeEntryPoints = const [], - this.objCBuiltInFunctions, }) { - _findBindings(bindings, sort, [ - CopyMethodsFromSuperTypesVisitation.new, - FixOverriddenMethodsVisitation.new, - FillMethodDependenciesVisitation.new, - ]); - - final codeGenBindings = - this.bindings.where((b) => b.generateBindings).toList(); - - /// Handle any declaration-declaration name conflicts and emit warnings. - final declConflictHandler = UniqueNamer({}); - for (final b in codeGenBindings) { - _warnIfPrivateDeclaration(b); - _resolveIfNameConflicts(declConflictHandler, b); - } - - // Override pack values according to config. We do this after declaration - // conflicts have been handled so that users can target the generated names. - if (packingOverride != null) { - for (final b in this.bindings) { - if (b is Struct) { - final pack = packingOverride(Declaration( - usr: b.usr, - originalName: b.originalName, - )); - if (pack != null) { - b.pack = pack.value; - } - } - } - } - // Seperate bindings which require lookup. final lookupBindings = []; final nativeBindings = []; FfiNativeConfig? nativeConfig; - for (final binding in codeGenBindings.whereType()) { + for (final binding in bindings.whereType()) { final nativeConfigForBinding = switch (binding) { Func() => binding.ffiNativeConfig, Global() => binding.nativeConfig, @@ -95,10 +67,9 @@ class Library { nativeConfigForBinding == null || !nativeConfigForBinding.enabled; (usesLookup ? lookupBindings : nativeBindings).add(binding); } - final noLookUpBindings = - codeGenBindings.whereType().toList(); + final noLookUpBindings = bindings.whereType().toList(); - _writer = Writer( + final writer = Writer( lookUpBindings: lookupBindings, ffiNativeBindings: nativeBindings, nativeAssetId: nativeConfig?.assetId, @@ -111,47 +82,8 @@ class Library { silenceEnumWarning: silenceEnumWarning, nativeEntryPoints: nativeEntryPoints, ); - } - - void _findBindings(List roots, bool sort, - List visitationBuidlers) { - for (final builder in visitationBuidlers) { - Visitor(builder()).visitAll(roots); - } - final visitation = ListBindingsVisitation(); - Visitor(visitation).visitAll(roots); - bindings = visitation.bindings; - - /// Sort bindings. - if (sort) { - bindings.sortBy((b) => b.name); - for (final b in bindings) { - b.sort(); - } - } - } - - /// Logs a warning if generated declaration will be private. - void _warnIfPrivateDeclaration(Binding b) { - if (b.name.startsWith('_') && !b.isInternal) { - _logger.warning("Generated declaration '${b.name}' starts with '_' " - 'and therefore will be private.'); - } - } - - /// Resolves name conflict(if any) and logs a warning. - void _resolveIfNameConflicts(UniqueNamer namer, Binding b) { - // Print warning if name was conflicting and has been changed. - if (namer.isUsed(b.name)) { - final oldName = b.name; - b.name = namer.makeUnique(b.name); - - _logger.warning("Resolved name conflict: Declaration '$oldName' " - "and has been renamed to '${b.name}'."); - } else { - namer.markUsed(b.name); - } + return Library._(bindings, writer); } /// Generates [file] by generating C bindings. @@ -160,10 +92,13 @@ class Library { /// generated file. void generateFile(File file, {bool format = true}) { if (!file.existsSync()) file.createSync(recursive: true); - file.writeAsStringSync(generate()); + var bindings = generate(); if (format) { - _dartFormat(file.path); + final formatter = + DartFormatter(languageVersion: DartFormatter.latestLanguageVersion); + bindings = formatter.format(bindings); } + file.writeAsStringSync(bindings); } /// Generates [file] with the Objective C code needed for the bindings, if @@ -171,9 +106,9 @@ class Library { /// /// Returns whether bindings were generated. bool generateObjCFile(File file) { - final bindings = writer.generateObjC(file.path); + final objCString = writer.generateObjC(file.path); - if (bindings == null) { + if (objCString == null) { // No ObjC code needed. If there's already a file (eg from an earlier // run), delete it so it's not accidentally included in the build. if (file.existsSync()) file.deleteSync(); @@ -181,7 +116,7 @@ class Library { } if (!file.existsSync()) file.createSync(recursive: true); - file.writeAsStringSync(bindings); + file.writeAsStringSync(objCString); return true; } @@ -198,26 +133,13 @@ class Library { file.writeAsStringSync(yamlString); } - /// Formats a file using the Dart formatter. - void _dartFormat(String path) { - final result = Process.runSync(findDart(), ['format', path], - workingDirectory: Directory.current.absolute.path, - runInShell: Platform.isWindows); - if (result.stderr.toString().isNotEmpty) { - _logger.severe(result.stderr); - throw FormatException('Unable to format generated file: $path.'); - } - } - /// Generates the bindings. - String generate() { - return writer.generate(); - } + String generate() => writer.generate(); @override bool operator ==(Object other) => other is Library && other.generate() == generate(); @override - int get hashCode => bindings.hashCode; + int get hashCode => generate().hashCode; } diff --git a/pkgs/ffigen/lib/src/code_generator/objc_block.dart b/pkgs/ffigen/lib/src/code_generator/objc_block.dart index 540584ebc..d22958ce5 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_block.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_block.dart @@ -322,6 +322,7 @@ ref.pointer.ref.invoke.cast<$natTrampFnType>().asFunction<$trampFuncFfiDartType> s.write(''' typedef $blockTypedef; +__attribute__((visibility("default"))) __attribute__((used)) $blockName $fnName($blockName block) NS_RETURNS_RETAINED { return ^void($argStr) { ${generateRetain('block')}; @@ -389,4 +390,18 @@ $blockName $fnName($blockName block) NS_RETURNS_RETAINED { visitor.visitAll(params); visitor.visit(_wrapListenerBlock); } + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + if (other is ObjCBlock) { + return Type.isSupertypeOfVariance( + covariantLeft: [returnType], + covariantRight: [other.returnType], + contravariantLeft: params.map((p) => p.type).toList(), + contravariantRight: other.params.map((p) => p.type).toList(), + ); + } + return false; + } } diff --git a/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart b/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart index 155332fb5..3f27f316f 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_built_in_functions.dart @@ -76,6 +76,7 @@ class ObjCBuiltInFunctions { 'NSNotification', 'NSNumber', 'NSObject', + 'NSOrderedCollectionDifference', 'NSOrderedSet', 'NSOutputStream', 'NSProxy', @@ -142,6 +143,8 @@ class ObjCBuiltInFunctions { // for float return types we need objc_msgSend_fpret. final _msgSendFuncs = {}; ObjCMsgSendFunc getMsgSendFunc(Type returnType, List params) { + params = _methodSigParams(params); + returnType = _methodSigType(returnType); final id = _methodSigId(returnType, params); return _msgSendFuncs[id] ??= ObjCMsgSendFunc( '_objc_msgSend_${fnvHash32(id).toRadixString(36)}', @@ -160,19 +163,50 @@ class ObjCBuiltInFunctions { String _methodSigId(Type returnType, List params) { final paramIds = []; - for (final param in params) { - final retainFunc = param.type.generateRetain(''); - + for (final p in params) { // The trampoline ID is based on the getNativeType of the param. Objects // and blocks both have `id` as their native type, but need separate // trampolines since they have different retain functions. So add the - // retainFunc (if any) to all the param IDs. - paramIds.add('${param.getNativeType()}-${retainFunc ?? ''}'); + // retain function (if any) to all the param IDs. + paramIds.add(p.getNativeType(varName: p.type.generateRetain('') ?? '')); } - final rt = '${returnType.getNativeType()}-${returnType.generateRetain('')}'; + final rt = + returnType.getNativeType(varName: returnType.generateRetain('') ?? ''); return '$rt,${paramIds.join(',')}'; } + Type _methodSigType(Type t) { + if (t is FunctionType) { + return FunctionType( + returnType: _methodSigType(t.returnType), + parameters: _methodSigParams(t.parameters), + varArgParameters: _methodSigParams(t.varArgParameters), + ); + } else if (t is ObjCBlock) { + return ObjCBlockPointer(); + } else if (t is ObjCInterface) { + return ObjCObjectPointer(); + } else if (t is ConstantArray) { + return ConstantArray( + t.length, + _methodSigType(t.child), + useArrayType: t.useArrayType, + ); + } else if (t is PointerType) { + return PointerType(_methodSigType(t.child)); + } else if (t is ObjCNullable) { + return _methodSigType(t.child); + } else if (t is Typealias) { + return _methodSigType(t.type); + } + return t; + } + + List _methodSigParams(List params) => params + .map((p) => + Parameter(type: _methodSigType(p.type), objCConsumed: p.objCConsumed)) + .toList(); + final _blockTrampolines = {}; ObjCListenerBlockTrampoline? getListenerBlockTrampoline(ObjCBlock block) { final id = _methodSigId(block.returnType, block.params); diff --git a/pkgs/ffigen/lib/src/code_generator/objc_category.dart b/pkgs/ffigen/lib/src/code_generator/objc_category.dart new file mode 100644 index 000000000..7d3268f80 --- /dev/null +++ b/pkgs/ffigen/lib/src/code_generator/objc_category.dart @@ -0,0 +1,72 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../code_generator.dart'; +import '../visitor/ast.dart'; + +import 'binding_string.dart'; +import 'utils.dart'; +import 'writer.dart'; + +class ObjCCategory extends NoLookUpBinding with ObjCMethods { + final ObjCInterface parent; + final ObjCInternalGlobal classObject; + + final protocols = []; + + ObjCCategory({ + super.usr, + required String super.originalName, + String? name, + required this.parent, + super.dartDoc, + required this.builtInFunctions, + }) : classObject = parent.classObject, + super(name: name ?? originalName); + + void addProtocol(ObjCProtocol? proto) { + if (proto != null) protocols.add(proto); + } + + bool shouldCopyMethodToInterface(ObjCMethod method) { + if (originalName.isEmpty) return true; + return method.returnsInstanceType && !parent.isObjCImport; + } + + @override + final ObjCBuiltInFunctions builtInFunctions; + + @override + void sort() => sortMethods(); + + @override + BindingString toBindingString(Writer w) { + final s = StringBuffer(); + s.write('\n'); + s.write(makeDartDoc(dartDoc ?? originalName)); + s.write(''' +extension $name on ${parent.getDartType(w)} { +${generateMethodBindings(w, parent)} +} + +'''); + return BindingString( + type: BindingStringType.objcCategory, string: s.toString()); + } + + @override + String toString() => originalName; + + @override + void visit(Visitation visitation) => visitation.visitObjCCategory(this); + + @override + void visitChildren(Visitor visitor) { + super.visitChildren(visitor); + visitor.visit(parent); + visitor.visit(classObject); + visitor.visitAll(protocols); + visitMethods(visitor); + } +} diff --git a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart index 87c2f134c..6d9e03ed2 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart @@ -14,14 +14,19 @@ class ObjCInterface extends BindingType with ObjCMethods { bool filled = false; final String lookupName; - late final ObjCInternalGlobal _classObject; + late final ObjCInternalGlobal classObject; late final ObjCInternalGlobal _isKindOfClass; late final ObjCMsgSendFunc _isKindOfClassMsgSend; final protocols = []; + final categories = []; + final subtypes = []; @override final ObjCBuiltInFunctions builtInFunctions; + // Filled by ListBindingsVisitation. + bool generateAsStub = false; + ObjCInterface({ super.usr, required String super.originalName, @@ -31,7 +36,7 @@ class ObjCInterface extends BindingType with ObjCMethods { required this.builtInFunctions, }) : lookupName = lookupName ?? originalName, super(name: name ?? originalName) { - _classObject = ObjCInternalGlobal('_class_$originalName', + classObject = ObjCInternalGlobal('_class_$originalName', (Writer w) => '${ObjCBuiltInFunctions.getClass.gen(w)}("$lookupName")'); _isKindOfClass = builtInFunctions.getSelObject('isKindOfClass:'); _isKindOfClassMsgSend = builtInFunctions.getMsgSendFunc(BooleanType(), [ @@ -43,7 +48,9 @@ class ObjCInterface extends BindingType with ObjCMethods { ]); } - void addProtocol(ObjCProtocol proto) => protocols.add(proto); + void addProtocol(ObjCProtocol? proto) { + if (proto != null) protocols.add(proto); + } @override bool get isObjCImport => builtInFunctions.isBuiltInInterface(originalName); @@ -53,32 +60,23 @@ class ObjCInterface extends BindingType with ObjCMethods { @override BindingString toBindingString(Writer w) { - if (isObjCImport) { - return const BindingString( - type: BindingStringType.objcInterface, string: ''); - } - - String paramsToString(List params) { - final stringParams = [ - for (final p in params) - '${_getConvertedType(p.type, w, name)} ${p.name}', - ]; - return '(${stringParams.join(", ")})'; - } - final s = StringBuffer(); s.write('\n'); + if (generateAsStub) { + s.write(''' +/// WARNING: $name is a stub. To generate bindings for this class, include +/// $name in your config's objc-interfaces list. +/// +'''); + } s.write(makeDartDoc(dartDoc ?? originalName)); - final methodNamer = createMethodRenamer(w); - final rawObjType = PointerType(objCObjectType).getCType(w); final wrapObjType = ObjCBuiltInFunctions.objectBase.gen(w); - final superTypeIsInPkgObjc = superType == null; - // Class declaration. - s.write('''class $name extends ${superType?.getDartType(w) ?? wrapObjType} { + s.write(''' +class $name extends ${superType?.getDartType(w) ?? wrapObjType} { $name._($rawObjType pointer, {bool retain = false, bool release = false}) : ${superTypeIsInPkgObjc ? 'super' : 'super.castFromPointer'} @@ -93,137 +91,33 @@ class ObjCInterface extends BindingType with ObjCMethods { {bool retain = false, bool release = false}) : this._(other, retain: retain, release: release); +${generateAsStub ? '' : _generateMethods(w)} +} + +'''); + + return BindingString( + type: BindingStringType.objcInterface, string: s.toString()); + } + + String _generateMethods(Writer w) { + final wrapObjType = ObjCBuiltInFunctions.objectBase.gen(w); + final s = StringBuffer(); + + s.write(''' /// Returns whether [obj] is an instance of [$name]. static bool isInstance($wrapObjType obj) { return ${_isKindOfClassMsgSend.invoke( w, 'obj.ref.pointer', _isKindOfClass.name, - [_classObject.name], + [classObject.name], )}; } '''); + s.write(generateMethodBindings(w, this)); - // Methods. - for (final m in methods) { - final methodName = m.getDartMethodName(methodNamer); - final isStatic = m.isClassMethod; - - final returnType = m.returnType; - final returnTypeStr = _getConvertedType(returnType, w, name); - final params = m.params; - - // The method declaration. - s.write('\n '); - s.write(makeDartDoc(m.dartDoc ?? m.originalName)); - s.write(' '); - if (isStatic) { - s.write('static $returnTypeStr'); - - switch (m.kind) { - case ObjCMethodKind.method: - // static returnType methodName(...) - s.write(' $methodName'); - break; - case ObjCMethodKind.propertyGetter: - // static returnType getMethodName() - s.write(' get'); - s.write(methodName[0].toUpperCase() + methodName.substring(1)); - break; - case ObjCMethodKind.propertySetter: - // static void setMethodName(...) - s.write(' set'); - s.write(methodName[0].toUpperCase() + methodName.substring(1)); - break; - } - s.write(paramsToString(params)); - } else { - switch (m.kind) { - case ObjCMethodKind.method: - // returnType methodName(...) - s.write('$returnTypeStr $methodName'); - s.write(paramsToString(params)); - break; - case ObjCMethodKind.propertyGetter: - // returnType get methodName - s.write('$returnTypeStr get $methodName'); - break; - case ObjCMethodKind.propertySetter: - // set methodName(...) - s.write(' set $methodName'); - s.write(paramsToString(params)); - break; - } - } - - s.write(' {\n'); - - // Implementation. - final sel = m.selObject.name; - if (m.isOptional) { - s.write(''' - if (!${ObjCBuiltInFunctions.respondsToSelector.gen(w)}(ref.pointer, $sel)) { - throw ${ObjCBuiltInFunctions.unimplementedOptionalMethodException.gen(w)}( - '$originalName', '${m.originalName}'); - } -'''); - } - final convertReturn = m.kind != ObjCMethodKind.propertySetter && - !returnType.sameDartAndFfiDartType; - - final target = isStatic - ? _classObject.name - : convertDartTypeToFfiDartType( - w, - 'this', - objCRetain: m.consumesSelf, - objCAutorelease: false, - ); - final msgSendParams = - m.params.map((p) => p.type.convertDartTypeToFfiDartType( - w, - p.name, - objCRetain: p.objCConsumed, - objCAutorelease: false, - )); - if (m.msgSend!.isStret) { - assert(!convertReturn); - final calloc = '${w.ffiPkgLibraryPrefix}.calloc'; - final sizeOf = '${w.ffiLibraryPrefix}.sizeOf'; - final uint8Type = NativeType(SupportedNativeType.uint8).getCType(w); - final invoke = m.msgSend! - .invoke(w, target, sel, msgSendParams, structRetPtr: '_ptr'); - s.write(''' - final _ptr = $calloc<$returnTypeStr>(); - $invoke; - final _finalizable = _ptr.cast<$uint8Type>().asTypedList( - $sizeOf<$returnTypeStr>(), finalizer: $calloc.nativeFree); - return ${w.ffiLibraryPrefix}.Struct.create<$returnTypeStr>(_finalizable); -'''); - } else { - if (returnType != voidType) { - s.write(' ${convertReturn ? 'final _ret = ' : 'return '}'); - } - s.write(m.msgSend!.invoke(w, target, sel, msgSendParams)); - s.write(';\n'); - if (convertReturn) { - final result = returnType.convertFfiDartTypeToDartType( - w, - '_ret', - objCRetain: !m.returnsRetained, - objCEnclosingClass: name, - ); - s.write(' return $result;'); - } - } - - s.write('\n }\n'); - } - - s.write('}\n\n'); - - return BindingString( - type: BindingStringType.objcInterface, string: s.toString()); + return s.toString(); } @override @@ -288,15 +182,6 @@ class ObjCInterface extends BindingType with ObjCMethods { @override String? generateRetain(String value) => 'objc_retain($value)'; - String _getConvertedType(Type type, Writer w, String enclosingClass) { - if (type is ObjCInstanceType) return enclosingClass; - final baseType = type.typealiasType; - if (baseType is ObjCNullable && baseType.child is ObjCInstanceType) { - return '$enclosingClass?'; - } - return type.getDartType(w); - } - @override void visit(Visitation visitation) => visitation.visitObjCInterface(this); @@ -304,10 +189,26 @@ class ObjCInterface extends BindingType with ObjCMethods { void visitChildren(Visitor visitor) { super.visitChildren(visitor); visitor.visit(superType); - visitor.visit(_classObject); + visitor.visit(classObject); visitor.visit(_isKindOfClass); visitor.visit(_isKindOfClassMsgSend); visitor.visitAll(protocols); + visitor.visitAll(categories); visitMethods(visitor); + + // Note: Don't visit subtypes here, because they shouldn't affect transitive + // inclusion. Including an interface shouldn't auto-include all its + // subtypes, even as stubs. + } + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + if (other is ObjCInterface) { + for (ObjCInterface? t = other; t != null; t = t.superType) { + if (t == this) return true; + } + } + return false; } } diff --git a/pkgs/ffigen/lib/src/code_generator/objc_methods.dart b/pkgs/ffigen/lib/src/code_generator/objc_methods.dart index d8a9317d5..686626b15 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_methods.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_methods.dart @@ -15,25 +15,26 @@ import 'writer.dart'; final _logger = Logger('ffigen.code_generator.objc_methods'); mixin ObjCMethods { - final _methods = {}; - final _order = []; + Map _methods = {}; + List _order = []; Iterable get methods => - _order.map((name) => _methods[name]).nonNulls; - ObjCMethod? getMethod(String name) => _methods[name]; + _order.map((key) => _methods[key]).nonNulls; + ObjCMethod? getSimilarMethod(ObjCMethod method) => _methods[method.key]; String get originalName; String get name; ObjCBuiltInFunctions get builtInFunctions; - void addMethod(ObjCMethod method) { + void addMethod(ObjCMethod? method) { + if (method == null) return; if (_shouldIncludeMethod(method)) { - final oldMethod = getMethod(method.originalName); + final oldMethod = getSimilarMethod(method); if (oldMethod != null) { - _methods[method.originalName] = _maybeReplaceMethod(oldMethod, method); + _methods[method.key] = _maybeReplaceMethod(oldMethod, method); } else { - _methods[method.originalName] = method; - _order.add(method.originalName); + _methods[method.key] = method; + _order.add(method.key); } } } @@ -56,6 +57,14 @@ mixin ObjCMethods { return oldMethod; } + // If one of the methods is optional, and the other is required, keep the + // required one. + if (newMethod.isOptional && !oldMethod.isOptional) { + return oldMethod; + } else if (!newMethod.isOptional && oldMethod.isOptional) { + return newMethod; + } + // Check the duplicate is the same method. if (!newMethod.sameAs(oldMethod)) { _logger.severe('Duplicate methods with different signatures: ' @@ -97,6 +106,27 @@ mixin ObjCMethods { parent: w.topLevelUniqueNamer); void sortMethods() => _order.sort(); + + void filterMethods(bool Function(ObjCMethod method) predicate) { + final newOrder = []; + final newMethods = {}; + for (final key in _order) { + final method = _methods[key]; + if (method != null && predicate(method)) { + newMethods[key] = method; + newOrder.add(key); + } + } + _order = newOrder; + _methods = newMethods; + } + + String generateMethodBindings(Writer w, ObjCInterface target) { + final methodNamer = createMethodRenamer(w); + return [ + for (final m in methods) m.generateBindings(w, target, methodNamer), + ].join('\n'); + } } enum ObjCMethodKind { @@ -166,7 +196,7 @@ class ObjCMethod extends AstNode { final ObjCProperty? property; Type returnType; final List params; - final ObjCMethodKind kind; + ObjCMethodKind kind; final bool isClassMethod; final bool isOptional; ObjCMethodOwnership? ownershipAttribute; @@ -229,8 +259,9 @@ class ObjCMethod extends AstNode { ); } - String getDartMethodName(UniqueNamer uniqueNamer) { - if (property != null) { + String getDartMethodName(UniqueNamer uniqueNamer, + {bool usePropertyNaming = true}) { + if (property != null && usePropertyNaming) { // A getter and a setter are allowed to have the same name, so we can't // just run the name through uniqueNamer. Instead they need to share // the dartName, which is run through uniqueNamer. @@ -273,7 +304,137 @@ class ObjCMethod extends AstNode { } } + // Key used to dedupe methods in [ObjCMethods]. ObjC is similar to Dart in + // that it doesn't have method overloading, so the [originalName] is mostly + // sufficient as the key. But unlike Dart, ObjC can have static methods and + // instance methods with the same name, so we have to include staticness in + // the key. + String get key => '${isClassMethod ? '+' : '-'}$originalName'; + @override String toString() => '${isOptional ? '@optional ' : ''}$returnType ' '$originalName(${params.join(', ')})'; + + bool get returnsInstanceType { + if (returnType is ObjCInstanceType) return true; + final baseType = returnType.typealiasType; + if (baseType is ObjCNullable && baseType.child is ObjCInstanceType) { + return true; + } + return false; + } + + String _getConvertedReturnType(Writer w, String instanceType) { + if (returnType is ObjCInstanceType) return instanceType; + final baseType = returnType.typealiasType; + if (baseType is ObjCNullable && baseType.child is ObjCInstanceType) { + return '$instanceType?'; + } + return returnType.getDartType(w); + } + + String generateBindings( + Writer w, ObjCInterface target, UniqueNamer methodNamer) { + final methodName = getDartMethodName(methodNamer); + final upperName = methodName[0].toUpperCase() + methodName.substring(1); + final s = StringBuffer(); + + final targetType = target.getDartType(w); + final returnTypeStr = _getConvertedReturnType(w, targetType); + final paramStr = [ + for (final p in params) + '${p.isCovariant ? 'covariant ' : ''}' + '${p.type.getDartType(w)} ${p.name}', + ].join(', '); + + // The method declaration. + s.write('\n ${makeDartDoc(dartDoc ?? originalName)} '); + late String targetStr; + if (isClassMethod) { + targetStr = target.classObject.name; + switch (kind) { + case ObjCMethodKind.method: + s.write('static $returnTypeStr $methodName($paramStr)'); + break; + case ObjCMethodKind.propertyGetter: + s.write('static $returnTypeStr get$upperName($paramStr)'); + break; + case ObjCMethodKind.propertySetter: + s.write('static $returnTypeStr set$upperName($paramStr)'); + break; + } + } else { + targetStr = target.convertDartTypeToFfiDartType( + w, + 'this', + objCRetain: consumesSelf, + objCAutorelease: false, + ); + switch (kind) { + case ObjCMethodKind.method: + s.write('$returnTypeStr $methodName($paramStr)'); + break; + case ObjCMethodKind.propertyGetter: + s.write('$returnTypeStr get $methodName'); + break; + case ObjCMethodKind.propertySetter: + s.write('set $methodName($paramStr)'); + break; + } + } + s.write(' {\n'); + + // Implementation. + final sel = selObject.name; + if (isOptional) { + s.write(''' + if (!${ObjCBuiltInFunctions.respondsToSelector.gen(w)}($targetStr, $sel)) { + throw ${ObjCBuiltInFunctions.unimplementedOptionalMethodException.gen(w)}( + '${target.originalName}', '$originalName'); + } +'''); + } + final convertReturn = kind != ObjCMethodKind.propertySetter && + !returnType.sameDartAndFfiDartType; + + final msgSendParams = params.map((p) => p.type.convertDartTypeToFfiDartType( + w, + p.name, + objCRetain: p.objCConsumed, + objCAutorelease: false, + )); + if (msgSend!.isStret) { + assert(!convertReturn); + final calloc = '${w.ffiPkgLibraryPrefix}.calloc'; + final sizeOf = '${w.ffiLibraryPrefix}.sizeOf'; + final uint8Type = NativeType(SupportedNativeType.uint8).getCType(w); + final invoke = msgSend! + .invoke(w, targetStr, sel, msgSendParams, structRetPtr: '_ptr'); + s.write(''' + final _ptr = $calloc<$returnTypeStr>(); + $invoke; + final _finalizable = _ptr.cast<$uint8Type>().asTypedList( + $sizeOf<$returnTypeStr>(), finalizer: $calloc.nativeFree); + return ${w.ffiLibraryPrefix}.Struct.create<$returnTypeStr>(_finalizable); +'''); + } else { + if (returnType != voidType) { + s.write(' ${convertReturn ? 'final _ret = ' : 'return '}'); + } + s.write(msgSend!.invoke(w, targetStr, sel, msgSendParams)); + s.write(';\n'); + if (convertReturn) { + final result = returnType.convertFfiDartTypeToDartType( + w, + '_ret', + objCRetain: !returnsRetained, + objCEnclosingClass: targetType, + ); + s.write(' return $result;'); + } + } + + s.write('\n }\n'); + return s.toString(); + } } diff --git a/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart b/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart index b3c8029af..ac4bf8984 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_nullable.dart @@ -12,9 +12,12 @@ import 'writer.dart'; class ObjCNullable extends Type { Type child; - ObjCNullable(this.child) : assert(isSupported(child)); + ObjCNullable(this.child) + : assert(isSupported(child), + 'Nullable ${child.typealiasType.runtimeType} is not supported'); - static bool isSupported(Type type) => + static bool isSupported(Type type) => _isSupported(type.typealiasType); + static bool _isSupported(Type type) => type is ObjCInterface || type is ObjCBlock || type is ObjCObjectPointer || @@ -96,4 +99,17 @@ class ObjCNullable extends Type { super.visitChildren(visitor); visitor.visit(child); } + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + + if (other is ObjCNullable) { + // T? :> S? if T :> S + return child.isSupertypeOf(other.child); + } else { + // T? :> S if T :> S + return child.isSupertypeOf(other); + } + } } diff --git a/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart b/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart index bc791e65d..cca7da841 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart @@ -12,10 +12,7 @@ import 'writer.dart'; class ObjCProtocol extends NoLookUpBinding with ObjCMethods { final superProtocols = []; final String lookupName; - ObjCInternalGlobal? _protocolPointer; - - @override - final bool generateBindings; + final ObjCInternalGlobal _protocolPointer; @override final ObjCBuiltInFunctions builtInFunctions; @@ -27,16 +24,12 @@ class ObjCProtocol extends NoLookUpBinding with ObjCMethods { String? lookupName, super.dartDoc, required this.builtInFunctions, - required this.generateBindings, }) : lookupName = lookupName ?? originalName, - super(name: name ?? originalName) { - if (generateBindings) { - _protocolPointer = ObjCInternalGlobal( - '_protocol_$originalName', - (Writer w) => - '${ObjCBuiltInFunctions.getProtocol.gen(w)}("$lookupName")'); - } - } + _protocolPointer = ObjCInternalGlobal( + '_protocol_$originalName', + (Writer w) => + '${ObjCBuiltInFunctions.getProtocol.gen(w)}("$lookupName")'), + super(name: name ?? originalName); @override bool get isObjCImport => builtInFunctions.isBuiltInProtocol(originalName); @@ -46,11 +39,6 @@ class ObjCProtocol extends NoLookUpBinding with ObjCMethods { @override BindingString toBindingString(Writer w) { - if (!generateBindings) { - return const BindingString( - type: BindingStringType.objcProtocol, string: ''); - } - final protocolMethod = ObjCBuiltInFunctions.protocolMethod.gen(w); final protocolListenableMethod = ObjCBuiltInFunctions.protocolListenableMethod.gen(w); @@ -67,7 +55,8 @@ class ObjCProtocol extends NoLookUpBinding with ObjCMethods { var anyListeners = false; for (final method in methods) { - final methodName = method.getDartMethodName(methodNamer); + final methodName = + method.getDartMethodName(methodNamer, usePropertyNaming: false); final fieldName = methodName; final argName = methodName; final block = method.protocolBlock!; @@ -109,9 +98,10 @@ class ObjCProtocol extends NoLookUpBinding with ObjCMethods { methodFields.write(makeDartDoc(method.dartDoc ?? method.originalName)); methodFields.write('''static final $fieldName = $methodClass<$funcType>( + ${_protocolPointer.name}, ${method.selObject.name}, $getSignature( - ${_protocolPointer!.name}, + ${_protocolPointer.name}, ${method.selObject.name}, isRequired: ${method.isRequired}, isInstanceMethod: ${method.isInstanceMethod}, @@ -174,8 +164,6 @@ ${makeDartDoc(dartDoc ?? originalName)}abstract final class $name { @override BindingString? toObjCBindingString(Writer w) { - if (!generateBindings) return null; - final wrapperName = builtInFunctions.wrapperName; final mainString = ''' diff --git a/pkgs/ffigen/lib/src/code_generator/pointer.dart b/pkgs/ffigen/lib/src/code_generator/pointer.dart index 4630848cb..4df2e867c 100644 --- a/pkgs/ffigen/lib/src/code_generator/pointer.dart +++ b/pkgs/ffigen/lib/src/code_generator/pointer.dart @@ -16,6 +16,8 @@ class PointerType extends Type { factory PointerType(Type child) { if (child == objCObjectType) { return ObjCObjectPointer(); + } else if (child == objCBlockType) { + return ObjCBlockPointer(); } return PointerType._(child); } @@ -46,6 +48,18 @@ class PointerType extends Type { super.visitChildren(visitor); visitor.visit(child); } + + @override + void visit(Visitation visitation) => visitation.visitPointerType(this); + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + if (other is PointerType) { + return child.isSupertypeOf(other.child); + } + return false; + } } /// Represents a constant array, which has a fixed size. @@ -105,6 +119,7 @@ class ObjCObjectPointer extends PointerType { factory ObjCObjectPointer() => _inst; static final _inst = ObjCObjectPointer._(); + ObjCObjectPointer.__(super.child) : super._(); ObjCObjectPointer._() : super._(objCObjectType); @override @@ -139,4 +154,33 @@ class ObjCObjectPointer extends PointerType { @override String? generateRetain(String value) => 'objc_retain($value)'; + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + // id/Object* is a supertype of all ObjC objects and blocks. + return other is ObjCObjectPointer || + other is ObjCInterface || + other is ObjCBlock; + } +} + +/// A pointer to an Objective C block. +class ObjCBlockPointer extends ObjCObjectPointer { + factory ObjCBlockPointer() => _inst; + + static final _inst = ObjCBlockPointer._(); + ObjCBlockPointer._() : super.__(objCBlockType); + + @override + String getDartType(Writer w) => '${w.objcPkgPrefix}.ObjCBlockBase'; + + @override + String? generateRetain(String value) => 'objc_retainBlock($value)'; + + @override + bool isSupertypeOf(Type other) { + other = other.typealiasType; + return other is ObjCBlockPointer || other is ObjCBlock; + } } diff --git a/pkgs/ffigen/lib/src/code_generator/struct.dart b/pkgs/ffigen/lib/src/code_generator/struct.dart index 93d6c1cb0..76875ef4b 100644 --- a/pkgs/ffigen/lib/src/code_generator/struct.dart +++ b/pkgs/ffigen/lib/src/code_generator/struct.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../visitor/ast.dart'; + import 'compound.dart'; /// A binding for C Struct. @@ -41,4 +43,7 @@ class Struct extends Compound { super.objCBuiltInFunctions, super.nativeType, }) : super(compoundType: CompoundType.struct); + + @override + void visit(Visitation visitation) => visitation.visitStruct(this); } diff --git a/pkgs/ffigen/lib/src/code_generator/type.dart b/pkgs/ffigen/lib/src/code_generator/type.dart index ae68cc61e..552945c94 100644 --- a/pkgs/ffigen/lib/src/code_generator/type.dart +++ b/pkgs/ffigen/lib/src/code_generator/type.dart @@ -33,6 +33,18 @@ abstract class Type extends AstNode { /// Returns true if the type is a [Compound] and is incomplete. bool get isIncompleteCompound => false; + /// Returns true if this is a subtype of [other]. That is this <: other. + /// + /// The behavior of this function should mirror Dart's subtyping logic, not + /// Objective-C's. It's used to detect and fix cases where the generated + /// bindings would fail `dart analyze` due to Dart's subtyping rules. + /// + /// Note: Implementers should implement [isSupertypeOf]. + bool isSubtypeOf(Type other) => other.isSupertypeOf(this); + + /// Returns true if this is a supertype of [other]. That is this :> other. + bool isSupertypeOf(Type other) => typealiasType == other.typealiasType; + /// Returns the C type of the Type. This is the FFI compatible type that is /// passed to native code. String getCType(Writer w) => @@ -124,6 +136,28 @@ abstract class Type extends AstNode { @override void visit(Visitation visitation) => visitation.visitType(this); + + // Helper for [isSupertypeOf] that applies variance rules. + static bool isSupertypeOfVariance({ + List covariantLeft = const [], + List covariantRight = const [], + List contravariantLeft = const [], + List contravariantRight = const [], + }) => + isSupertypeOfCovariance(left: covariantLeft, right: covariantRight) && + isSupertypeOfCovariance( + left: contravariantRight, right: contravariantLeft); + + static bool isSupertypeOfCovariance({ + required List left, + required List right, + }) { + if (left.length != right.length) return false; + for (var i = 0; i < left.length; ++i) { + if (!left[i].isSupertypeOf(right[i])) return false; + } + return true; + } } /// Base class for all Type bindings. @@ -152,6 +186,12 @@ abstract class BindingType extends NoLookUpBinding implements Type { @override bool get isIncompleteCompound => false; + @override + bool isSubtypeOf(Type other) => other.isSupertypeOf(this); + + @override + bool isSupertypeOf(Type other) => typealiasType == other.typealiasType; + @override String getFfiDartType(Writer w) => getCType(w); diff --git a/pkgs/ffigen/lib/src/code_generator/typealias.dart b/pkgs/ffigen/lib/src/code_generator/typealias.dart index ab6a01575..aa5110eb7 100644 --- a/pkgs/ffigen/lib/src/code_generator/typealias.dart +++ b/pkgs/ffigen/lib/src/code_generator/typealias.dart @@ -19,7 +19,7 @@ import 'writer.dart'; class Typealias extends BindingType { final Type type; String? _ffiDartAliasName; - String? _dartAliasName; + String? dartAliasName; /// Creates a Typealias. /// @@ -75,7 +75,7 @@ class Typealias extends BindingType { bool genFfiDartType = false, super.isInternal, }) : _ffiDartAliasName = genFfiDartType ? 'Dart$name' : null, - _dartAliasName = + dartAliasName = (!genFfiDartType && type is! Typealias && !type.sameDartAndCType) ? 'Dart$name' : null, @@ -95,8 +95,8 @@ class Typealias extends BindingType { if (_ffiDartAliasName != null) { _ffiDartAliasName = w.topLevelUniqueNamer.makeUnique(_ffiDartAliasName!); } - if (_dartAliasName != null) { - _dartAliasName = w.topLevelUniqueNamer.makeUnique(_dartAliasName!); + if (dartAliasName != null) { + dartAliasName = w.topLevelUniqueNamer.makeUnique(dartAliasName!); } final sb = StringBuffer(); @@ -107,8 +107,8 @@ class Typealias extends BindingType { if (_ffiDartAliasName != null) { sb.write('typedef $_ffiDartAliasName = ${type.getFfiDartType(w)};\n'); } - if (_dartAliasName != null) { - sb.write('typedef $_dartAliasName = ${type.getDartType(w)};\n'); + if (dartAliasName != null) { + sb.write('typedef $dartAliasName = ${type.getDartType(w)};\n'); } return BindingString( type: BindingStringType.typeDef, string: sb.toString()); @@ -121,7 +121,7 @@ class Typealias extends BindingType { bool get isIncompleteCompound => type.isIncompleteCompound; @override - String getCType(Writer w) => name; + String getCType(Writer w) => generateBindings ? name : type.getCType(w); @override String getNativeType({String varName = ''}) => @@ -129,24 +129,26 @@ class Typealias extends BindingType { @override String getFfiDartType(Writer w) { - if (_ffiDartAliasName != null) { - return _ffiDartAliasName!; - } else if (type.sameFfiDartAndCType) { - return name; - } else { - return type.getFfiDartType(w); + if (generateBindings) { + if (_ffiDartAliasName != null) { + return _ffiDartAliasName!; + } else if (type.sameFfiDartAndCType) { + return name; + } } + return type.getFfiDartType(w); } @override String getDartType(Writer w) { - if (_dartAliasName != null) { - return _dartAliasName!; - } else if (type.sameDartAndCType) { - return getFfiDartType(w); - } else { - return type.getDartType(w); + if (generateBindings) { + if (dartAliasName != null) { + return dartAliasName!; + } else if (type.sameDartAndCType) { + return getFfiDartType(w); + } } + return type.getDartType(w); } @override @@ -199,24 +201,17 @@ class Typealias extends BindingType { @override String? getDefaultValue(Writer w) => type.getDefaultValue(w); - // Used to compare whether two Typealias are same symbols and ensure that they - // are unique when adding to a [Set]. @override - bool operator ==(Object other) { - if (other is! Typealias) return false; - if (identical(this, other)) return true; - return other.usr == usr; + void visitChildren(Visitor visitor) { + super.visitChildren(visitor); + visitor.visit(type); } - // [usr] is unique for specific symbols. @override - int get hashCode => usr.hashCode; + void visit(Visitation visitation) => visitation.visitTypealias(this); @override - void visitChildren(Visitor visitor) { - super.visitChildren(visitor); - visitor.visit(type); - } + bool isSupertypeOf(Type other) => type.isSupertypeOf(other); } /// Objective C's instancetype. diff --git a/pkgs/ffigen/lib/src/code_generator/union.dart b/pkgs/ffigen/lib/src/code_generator/union.dart index 5bc85c774..29ad98fa7 100644 --- a/pkgs/ffigen/lib/src/code_generator/union.dart +++ b/pkgs/ffigen/lib/src/code_generator/union.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../visitor/ast.dart'; + import 'compound.dart'; /// A binding for a C union - @@ -39,4 +41,7 @@ class Union extends Compound { super.objCBuiltInFunctions, super.nativeType, }) : super(compoundType: CompoundType.union); + + @override + void visit(Visitation visitation) => visitation.visitUnion(this); } diff --git a/pkgs/ffigen/lib/src/code_generator/writer.dart b/pkgs/ffigen/lib/src/code_generator/writer.dart index 8b6dc6ec2..65537720f 100644 --- a/pkgs/ffigen/lib/src/code_generator/writer.dart +++ b/pkgs/ffigen/lib/src/code_generator/writer.dart @@ -39,9 +39,9 @@ class Writer { final List nativeEntryPoints; - /// Tracks where enumType.getCType is called. Reset everytime [generate] is - /// called. - bool usedEnumCType = false; + /// Tracks the enums for which enumType.getCType is called. Reset everytime + /// [generate] is called. + final usedEnumCTypes = {}; String? _ffiLibraryPrefix; String get ffiLibraryPrefix { @@ -243,8 +243,8 @@ class Writer { // Reset unique namers to initial state. _resetUniqueNamersNamers(); - // Reset [usedEnumCType]. - usedEnumCType = false; + // Reset [usedEnumCTypes]. + usedEnumCTypes.clear(); // Write file header (if any). if (header != null) { @@ -333,14 +333,15 @@ class Writer { result.write(s); // Warn about Enum usage in API surface. - if (!silenceEnumWarning && usedEnumCType) { + if (!silenceEnumWarning && usedEnumCTypes.isNotEmpty) { + final names = usedEnumCTypes.map((e) => e.originalName).toList()..sort(); _logger.severe('The integer type used for enums is ' 'implementation-defined. FFIgen tries to mimic the integer sizes ' 'chosen by the most common compilers for the various OS and ' 'architecture combinations. To prevent any crashes, remove the ' 'enums from your API surface. To rely on the (unsafe!) mimicking, ' 'you can silence this warning by adding silence-enum-warning: true ' - 'to the FFIgen config.'); + 'to the FFIgen config. Affected enums:\n\t${names.join('\n\t')}'); } _canGenerateSymbolOutput = true; @@ -389,13 +390,26 @@ class Writer { strings.ffiNative: usesFfiNative, }, strings.symbols: { - for (final b in bindings) b.usr: {strings.name: b.name}, + for (final b in bindings) b.usr: _makeSymbolMapValue(b), }, }, }, }; } + Map _makeSymbolMapValue(Binding b) { + final dartName = b is Typealias ? getTypedefDartAliasName(b) : null; + return { + strings.name: b.name, + if (dartName != null) strings.dartName: dartName, + }; + } + + String? getTypedefDartAliasName(Type b) { + if (b is! Typealias) return null; + return b.dartAliasName ?? getTypedefDartAliasName(b.type); + } + static String _objcImport(String entryPoint, String outDir) { final frameworkHeader = parseObjCFrameworkHeader(entryPoint); diff --git a/pkgs/ffigen/lib/src/config_provider.dart b/pkgs/ffigen/lib/src/config_provider.dart index f3b99499c..8feb6fe89 100644 --- a/pkgs/ffigen/lib/src/config_provider.dart +++ b/pkgs/ffigen/lib/src/config_provider.dart @@ -6,4 +6,5 @@ library config_provider; export 'config_provider/config.dart'; +export 'config_provider/config_types.dart'; export 'config_provider/yaml_config.dart'; diff --git a/pkgs/ffigen/lib/src/config_provider/config.dart b/pkgs/ffigen/lib/src/config_provider/config.dart index 915dc43e2..a855336ef 100644 --- a/pkgs/ffigen/lib/src/config_provider/config.dart +++ b/pkgs/ffigen/lib/src/config_provider/config.dart @@ -75,9 +75,30 @@ abstract interface class Config { /// Declaration filters for Objective C protocols. DeclarationFilters get objcProtocols; + /// Declaration filters for Objective C categories. + DeclarationFilters get objcCategories; + /// If enabled, unused typedefs will also be generated. bool get includeUnusedTypedefs; + /// If enabled, Objective C interfaces that are not explicitly included by + /// the [DeclarationFilters], but are transitively included by other bindings, + /// will be code-genned as if they were included. If disabled, these + /// transitively included interfaces will be generated as stubs instead. + bool get includeTransitiveObjCInterfaces; + + /// If enabled, Objective C protocols that are not explicitly included by + /// the [DeclarationFilters], but are transitively included by other bindings, + /// will be code-genned as if they were included. If disabled, these + /// transitively included protocols will not be generated at all. + bool get includeTransitiveObjCProtocols; + + /// If enabled, Objective C categories that are not explicitly included by + /// the [DeclarationFilters], but extend interfaces that are included, + /// will be code-genned as if they were included. If disabled, these + /// transitively included categories will not be generated at all. + bool get includeTransitiveObjCCategories; + /// Undocumented option that changes code generation for package:objective_c. /// The main difference is whether NSObject etc are imported from /// package:objective_c (the default) or code genned like any other class. @@ -194,7 +215,11 @@ abstract interface class Config { DeclarationFilters? typedefs, DeclarationFilters? objcInterfaces, DeclarationFilters? objcProtocols, + DeclarationFilters? objcCategories, bool includeUnusedTypedefs = false, + bool includeTransitiveObjCInterfaces = false, + bool includeTransitiveObjCProtocols = false, + bool includeTransitiveObjCCategories = true, bool generateForPackageObjectiveC = false, bool sort = false, bool useSupportedTypedefs = true, @@ -249,7 +274,11 @@ abstract interface class Config { typedefs: typedefs ?? DeclarationFilters.excludeAll, objcInterfaces: objcInterfaces ?? DeclarationFilters.excludeAll, objcProtocols: objcProtocols ?? DeclarationFilters.excludeAll, + objcCategories: objcCategories ?? DeclarationFilters.excludeAll, includeUnusedTypedefs: includeUnusedTypedefs, + includeTransitiveObjCInterfaces: includeTransitiveObjCInterfaces, + includeTransitiveObjCProtocols: includeTransitiveObjCProtocols, + includeTransitiveObjCCategories: includeTransitiveObjCCategories, generateForPackageObjectiveC: generateForPackageObjectiveC, sort: sort, useSupportedTypedefs: useSupportedTypedefs, @@ -307,11 +336,11 @@ abstract interface class DeclarationFilters { /// Applies member renaming and returns the result. Used for struct/union /// fields, enum elements, function params, and ObjC - /// interface/protocol methods/properties. + /// interface/protocol/category methods/properties. String renameMember(Declaration declaration, String member); /// Whether a member of a declaration should be included. Used for ObjC - /// interface/protocol methods/properties. + /// interface/protocol/category methods/properties. bool shouldIncludeMember(Declaration declaration, String member); factory DeclarationFilters({ diff --git a/pkgs/ffigen/lib/src/config_provider/config_impl.dart b/pkgs/ffigen/lib/src/config_provider/config_impl.dart index 1346d7d89..812a7a854 100644 --- a/pkgs/ffigen/lib/src/config_provider/config_impl.dart +++ b/pkgs/ffigen/lib/src/config_provider/config_impl.dart @@ -73,9 +73,21 @@ class ConfigImpl implements Config { @override final DeclarationFilters objcProtocols; + @override + final DeclarationFilters objcCategories; + @override final bool includeUnusedTypedefs; + @override + final bool includeTransitiveObjCInterfaces; + + @override + final bool includeTransitiveObjCProtocols; + + @override + final bool includeTransitiveObjCCategories; + @override final bool generateForPackageObjectiveC; @@ -197,7 +209,11 @@ class ConfigImpl implements Config { required this.typedefs, required this.objcInterfaces, required this.objcProtocols, + required this.objcCategories, required this.includeUnusedTypedefs, + required this.includeTransitiveObjCInterfaces, + required this.includeTransitiveObjCProtocols, + required this.includeTransitiveObjCCategories, required this.generateForPackageObjectiveC, required this.sort, required this.useSupportedTypedefs, diff --git a/pkgs/ffigen/lib/src/config_provider/config_types.dart b/pkgs/ffigen/lib/src/config_provider/config_types.dart index e8cd386b8..6ad7de8e2 100644 --- a/pkgs/ffigen/lib/src/config_provider/config_types.dart +++ b/pkgs/ffigen/lib/src/config_provider/config_types.dart @@ -454,8 +454,8 @@ class PackingValue { } class Declaration { - String usr; - String originalName; + final String usr; + final String originalName; Declaration({ required this.usr, required this.originalName, diff --git a/pkgs/ffigen/lib/src/config_provider/spec_utils.dart b/pkgs/ffigen/lib/src/config_provider/spec_utils.dart index c76bec386..646d737f6 100644 --- a/pkgs/ffigen/lib/src/config_provider/spec_utils.dart +++ b/pkgs/ffigen/lib/src/config_provider/spec_utils.dart @@ -58,8 +58,10 @@ void loadImportedTypes(YamlMap fileConfig, for (final key in symbols.keys) { final usr = key as String; final value = symbols[usr]! as YamlMap; - final name = value['name'] as String; - usrTypeMappings[usr] = ImportedType(libraryImport, name, name, name); + final name = value[strings.name] as String; + final dartName = (value[strings.dartName] as String?) ?? name; + usrTypeMappings[usr] = ImportedType(libraryImport, name, dartName, name, + importedDartType: true); } } diff --git a/pkgs/ffigen/lib/src/config_provider/yaml_config.dart b/pkgs/ffigen/lib/src/config_provider/yaml_config.dart index 0f03b5f95..02af35983 100644 --- a/pkgs/ffigen/lib/src/config_provider/yaml_config.dart +++ b/pkgs/ffigen/lib/src/config_provider/yaml_config.dart @@ -128,6 +128,11 @@ class YamlConfig implements Config { DeclarationFilters get objcProtocols => _objcProtocols; late DeclarationFilters _objcProtocols; + /// Declaration config for Objective C categories. + @override + DeclarationFilters get objcCategories => _objcCategories; + late DeclarationFilters _objcCategories; + /// If enabled, the default behavior of all declaration filters is to exclude /// everything, rather than include everything. late bool _excludeAllByDefault; @@ -137,6 +142,30 @@ class YamlConfig implements Config { bool get includeUnusedTypedefs => _includeUnusedTypedefs; late bool _includeUnusedTypedefs; + /// If enabled, Objective C interfaces that are not explicitly included by + /// the [DeclarationFilters], but are transitively included by other bindings, + /// will be code-genned as if they were included. If disabled, these + /// transitively included interfaces will be generated as stubs instead. + @override + bool get includeTransitiveObjCInterfaces => _includeTransitiveObjCInterfaces; + late bool _includeTransitiveObjCInterfaces; + + /// If enabled, Objective C protocols that are not explicitly included by + /// the [DeclarationFilters], but are transitively included by other bindings, + /// will be code-genned as if they were included. If disabled, these + /// transitively included protocols will not be generated at all. + @override + bool get includeTransitiveObjCProtocols => _includeTransitiveObjCProtocols; + late bool _includeTransitiveObjCProtocols; + + /// If enabled, Objective C categories that are not explicitly included by + /// the [DeclarationFilters], but extend interfaces that are included, + /// will be code-genned as if they were included. If disabled, these + /// transitively included categories will not be generated at all. + @override + bool get includeTransitiveObjCCategories => _includeTransitiveObjCCategories; + late bool _includeTransitiveObjCCategories; + /// Undocumented option that changes code generation for package:objective_c. /// The main difference is whether NSObject etc are imported from /// package:objective_c (the default) or code genned like any other class. @@ -679,6 +708,20 @@ class YamlConfig implements Config { (node.value as Map)[strings.objcModule] as ObjCModules; }, )), + HeterogeneousMapEntry( + key: strings.objcCategories, + valueConfigSpec: HeterogeneousMapConfigSpec( + entries: [ + ..._includeExcludeProperties(), + ..._renameProperties(), + ..._memberRenameProperties(), + _memberFilterProperty(), + ], + result: (node) { + _objcCategories = declarationConfigExtractor( + node.value as Map, _excludeAllByDefault); + }, + )), HeterogeneousMapEntry( key: strings.import, valueConfigSpec: HeterogeneousMapConfigSpec( @@ -753,6 +796,27 @@ class YamlConfig implements Config { resultOrDefault: (node) => _includeUnusedTypedefs = node.value as bool, ), + HeterogeneousMapEntry( + key: strings.includeTransitiveObjCInterfaces, + valueConfigSpec: BoolConfigSpec(), + defaultValue: (node) => false, + resultOrDefault: (node) => + _includeTransitiveObjCInterfaces = node.value as bool, + ), + HeterogeneousMapEntry( + key: strings.includeTransitiveObjCProtocols, + valueConfigSpec: BoolConfigSpec(), + defaultValue: (node) => false, + resultOrDefault: (node) => + _includeTransitiveObjCProtocols = node.value as bool, + ), + HeterogeneousMapEntry( + key: strings.includeTransitiveObjCCategories, + valueConfigSpec: BoolConfigSpec(), + defaultValue: (node) => true, + resultOrDefault: (node) => + _includeTransitiveObjCCategories = node.value as bool, + ), HeterogeneousMapEntry( key: strings.generateForPackageObjectiveC, valueConfigSpec: BoolConfigSpec(), diff --git a/pkgs/ffigen/lib/src/header_parser/includer.dart b/pkgs/ffigen/lib/src/header_parser/includer.dart deleted file mode 100644 index e973d6123..000000000 --- a/pkgs/ffigen/lib/src/header_parser/includer.dart +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -/// Utility functions to check whether a binding should be parsed or not -/// based on filters. -library; - -import '../config_provider/config_types.dart'; -import '../strings.dart' as strings; -import 'data.dart'; - -bool _shouldIncludeDecl( - Declaration declaration, - bool Function(String) isSeenDecl, - bool Function(Declaration) configIncludes) { - if (isSeenDecl(declaration.usr) || declaration.originalName == '') { - return false; - } else if (config.usrTypeMappings.containsKey(declaration.usr)) { - return false; - } else if (configIncludes(declaration)) { - return true; - } else { - return false; - } -} - -bool shouldIncludeStruct(Declaration declaration) { - return _shouldIncludeDecl( - declaration, bindingsIndex.isSeenType, config.structDecl.shouldInclude); -} - -bool shouldIncludeUnion(Declaration declaration) { - return _shouldIncludeDecl( - declaration, bindingsIndex.isSeenType, config.unionDecl.shouldInclude); -} - -bool shouldIncludeFunc(Declaration declaration) { - return _shouldIncludeDecl( - declaration, bindingsIndex.isSeenFunc, config.functionDecl.shouldInclude); -} - -bool shouldIncludeEnumClass(Declaration declaration) { - return _shouldIncludeDecl(declaration, bindingsIndex.isSeenType, - config.enumClassDecl.shouldInclude); -} - -bool shouldIncludeUnnamedEnumConstant(Declaration declaration) { - return _shouldIncludeDecl( - declaration, - bindingsIndex.isSeenUnnamedEnumConstant, - config.unnamedEnumConstants.shouldInclude); -} - -bool shouldIncludeGlobalVar(Declaration declaration) { - return _shouldIncludeDecl( - declaration, bindingsIndex.isSeenGlobalVar, config.globals.shouldInclude); -} - -bool shouldIncludeMacro(Declaration declaration) { - return _shouldIncludeDecl( - declaration, bindingsIndex.isSeenMacro, config.macroDecl.shouldInclude); -} - -bool shouldIncludeTypealias(Declaration declaration) { - // Objective C has some core typedefs that are important to keep. - if (config.language == Language.objc && - declaration.originalName == strings.objcInstanceType) { - return true; - } - return _shouldIncludeDecl( - declaration, bindingsIndex.isSeenType, config.typedefs.shouldInclude); -} - -bool shouldIncludeObjCInterface(Declaration declaration) { - return _shouldIncludeDecl(declaration, bindingsIndex.isSeenType, - config.objcInterfaces.shouldInclude); -} - -bool shouldIncludeObjCProtocol(Declaration declaration) { - return _shouldIncludeDecl(declaration, bindingsIndex.isSeenObjCProtocol, - config.objcProtocols.shouldInclude); -} - -/// True if a cursor should be included based on headers config, used on root -/// declarations. -bool shouldIncludeRootCursor(String sourceFile) { - // Handle empty string in case of system headers or macros. - if (sourceFile.isEmpty) { - return false; - } - - // Add header to seen if it's not. - if (!bindingsIndex.isSeenHeader(sourceFile)) { - bindingsIndex.addHeaderToSeen( - sourceFile, config.shouldIncludeHeader(Uri.file(sourceFile))); - } - - return bindingsIndex.getSeenHeaderStatus(sourceFile)!; -} diff --git a/pkgs/ffigen/lib/src/header_parser/parser.dart b/pkgs/ffigen/lib/src/header_parser/parser.dart index ecf4fd0e7..882e68c3f 100644 --- a/pkgs/ffigen/lib/src/header_parser/parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/parser.dart @@ -5,13 +5,22 @@ import 'dart:ffi'; import 'dart:io'; +import 'package:collection/collection.dart'; import 'package:ffi/ffi.dart'; import 'package:logging/logging.dart'; import '../code_generator.dart'; +import '../code_generator/utils.dart'; import '../config_provider.dart'; -import '../config_provider/config_types.dart'; import '../strings.dart' as strings; +import '../visitor/apply_config_filters.dart'; +import '../visitor/ast.dart'; +import '../visitor/copy_methods_from_super_type.dart'; +import '../visitor/fill_method_dependencies.dart'; +import '../visitor/find_transitive_deps.dart'; +import '../visitor/fix_overridden_methods.dart'; +import '../visitor/list_bindings.dart'; +import '../visitor/opaque_compounds.dart'; import 'clang_bindings/clang_bindings.dart' as clang_types; import 'data.dart'; import 'sub_parsers/macro_parser.dart'; @@ -19,26 +28,13 @@ import 'translation_unit_parser.dart'; import 'utils.dart'; /// Main entrypoint for header_parser. -Library parse(Config c) { - initParser(c); - - final bindings = parseToBindings(c); - - final library = Library( - bindings: bindings, - name: c.wrapperName, - description: c.wrapperDocComment, - header: c.preamble, - sort: c.sort, - generateForPackageObjectiveC: c.generateForPackageObjectiveC, - packingOverride: c.structPackingOverride, - libraryImports: c.libraryImports.values.toList(), - silenceEnumWarning: c.silenceEnumWarning, - nativeEntryPoints: c.entryPoints.map((uri) => uri.toFilePath()).toList(), - objCBuiltInFunctions: objCBuiltInFunctions, - ); +Library parse(Config config) { + initParser(config); - return library; + return Library.fromConfig( + config: config, + bindings: _transformBindings(config, parseToBindings(config)), + ); } // ============================================================================= @@ -173,3 +169,84 @@ List _findObjectiveCSysroot() { } return []; } + +List _transformBindings(Config config, List bindings) { + visit(CopyMethodsFromSuperTypesVisitation(), bindings); + visit(FixOverriddenMethodsVisitation(), bindings); + visit(FillMethodDependenciesVisitation(), bindings); + + final included = + visit(ApplyConfigFiltersVisitation(config), bindings).included; + + final byValueCompounds = visit(FindByValueCompoundsVisitation(), + FindByValueCompoundsVisitation.rootNodes(included)) + .byValueCompounds; + visit( + ClearOpaqueCompoundMembersVisitation(config, byValueCompounds, included), + bindings); + + final transitives = + visit(FindTransitiveDepsVisitation(), included).transitives; + final directTransitives = + visit(FindDirectTransitiveDepsVisitation(config, included), included) + .directTransitives; + + final finalBindings = visit( + ListBindingsVisitation( + config, included, transitives, directTransitives), + bindings) + .bindings; + visit(MarkBindingsVisitation(finalBindings), bindings); + + final finalBindingsList = finalBindings.toList(); + + /// Sort bindings. + if (config.sort) { + finalBindingsList.sortBy((b) => b.name); + for (final b in finalBindingsList) { + b.sort(); + } + } + + /// Handle any declaration-declaration name conflicts and emit warnings. + final declConflictHandler = UniqueNamer({}); + for (final b in finalBindingsList) { + _warnIfPrivateDeclaration(b); + _resolveIfNameConflicts(declConflictHandler, b); + } + + // Override pack values according to config. We do this after declaration + // conflicts have been handled so that users can target the generated names. + for (final b in finalBindingsList) { + if (b is Struct) { + final pack = config.structPackingOverride(b); + if (pack != null) { + b.pack = pack.value; + } + } + } + + return finalBindingsList; +} + +/// Logs a warning if generated declaration will be private. +void _warnIfPrivateDeclaration(Binding b) { + if (b.name.startsWith('_') && !b.isInternal) { + _logger.warning("Generated declaration '${b.name}' starts with '_' " + 'and therefore will be private.'); + } +} + +/// Resolves name conflict(if any) and logs a warning. +void _resolveIfNameConflicts(UniqueNamer namer, Binding b) { + // Print warning if name was conflicting and has been changed. + if (namer.isUsed(b.name)) { + final oldName = b.name; + b.name = namer.makeUnique(b.name); + + _logger.warning("Resolved name conflict: Declaration '$oldName' " + "and has been renamed to '${b.name}'."); + } else { + namer.markUsed(b.name); + } +} diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/compounddecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/compounddecl_parser.dart index 90c9b9894..5e8c62fff 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/compounddecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/compounddecl_parser.dart @@ -10,7 +10,6 @@ import '../../config_provider/config_types.dart'; import '../../strings.dart' as strings; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; import 'api_availability.dart'; @@ -76,25 +75,18 @@ class _ParsedCompound { Compound? parseCompoundDeclaration( clang_types.CXCursor cursor, CompoundType compoundType, { - /// Option to ignore declaration filter (Useful in case of extracting - /// declarations when they are passed/returned by an included function.) - bool ignoreFilter = false, - /// To track if the declaration was used by reference(i.e T*). (Used to only /// generate these as opaque if `dependency-only` was set to opaque). bool pointerReference = false, }) { // Set includer functions according to compoundType. - final bool Function(Declaration) shouldIncludeDecl; final DeclarationFilters configDecl; final className = _compoundTypeDebugName(compoundType); switch (compoundType) { case CompoundType.struct: - shouldIncludeDecl = shouldIncludeStruct; configDecl = config.structDecl; break; case CompoundType.union: - shouldIncludeDecl = shouldIncludeUnion; configDecl = config.unionDecl; break; } @@ -122,22 +114,16 @@ Compound? parseCompoundDeclaration( final decl = Declaration(usr: declUsr, originalName: declName); if (declName.isEmpty) { - if (ignoreFilter) { - cursor = cursorIndex.getDefinition(cursor); - // This declaration is defined inside some other declaration and hence - // must be generated. - return Compound.fromType( - type: compoundType, - name: incrementalNamer.name('Unnamed$className'), - usr: declUsr, - dartDoc: getCursorDocComment(cursor), - objCBuiltInFunctions: objCBuiltInFunctions, - nativeType: cursor.type().spelling(), - ); - } else { - _logger.finest('unnamed $className declaration'); - } - } else if (ignoreFilter || shouldIncludeDecl(decl)) { + cursor = cursorIndex.getDefinition(cursor); + return Compound.fromType( + type: compoundType, + name: incrementalNamer.name('Unnamed$className'), + usr: declUsr, + dartDoc: getCursorDocComment(cursor), + objCBuiltInFunctions: objCBuiltInFunctions, + nativeType: cursor.type().spelling(), + ); + } else { cursor = cursorIndex.getDefinition(cursor); _logger.fine('++++ Adding $className: Name: $declName, ' '${cursor.completeStringRepr()}'); @@ -151,33 +137,18 @@ Compound? parseCompoundDeclaration( nativeType: cursor.type().spelling(), ); } - return null; } void fillCompoundMembersIfNeeded( Compound compound, clang_types.CXCursor cursor, { - /// Option to ignore declaration filter (Useful in case of extracting - /// declarations when they are passed/returned by an included function.) - bool ignoreFilter = false, - /// To track if the declaration was used by reference(i.e T*). (Used to only /// generate these as opaque if `dependency-only` was set to opaque). bool pointerReference = false, }) { + if (compound.parsedDependencies) return; final compoundType = compound.compoundType; - // Skip dependencies if already seen OR user has specified `dependency-only` - // as opaque AND this is a pointer reference AND the declaration was not - // included according to config (ignoreFilter). - final skipDependencies = compound.parsedDependencies || - (pointerReference && - ignoreFilter && - ((compoundType == CompoundType.struct && - config.structDependencies == CompoundDependencies.opaque) || - (compoundType == CompoundType.union && - config.unionDependencies == CompoundDependencies.opaque))); - if (skipDependencies) return; cursor = cursorIndex.getDefinition(cursor); final parsed = _ParsedCompound(compound); diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/enumdecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/enumdecl_parser.dart index 2d979271f..80d7735bc 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/enumdecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/enumdecl_parser.dart @@ -8,7 +8,6 @@ import '../../code_generator.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../type_extractor/cxtypekindmap.dart'; import '../utils.dart'; import 'api_availability.dart'; @@ -19,11 +18,7 @@ final _logger = Logger('ffigen.header_parser.enumdecl_parser'); /// Parses an enum declaration. Returns (enumClass, nativeType). enumClass /// is null for anonymous enums. (EnumClass? enumClass, Type nativeType) parseEnumDeclaration( - clang_types.CXCursor cursor, { - /// Option to ignore declaration filter (Useful in case of extracting - /// declarations when they are passed/returned by an included function.) - bool ignoreFilter = false, -}) { + clang_types.CXCursor cursor) { EnumClass? enumClass; // Parse the cursor definition instead, if this is a forward declaration. cursor = cursorIndex.getDefinition(cursor); @@ -55,7 +50,7 @@ final _logger = Logger('ffigen.header_parser.enumdecl_parser'); final addedConstants = saveUnNamedEnum(cursor); hasNegativeEnumConstants = addedConstants.where((c) => c.rawValue.startsWith('-')).isNotEmpty; - } else if (ignoreFilter || shouldIncludeEnumClass(decl)) { + } else { _logger.fine('++++ Adding Enum: ${cursor.completeStringRepr()}'); enumClass = EnumClass( usr: enumUsr, diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/functiondecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/functiondecl_parser.dart index ba0ebe465..954a0b3b3 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/functiondecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/functiondecl_parser.dart @@ -8,7 +8,6 @@ import '../../code_generator.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; import 'api_availability.dart'; @@ -29,7 +28,10 @@ List parseFunctionDeclaration(clang_types.CXCursor cursor) { } final decl = Declaration(usr: funcUsr, originalName: funcName); - if (shouldIncludeFunc(decl)) { + final cachedFunc = bindingsIndex.getSeenFunc(funcUsr); + if (cachedFunc != null) { + funcs.add(cachedFunc); + } else { _logger.fine('++++ Adding Function: ${cursor.completeStringRepr()}'); final returnType = cursor.returnType().toCodeGenType(); @@ -136,8 +138,6 @@ List parseFunctionDeclaration(clang_types.CXCursor cursor) { )); } bindingsIndex.addFuncToSeen(funcUsr, funcs.last); - } else if (bindingsIndex.isSeenFunc(funcUsr)) { - funcs.add(bindingsIndex.getSeenFunc(funcUsr)!); } return funcs; diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart index 7dd61299a..5ab325906 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart @@ -15,7 +15,6 @@ import '../../config_provider/config_types.dart'; import '../../strings.dart' as strings; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; final _logger = Logger('ffigen.header_parser.macro_parser'); @@ -26,8 +25,7 @@ void saveMacroDefinition(clang_types.CXCursor cursor) { final originalMacroName = cursor.spelling(); final decl = Declaration(usr: macroUsr, originalName: originalMacroName); if (clang.clang_Cursor_isMacroBuiltin(cursor) == 0 && - clang.clang_Cursor_isMacroFunctionLike(cursor) == 0 && - shouldIncludeMacro(decl)) { + clang.clang_Cursor_isMacroFunctionLike(cursor) == 0) { // Parse macro only if it's not builtin or function-like. _logger.fine("++++ Saved Macro '$originalMacroName' for later : " '${cursor.completeStringRepr()}'); @@ -47,8 +45,8 @@ void _saveMacro(String name, String usr, String originalName) { /// Macros cannot be parsed directly, so we create a new `.hpp` file in which /// they are assigned to a variable after which their value can be determined /// by evaluating the value of the variable. -List parseSavedMacros() { - final bindings = []; +List parseSavedMacros() { + final bindings = []; if (savedMacros.keys.isEmpty) { return bindings; @@ -93,8 +91,8 @@ List parseSavedMacros() { /// Child visitor invoked on translationUnitCursor for parsing macroVariables. void _macroVariablevisitor( - clang_types.CXCursor cursor, List bindings) { - Constant? constant; + clang_types.CXCursor cursor, List bindings) { + MacroConstant? constant; try { if (isFromGeneratedFile(cursor) && _macroVarNames.contains(cursor.spelling()) && @@ -107,7 +105,7 @@ void _macroVariablevisitor( final macroName = MacroVariableString.decode(cursor.spelling()); switch (k) { case clang_types.CXEvalResultKind.CXEval_Int: - constant = Constant( + constant = MacroConstant( usr: savedMacros[macroName]!.usr, originalName: savedMacros[macroName]!.originalName, name: macroName, @@ -116,7 +114,7 @@ void _macroVariablevisitor( ); break; case clang_types.CXEvalResultKind.CXEval_Float: - constant = Constant( + constant = MacroConstant( usr: savedMacros[macroName]!.usr, originalName: savedMacros[macroName]!.originalName, name: macroName, @@ -130,7 +128,7 @@ void _macroVariablevisitor( macroName, clang.clang_EvalResult_getAsStr(e), ); - constant = Constant( + constant = MacroConstant( usr: savedMacros[macroName]!.usr, originalName: savedMacros[macroName]!.originalName, name: macroName, diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objccategorydecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objccategorydecl_parser.dart new file mode 100644 index 000000000..397abfd17 --- /dev/null +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objccategorydecl_parser.dart @@ -0,0 +1,86 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:logging/logging.dart'; + +import '../../code_generator.dart'; +import '../../config_provider/config_types.dart'; +import '../clang_bindings/clang_bindings.dart' as clang_types; +import '../data.dart'; +import '../utils.dart'; +import 'api_availability.dart'; +import 'objcinterfacedecl_parser.dart'; +import 'objcprotocoldecl_parser.dart'; + +final _logger = Logger('ffigen.header_parser.objccategorydecl_parser'); + +ObjCCategory? parseObjCCategoryDeclaration(clang_types.CXCursor cursor) { + final usr = cursor.usr(); + final name = cursor.spelling(); + + final decl = Declaration(usr: usr, originalName: name); + + final cachedCategory = bindingsIndex.getSeenObjCCategory(usr); + if (cachedCategory != null) { + return cachedCategory; + } + + if (!isApiAvailable(cursor)) { + _logger.info('Omitting deprecated category $name'); + return null; + } + + _logger.fine('++++ Adding ObjC category: ' + 'Name: $name, ${cursor.completeStringRepr()}'); + + final itfCursor = + cursor.findChildWithKind(clang_types.CXCursorKind.CXCursor_ObjCClassRef); + if (itfCursor == null) { + _logger.severe('Category $name has no interface.'); + return null; + } + + final parentInterface = itfCursor.type().toCodeGenType(); + if (parentInterface is! ObjCInterface) { + _logger.severe('Interface of category $name is $parentInterface, ' + 'which is not a valid interface.'); + return null; + } + + final category = ObjCCategory( + usr: usr, + originalName: name, + name: config.objcCategories.rename(decl), + parent: parentInterface, + dartDoc: getCursorDocComment(cursor), + builtInFunctions: objCBuiltInFunctions, + ); + + bindingsIndex.addObjCCategoryToSeen(usr, category); + + cursor.visitChildren((child) { + switch (child.kind) { + case clang_types.CXCursorKind.CXCursor_ObjCProtocolRef: + final protoCursor = clang.clang_getCursorDefinition(child); + category.addProtocol(parseObjCProtocolDeclaration(protoCursor)); + break; + case clang_types.CXCursorKind.CXCursor_ObjCPropertyDecl: + final (getter, setter) = + parseObjCProperty(child, decl, config.objcCategories); + category.addMethod(getter); + category.addMethod(setter); + break; + case clang_types.CXCursorKind.CXCursor_ObjCInstanceMethodDecl: + case clang_types.CXCursorKind.CXCursor_ObjCClassMethodDecl: + category.addMethod(parseObjCMethod(child, decl, config.objcCategories)); + break; + } + }); + + _logger.fine('++++ Finished ObjC category: ' + 'Name: $name, ${cursor.completeStringRepr()}'); + + parentInterface.categories.add(category); + return category; +} diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart index f8cb2bef7..687ba22e8 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart @@ -9,7 +9,6 @@ import '../../config_provider/config.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; import 'api_availability.dart'; import 'objcprotocoldecl_parser.dart'; @@ -19,18 +18,10 @@ final _logger = Logger('ffigen.header_parser.objcinterfacedecl_parser'); String applyModulePrefix(String name, String? module) => module == null ? name : '$module.$name'; -Type? parseObjCInterfaceDeclaration( - clang_types.CXCursor cursor, { - /// Option to ignore declaration filter (Useful in case of extracting - /// declarations when they are passed/returned by an included function.) - bool ignoreFilter = false, -}) { +Type? parseObjCInterfaceDeclaration(clang_types.CXCursor cursor) { final itfUsr = cursor.usr(); final itfName = cursor.spelling(); final decl = Declaration(usr: itfUsr, originalName: itfName); - if (!ignoreFilter && !shouldIncludeObjCInterface(decl)) { - return null; - } if (!isApiAvailable(cursor)) { _logger.info('Omitting deprecated interface $itfName'); @@ -64,13 +55,6 @@ void fillObjCInterfaceMethodsIfNeeded( _logger.fine('++++ Filling ObjC interface: ' 'Name: ${itf.originalName}, ${cursor.completeStringRepr()}'); - _fillInterface(itf, cursor); - - _logger.fine('++++ Finished ObjC interface: ' - 'Name: ${itf.originalName}, ${cursor.completeStringRepr()}'); -} - -void _fillInterface(ObjCInterface itf, clang_types.CXCursor cursor) { final itfDecl = Declaration(usr: itf.usr, originalName: itf.originalName); cursor.visitChildren((child) { switch (child.kind) { @@ -78,17 +62,24 @@ void _fillInterface(ObjCInterface itf, clang_types.CXCursor cursor) { _parseSuperType(child, itf); break; case clang_types.CXCursorKind.CXCursor_ObjCProtocolRef: - _parseProtocol(child, itf); + final protoCursor = clang.clang_getCursorDefinition(child); + itf.addProtocol(parseObjCProtocolDeclaration(protoCursor)); break; case clang_types.CXCursorKind.CXCursor_ObjCPropertyDecl: - _parseProperty(child, itf, itfDecl); + final (getter, setter) = + parseObjCProperty(child, itfDecl, config.objcInterfaces); + itf.addMethod(getter); + itf.addMethod(setter); break; case clang_types.CXCursorKind.CXCursor_ObjCInstanceMethodDecl: case clang_types.CXCursorKind.CXCursor_ObjCClassMethodDecl: - _parseInterfaceMethod(child, itf, itfDecl); + itf.addMethod(parseObjCMethod(child, itfDecl, config.objcInterfaces)); break; } }); + + _logger.fine('++++ Finished ObjC interface: ' + 'Name: ${itf.originalName}, ${cursor.completeStringRepr()}'); } bool _isClassDeclaration(clang_types.CXCursor cursor) { @@ -110,38 +101,28 @@ void _parseSuperType(clang_types.CXCursor cursor, ObjCInterface itf) { '$superType ${cursor.completeStringRepr()}'); if (superType is ObjCInterface) { itf.superType = superType; + superType.subtypes.add(itf); } else { _logger.severe( 'Super type of $itf is $superType, which is not a valid interface.'); } } -void _parseProtocol(clang_types.CXCursor cursor, ObjCInterface itf) { - final protoCursor = clang.clang_getCursorDefinition(cursor); - final proto = parseObjCProtocolDeclaration(protoCursor, ignoreFilter: true); - if (proto != null) { - itf.addProtocol(proto); - } -} - -void _parseProperty( - clang_types.CXCursor cursor, ObjCInterface itf, Declaration itfDecl) { +(ObjCMethod?, ObjCMethod?) parseObjCProperty( + clang_types.CXCursor cursor, Declaration decl, DeclarationFilters filters) { final fieldName = cursor.spelling(); final fieldType = cursor.type().toCodeGenType(); if (!isApiAvailable(cursor)) { - _logger.info('Omitting deprecated property ${itf.originalName}.$fieldName'); - return; + _logger + .info('Omitting deprecated property ${decl.originalName}.$fieldName'); + return (null, null); } if (fieldType.isIncompleteCompound) { - _logger.warning('Property "$fieldName" in instance "${itf.originalName}" ' + _logger.warning('Property "$fieldName" in instance "${decl.originalName}" ' 'has incomplete type: $fieldType.'); - return; - } - - if (!config.objcInterfaces.shouldIncludeMember(itfDecl, fieldName)) { - return; + return (null, null); } final dartDoc = getCursorDocComment(cursor); @@ -158,7 +139,7 @@ void _parseProperty( final property = ObjCProperty( originalName: fieldName, - name: config.objcInterfaces.renameMember(itfDecl, fieldName), + name: filters.renameMember(decl, fieldName), ); _logger.fine(' > Property: ' @@ -178,13 +159,13 @@ void _parseProperty( returnType: fieldType, family: null, ); - itf.addMethod(getter); + ObjCMethod? setter; if (!isReadOnly) { final setterName = clang .clang_Cursor_getObjCPropertySetterName(cursor) .toStringAndDispose(); - final setter = ObjCMethod( + setter = ObjCMethod( builtInFunctions: objCBuiltInFunctions, originalName: setterName, name: setterName, @@ -193,21 +174,13 @@ void _parseProperty( kind: ObjCMethodKind.propertySetter, isClassMethod: isClassMethod, isOptional: isOptionalMethod, - returnType: NativeType(SupportedNativeType.voidType), + returnType: voidType, family: null, ); setter.params .add(Parameter(name: 'value', type: fieldType, objCConsumed: false)); - itf.addMethod(setter); - } -} - -void _parseInterfaceMethod( - clang_types.CXCursor cursor, ObjCInterface itf, Declaration itfDecl) { - final method = parseObjCMethod(cursor, itfDecl, config.objcInterfaces); - if (method != null) { - itf.addMethod(method); } + return (getter, setter); } ObjCMethod? parseObjCMethod(clang_types.CXCursor cursor, Declaration itfDecl, @@ -230,10 +203,6 @@ ObjCMethod? parseObjCMethod(clang_types.CXCursor cursor, Declaration itfDecl, return null; } - if (!filters.shouldIncludeMember(itfDecl, methodName)) { - return null; - } - final method = ObjCMethod( builtInFunctions: objCBuiltInFunctions, originalName: methodName, @@ -301,39 +270,3 @@ bool _parseMethodParam( method.params.add(Parameter(name: name, type: type, objCConsumed: consumed)); return true; } - -BindingType? parseObjCCategoryDeclaration(clang_types.CXCursor cursor) { - // Categories add methods to an existing interface, so first we run a visitor - // to find the interface, then we fully parse that interface, then we run - // _fillInterface over the category to add its methods etc. Reusing the - // interface visitor relies on the fact that the structure of the category AST - // looks exactly the same as the interface AST, and that the category's - // interface is a different kind of node to the interface's super type (so is - // ignored by _fillInterface). - final name = cursor.spelling(); - _logger.fine('++++ Adding ObjC category: ' - 'Name: $name, ${cursor.completeStringRepr()}'); - - final itfCursor = - cursor.findChildWithKind(clang_types.CXCursorKind.CXCursor_ObjCClassRef); - if (itfCursor == null) { - _logger.severe('Category $name has no interface.'); - return null; - } - - // TODO(https://github.com/dart-lang/ffigen/issues/347): Currently any - // interface with a category bypasses the filters. - final itf = itfCursor.type().toCodeGenType(); - if (itf is! ObjCInterface) { - _logger.severe( - 'Interface of category $name is $itf, which is not a valid interface.'); - return null; - } - - _fillInterface(itf, cursor); - - _logger.fine('++++ Finished ObjC category: ' - 'Name: $name, ${cursor.completeStringRepr()}'); - - return itf; -} diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcprotocoldecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcprotocoldecl_parser.dart index 3827e53ac..dde0a22c8 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcprotocoldecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcprotocoldecl_parser.dart @@ -8,15 +8,13 @@ import '../../code_generator.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; import 'api_availability.dart'; import 'objcinterfacedecl_parser.dart'; final _logger = Logger('ffigen.header_parser.objcprotocoldecl_parser'); -ObjCProtocol? parseObjCProtocolDeclaration(clang_types.CXCursor cursor, - {bool ignoreFilter = false}) { +ObjCProtocol? parseObjCProtocolDeclaration(clang_types.CXCursor cursor) { if (cursor.kind != clang_types.CXCursorKind.CXCursor_ObjCProtocolDecl) { return null; } @@ -25,10 +23,6 @@ ObjCProtocol? parseObjCProtocolDeclaration(clang_types.CXCursor cursor, final name = cursor.spelling(); final decl = Declaration(usr: usr, originalName: name); - final included = shouldIncludeObjCProtocol(decl); - if (!ignoreFilter && !included) { - return null; - } final cachedProtocol = bindingsIndex.getSeenObjCProtocol(usr); if (cachedProtocol != null) { @@ -50,12 +44,6 @@ ObjCProtocol? parseObjCProtocolDeclaration(clang_types.CXCursor cursor, lookupName: applyModulePrefix(name, config.protocolModule(decl)), dartDoc: getCursorDocComment(cursor), builtInFunctions: objCBuiltInFunctions, - - // Only generate bindings for the protocol if it is included in the user's - // filters. If this protocol was only parsed because of ignoreFilter, then - // it's being used to add methods to an interface or a child protocol, and - // shouldn't get bindings. - generateBindings: included, ); // Make sure to add the protocol to the index before parsing the AST, to break @@ -68,18 +56,20 @@ ObjCProtocol? parseObjCProtocolDeclaration(clang_types.CXCursor cursor, final declCursor = clang.clang_getCursorDefinition(child); _logger.fine( ' > Super protocol: ${declCursor.completeStringRepr()}'); - final superProtocol = - parseObjCProtocolDeclaration(declCursor, ignoreFilter: true); + final superProtocol = parseObjCProtocolDeclaration(declCursor); if (superProtocol != null) { protocol.superProtocols.add(superProtocol); } break; + case clang_types.CXCursorKind.CXCursor_ObjCPropertyDecl: + final (getter, setter) = + parseObjCProperty(child, decl, config.objcProtocols); + protocol.addMethod(getter); + protocol.addMethod(setter); + break; case clang_types.CXCursorKind.CXCursor_ObjCInstanceMethodDecl: case clang_types.CXCursorKind.CXCursor_ObjCClassMethodDecl: - final method = parseObjCMethod(child, decl, config.objcProtocols); - if (method != null) { - protocol.addMethod(method); - } + protocol.addMethod(parseObjCMethod(child, decl, config.objcProtocols)); break; } }); diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/typedefdecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/typedefdecl_parser.dart index 4e469857f..ec3e61eeb 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/typedefdecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/typedefdecl_parser.dart @@ -8,7 +8,6 @@ import '../../code_generator.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../type_extractor/extractor.dart'; import '../utils.dart'; @@ -40,48 +39,46 @@ Typealias? parseTypedefDeclaration( final typedefName = cursor.spelling(); final typedefUsr = cursor.usr(); final decl = Declaration(usr: typedefUsr, originalName: typedefName); - if (shouldIncludeTypealias(decl)) { - final ct = clang.clang_getTypedefDeclUnderlyingType(cursor); - final s = getCodeGenType(ct, - pointerReference: pointerReference, originalCursor: cursor); + final ct = clang.clang_getTypedefDeclUnderlyingType(cursor); + final s = getCodeGenType(ct, + pointerReference: pointerReference, originalCursor: cursor); - if (bindingsIndex.isSeenUnsupportedTypealias(typedefUsr)) { - // Do not process unsupported typealiases again. - } else if (s is UnimplementedType) { - _logger.fine("Skipped Typedef '$typedefName': " - 'Unimplemented type referred.'); - bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); - } else if (s is Compound && s.originalName == typedefName) { - // Ignore typedef if it refers to a compound with the same original name. - bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); - _logger.fine("Skipped Typedef '$typedefName': " - 'Name matches with referred struct/union.'); - } else if (s is EnumClass) { - // Ignore typedefs to Enum. - bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); - _logger.fine("Skipped Typedef '$typedefName': typedef to enum."); - } else if (s is HandleType) { - // Ignore typedefs to Handle. - _logger.fine("Skipped Typedef '$typedefName': typedef to Dart Handle."); - bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); - } else if (s is ConstantArray || s is IncompleteArray) { - // Ignore typedefs to Constant Array. - _logger.fine("Skipped Typedef '$typedefName': typedef to array."); - bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); - } else if (s is BooleanType) { - // Ignore typedefs to Boolean. - _logger.fine("Skipped Typedef '$typedefName': typedef to bool."); - bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); - } else { - // Create typealias. - return Typealias( - usr: typedefUsr, - originalName: typedefName, - name: config.typedefs.rename(decl), - type: s, - dartDoc: getCursorDocComment(cursor), - ); - } + if (bindingsIndex.isSeenUnsupportedTypealias(typedefUsr)) { + // Do not process unsupported typealiases again. + } else if (s is UnimplementedType) { + _logger.fine("Skipped Typedef '$typedefName': " + 'Unimplemented type referred.'); + bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); + } else if (s is Compound && s.originalName == typedefName) { + // Ignore typedef if it refers to a compound with the same original name. + bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); + _logger.fine("Skipped Typedef '$typedefName': " + 'Name matches with referred struct/union.'); + } else if (s is EnumClass) { + // Ignore typedefs to Enum. + bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); + _logger.fine("Skipped Typedef '$typedefName': typedef to enum."); + } else if (s is HandleType) { + // Ignore typedefs to Handle. + _logger.fine("Skipped Typedef '$typedefName': typedef to Dart Handle."); + bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); + } else if (s is ConstantArray || s is IncompleteArray) { + // Ignore typedefs to Constant Array. + _logger.fine("Skipped Typedef '$typedefName': typedef to array."); + bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); + } else if (s is BooleanType) { + // Ignore typedefs to Boolean. + _logger.fine("Skipped Typedef '$typedefName': typedef to bool."); + bindingsIndex.addUnsupportedTypealiasToSeen(typedefUsr); + } else { + // Create typealias. + return Typealias( + usr: typedefUsr, + originalName: typedefName, + name: config.typedefs.rename(decl), + type: s, + dartDoc: getCursorDocComment(cursor), + ); } return null; } diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart index e2ac4cb89..6b185a319 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart @@ -8,7 +8,6 @@ import '../../code_generator.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; import 'api_availability.dart'; @@ -23,12 +22,9 @@ List saveUnNamedEnum(clang_types.CXCursor cursor) { .finest(' unnamedenumCursorVisitor: ${child.completeStringRepr()}'); switch (clang.clang_getCursorKind(child)) { case clang_types.CXCursorKind.CXCursor_EnumConstantDecl: - if (shouldIncludeUnnamedEnumConstant( - Declaration(usr: child.usr(), originalName: child.spelling()))) { - final value = _addUnNamedEnumConstant(child); - if (value != null) { - addedConstants.add(value); - } + final value = _addUnNamedEnumConstant(child); + if (value != null) { + addedConstants.add(value); } break; case clang_types.CXCursorKind.CXCursor_UnexposedAttr: @@ -55,7 +51,7 @@ Constant? _addUnNamedEnumConstant(clang_types.CXCursor cursor) { _logger.fine( '++++ Adding Constant from unnamed enum: ${cursor.completeStringRepr()}'); - final constant = Constant( + final constant = UnnamedEnumConstant( usr: cursor.usr(), originalName: cursor.spelling(), name: config.unnamedEnumConstants.rename( diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/var_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/var_parser.dart index d1e61ebf1..1b4932d6c 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/var_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/var_parser.dart @@ -8,7 +8,6 @@ import '../../code_generator.dart'; import '../../config_provider/config_types.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../data.dart'; -import '../includer.dart'; import '../utils.dart'; final _logger = Logger('ffigen.header_parser.var_parser'); @@ -21,9 +20,6 @@ Global? parseVarDeclaration(clang_types.CXCursor cursor) { return bindingsIndex.getSeenGlobalVar(usr); } final decl = Declaration(usr: usr, originalName: name); - if (!shouldIncludeGlobalVar(decl)) { - return null; - } _logger.fine('++++ Adding Global: ${cursor.completeStringRepr()}'); diff --git a/pkgs/ffigen/lib/src/header_parser/translation_unit_parser.dart b/pkgs/ffigen/lib/src/header_parser/translation_unit_parser.dart index 3e7645534..f3db50e43 100644 --- a/pkgs/ffigen/lib/src/header_parser/translation_unit_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/translation_unit_parser.dart @@ -7,12 +7,10 @@ import 'package:logging/logging.dart'; import '../code_generator.dart'; import 'clang_bindings/clang_bindings.dart' as clang_types; import 'data.dart'; -import 'includer.dart'; import 'sub_parsers/functiondecl_parser.dart'; import 'sub_parsers/macro_parser.dart'; -import 'sub_parsers/objcinterfacedecl_parser.dart'; +import 'sub_parsers/objccategorydecl_parser.dart'; import 'sub_parsers/objcprotocoldecl_parser.dart'; -import 'sub_parsers/typedefdecl_parser.dart'; import 'sub_parsers/var_parser.dart'; import 'type_extractor/extractor.dart'; import 'utils.dart'; @@ -35,6 +33,7 @@ Set parseTranslationUnit(clang_types.CXCursor translationUnitCursor) { case clang_types.CXCursorKind.CXCursor_UnionDecl: case clang_types.CXCursorKind.CXCursor_EnumDecl: case clang_types.CXCursorKind.CXCursor_ObjCInterfaceDecl: + case clang_types.CXCursorKind.CXCursor_TypedefDecl: addToBindings(bindings, _getCodeGenTypeFromCursor(cursor)); break; case clang_types.CXCursorKind.CXCursor_ObjCCategoryDecl: @@ -49,11 +48,6 @@ Set parseTranslationUnit(clang_types.CXCursor translationUnitCursor) { case clang_types.CXCursorKind.CXCursor_VarDecl: addToBindings(bindings, parseVarDeclaration(cursor)); break; - case clang_types.CXCursorKind.CXCursor_TypedefDecl: - if (config.includeUnusedTypedefs) { - addToBindings(bindings, parseTypedefDeclaration(cursor)); - } - break; default: _logger.finer('rootCursorVisitor: CursorKind not implemented'); } @@ -80,7 +74,7 @@ void addToBindings(Set bindings, Binding? b) { } BindingType? _getCodeGenTypeFromCursor(clang_types.CXCursor cursor) { - final t = getCodeGenType(cursor.type(), ignoreFilter: false); + final t = getCodeGenType(cursor.type()); return t is BindingType ? t : null; } @@ -96,3 +90,20 @@ void buildUsrCursorDefinitionMap(clang_types.CXCursor translationUnitCursor) { } }); } + +/// True if a cursor should be included based on headers config, used on root +/// declarations. +bool shouldIncludeRootCursor(String sourceFile) { + // Handle empty string in case of system headers or macros. + if (sourceFile.isEmpty) { + return false; + } + + // Add header to seen if it's not. + if (!bindingsIndex.isSeenHeader(sourceFile)) { + bindingsIndex.addHeaderToSeen( + sourceFile, config.shouldIncludeHeader(Uri.file(sourceFile))); + } + + return bindingsIndex.getSeenHeaderStatus(sourceFile)!; +} diff --git a/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart b/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart index 14885cf03..42743fdfd 100644 --- a/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart +++ b/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart @@ -29,10 +29,6 @@ const maxRecursionDepth = 5; /// Converts cxtype to a typestring code_generator can accept. Type getCodeGenType( clang_types.CXType cxtype, { - /// Option to ignore declaration filter (Useful in case of extracting - /// declarations when they are passed/returned by an included function.) - bool ignoreFilter = true, - /// Passed on if a value was marked as a pointer before this one. bool pointerReference = false, @@ -46,7 +42,7 @@ Type getCodeGenType( // Special case: Elaborated types just refer to another type. if (cxtype.kind == clang_types.CXTypeKind.CXType_Elaborated) { return getCodeGenType(clang.clang_Type_getNamedType(cxtype), - ignoreFilter: ignoreFilter, pointerReference: pointerReference); + pointerReference: pointerReference); } // These basic Objective C types skip the cache, and are conditional on the @@ -55,8 +51,7 @@ Type getCodeGenType( switch (cxtype.kind) { case clang_types.CXTypeKind.CXType_ObjCObjectPointer: final pt = clang.clang_getPointeeType(cxtype); - final s = getCodeGenType(pt, - ignoreFilter: ignoreFilter, pointerReference: true); + final s = getCodeGenType(pt, pointerReference: true); if (s is ObjCInterface) { return s; } @@ -79,8 +74,7 @@ Type getCodeGenType( final usr = cursor.usr(); var type = bindingsIndex.getSeenType(usr); if (type == null) { - final result = - _createTypeFromCursor(cxtype, cursor, ignoreFilter, pointerReference); + final result = _createTypeFromCursor(cxtype, cursor, pointerReference); type = result.type; if (type == null) { return UnimplementedType('${cxtype.kindSpelling()} not implemented'); @@ -89,7 +83,7 @@ Type getCodeGenType( bindingsIndex.addTypeToSeen(usr, type); } } - _fillFromCursorIfNeeded(type, cursor, ignoreFilter, pointerReference); + _fillFromCursorIfNeeded(type, cursor, pointerReference); return type; } @@ -144,7 +138,6 @@ Type getCodeGenType( case clang_types.CXTypeKind.CXType_Unexposed: final innerType = getCodeGenType( clang.clang_Type_getModifiedType(cxtype), - ignoreFilter: ignoreFilter, originalCursor: originalCursor, ); final isNullable = clang.clang_Type_getNullability(cxtype) == @@ -186,7 +179,7 @@ class _CreateTypeFromCursorResult { } _CreateTypeFromCursorResult _createTypeFromCursor(clang_types.CXType cxtype, - clang_types.CXCursor cursor, bool ignoreFilter, bool pointerReference) { + clang_types.CXCursor cursor, bool pointerReference) { switch (cxtype.kind) { case clang_types.CXTypeKind.CXType_Typedef: final spelling = clang.clang_getTypedefName(cxtype).toStringAndDispose(); @@ -234,11 +227,10 @@ _CreateTypeFromCursorResult _createTypeFromCursor(clang_types.CXType cxtype, } case clang_types.CXTypeKind.CXType_Record: return _CreateTypeFromCursorResult( - _extractfromRecord(cxtype, cursor, ignoreFilter, pointerReference)); + _extractfromRecord(cxtype, cursor, pointerReference)); case clang_types.CXTypeKind.CXType_Enum: final (enumClass, nativeType) = parseEnumDeclaration( cursor, - ignoreFilter: ignoreFilter, ); if (enumClass == null) { // Handle anonymous enum declarations within another declaration. @@ -247,8 +239,7 @@ _CreateTypeFromCursorResult _createTypeFromCursor(clang_types.CXType cxtype, return _CreateTypeFromCursorResult(enumClass); } case clang_types.CXTypeKind.CXType_ObjCInterface: - return _CreateTypeFromCursorResult( - parseObjCInterfaceDeclaration(cursor, ignoreFilter: ignoreFilter)); + return _CreateTypeFromCursorResult(parseObjCInterfaceDeclaration(cursor)); default: return _CreateTypeFromCursorResult( UnimplementedType('Unknown type: ${cxtype.completeStringRepr()}'), @@ -256,19 +247,19 @@ _CreateTypeFromCursorResult _createTypeFromCursor(clang_types.CXType cxtype, } } -void _fillFromCursorIfNeeded(Type? type, clang_types.CXCursor cursor, - bool ignoreFilter, bool pointerReference) { +void _fillFromCursorIfNeeded( + Type? type, clang_types.CXCursor cursor, bool pointerReference) { if (type == null) return; if (type is Compound) { fillCompoundMembersIfNeeded(type, cursor, - ignoreFilter: ignoreFilter, pointerReference: pointerReference); + pointerReference: pointerReference); } else if (type is ObjCInterface) { fillObjCInterfaceMethodsIfNeeded(type, cursor); } } Type? _extractfromRecord(clang_types.CXType cxtype, clang_types.CXCursor cursor, - bool ignoreFilter, bool pointerReference) { + bool pointerReference) { _logger.fine('${_padding}_extractfromRecord: ${cursor.completeStringRepr()}'); final cursorKind = clang.clang_getCursorKind(cursor); @@ -305,7 +296,6 @@ Type? _extractfromRecord(clang_types.CXType cxtype, clang_types.CXCursor cursor, final struct = parseCompoundDeclaration( cursor, compoundType, - ignoreFilter: ignoreFilter, pointerReference: pointerReference, ); return struct; diff --git a/pkgs/ffigen/lib/src/header_parser/utils.dart b/pkgs/ffigen/lib/src/header_parser/utils.dart index 52fff376e..42b22663c 100644 --- a/pkgs/ffigen/lib/src/header_parser/utils.dart +++ b/pkgs/ffigen/lib/src/header_parser/utils.dart @@ -456,6 +456,7 @@ class BindingsIndex { final Map _globals = {}; final Map _objcBlocks = {}; final Map _objcProtocols = {}; + final Map _objcCategories = {}; /// Contains usr for typedefs which cannot be generated. final Set _unsupportedTypealiases = {}; @@ -495,6 +496,10 @@ class BindingsIndex { _objcProtocols[usr] = t; ObjCProtocol? getSeenObjCProtocol(String usr) => _objcProtocols[usr]; bool isSeenObjCProtocol(String usr) => _objcProtocols.containsKey(usr); + void addObjCCategoryToSeen(String usr, ObjCCategory t) => + _objcCategories[usr] = t; + ObjCCategory? getSeenObjCCategory(String usr) => _objcCategories[usr]; + bool isSeenObjCCategory(String usr) => _objcCategories.containsKey(usr); } class CursorIndex { diff --git a/pkgs/ffigen/lib/src/strings.dart b/pkgs/ffigen/lib/src/strings.dart index 112217f85..c6e1c65aa 100644 --- a/pkgs/ffigen/lib/src/strings.dart +++ b/pkgs/ffigen/lib/src/strings.dart @@ -78,9 +78,13 @@ const macros = 'macros'; const typedefs = 'typedefs'; const objcInterfaces = 'objc-interfaces'; const objcProtocols = 'objc-protocols'; +const objcCategories = 'objc-categories'; const excludeAllByDefault = 'exclude-all-by-default'; const includeUnusedTypedefs = 'include-unused-typedefs'; +const includeTransitiveObjCInterfaces = 'include-transitive-objc-interfaces'; +const includeTransitiveObjCProtocols = 'include-transitive-objc-protocols'; +const includeTransitiveObjCCategories = 'include-transitive-objc-categories'; const generateForPackageObjectiveC = 'generate-for-package-objective-c'; // Sub-fields of Declarations. @@ -166,6 +170,7 @@ const formatVersion = 'format_version'; const symbolFileFormatVersion = '1.0.0'; const files = 'files'; const usedConfig = 'used-config'; +const dartName = 'dart-name'; const import = 'import'; const defaultSymbolFileImportPrefix = 'imp'; diff --git a/pkgs/ffigen/lib/src/visitor/apply_config_filters.dart b/pkgs/ffigen/lib/src/visitor/apply_config_filters.dart new file mode 100644 index 000000000..6903bf2ed --- /dev/null +++ b/pkgs/ffigen/lib/src/visitor/apply_config_filters.dart @@ -0,0 +1,87 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../code_generator.dart'; +import '../config_provider/config.dart' show Config, DeclarationFilters; + +import 'ast.dart'; + +class ApplyConfigFiltersVisitation extends Visitation { + final Config config; + final _directlyIncluded = {}; + final _superTypes = {}; + ApplyConfigFiltersVisitation(this.config); + + Set get included => _directlyIncluded.union(_superTypes); + + void _visitImpl(Binding node, DeclarationFilters filters) { + node.visitChildren(visitor); + if (node.originalName == '') return; + if (config.usrTypeMappings.containsKey(node.usr)) return; + if (filters.shouldInclude(node)) _directlyIncluded.add(node); + } + + @override + void visitStruct(Struct node) => _visitImpl(node, config.structDecl); + + @override + void visitUnion(Union node) => _visitImpl(node, config.unionDecl); + + @override + void visitEnumClass(EnumClass node) => _visitImpl(node, config.enumClassDecl); + + @override + void visitFunc(Func node) => _visitImpl(node, config.functionDecl); + + @override + void visitMacroConstant(MacroConstant node) => + _visitImpl(node, config.macroDecl); + + @override + void visitObjCInterface(ObjCInterface node) { + node.filterMethods( + (m) => config.objcInterfaces.shouldIncludeMember(node, m.originalName)); + _visitImpl(node, config.objcInterfaces); + + // If this node is included, include all its super types. + if (_directlyIncluded.contains(node)) { + for (ObjCInterface? t = node; t != null; t = t.superType) { + if (!_superTypes.add(t)) break; + } + } + } + + @override + void visitObjCCategory(ObjCCategory node) { + node.filterMethods((m) { + if (node.shouldCopyMethodToInterface(m)) return false; + return config.objcCategories.shouldIncludeMember(node, m.originalName); + }); + _visitImpl(node, config.objcCategories); + } + + @override + void visitObjCProtocol(ObjCProtocol node) { + node.filterMethods((m) { + // TODO(https://github.com/dart-lang/native/issues/1149): Support class + // methods on protocols if there's a use case. For now filter them. We + // filter here instead of during parsing so that these methods are still + // copied to any interfaces that implement the protocol. + if (m.isClassMethod) return false; + + return config.objcProtocols.shouldIncludeMember(node, m.originalName); + }); + _visitImpl(node, config.objcProtocols); + } + + @override + void visitUnnamedEnumConstant(UnnamedEnumConstant node) => + _visitImpl(node, config.unnamedEnumConstants); + + @override + void visitGlobal(Global node) => _visitImpl(node, config.globals); + + @override + void visitTypealias(Typealias node) => _visitImpl(node, config.typedefs); +} diff --git a/pkgs/ffigen/lib/src/visitor/copy_methods_from_super_type.dart b/pkgs/ffigen/lib/src/visitor/copy_methods_from_super_type.dart index 6d1e20aeb..91a2ce11e 100644 --- a/pkgs/ffigen/lib/src/visitor/copy_methods_from_super_type.dart +++ b/pkgs/ffigen/lib/src/visitor/copy_methods_from_super_type.dart @@ -59,23 +59,50 @@ class CopyMethodsFromSuperTypesVisitation extends Visitation { } } - for (final proto in node.protocols) { + // Copy all methods from all the interface's protocols. + _copyMethodFromProtocols(node, node.protocols, node.addMethod); + + // Copy methods from all the categories that extend this interface, if those + // methods return instancetype, because the Dart inheritance rules don't + // match the ObjC rules regarding instancetype. + // Also copy all methods from any anonymous categories. + // NOTE: The methods are copied regardless of whether the category is + // included by the config filters, since this method copying visit happens + // before the filtering visit. This is technically a bug, but it's unlikely + // to bother anyone, and the fix would be complicated. So we'll ignore it + // for now. + for (final category in node.categories) { + for (final m in category.methods) { + if (category.shouldCopyMethodToInterface(m)) { + node.addMethod(m); + } + } + } + } + + void _copyMethodFromProtocols(Binding node, List protocols, + void Function(ObjCMethod) addMethod) { + // Copy all methods from all the protocols. + final isNSObject = ObjCBuiltInFunctions.isNSObject(node.originalName); + for (final proto in protocols) { for (final m in proto.methods) { if (isNSObject) { - if (m.originalName == 'description' || m.originalName == 'hash') { - // TODO(https://github.com/dart-lang/native/issues/1220): Remove - // this special case. These methods only clash because they're - // sometimes declared as getters and sometimes as normal methods. - } else { - node.addMethod(m); - } + addMethod(m); } else if (!_excludedNSObjectMethods.contains(m.originalName)) { - node.addMethod(m); + addMethod(m); } } } } + @override + void visitObjCCategory(ObjCCategory node) { + node.visitChildren(visitor); + + // Copy all methods from all the category's protocols. + _copyMethodFromProtocols(node, node.protocols, node.addMethod); + } + @override void visitObjCProtocol(ObjCProtocol node) { node.visitChildren(visitor); diff --git a/pkgs/ffigen/lib/src/visitor/fill_method_dependencies.dart b/pkgs/ffigen/lib/src/visitor/fill_method_dependencies.dart index e61ad2284..03481625d 100644 --- a/pkgs/ffigen/lib/src/visitor/fill_method_dependencies.dart +++ b/pkgs/ffigen/lib/src/visitor/fill_method_dependencies.dart @@ -16,6 +16,15 @@ class FillMethodDependenciesVisitation extends Visitation { } } + @override + void visitObjCCategory(ObjCCategory node) { + node.visitChildren(visitor); + + for (final method in node.methods) { + method.fillMsgSend(); + } + } + @override void visitObjCProtocol(ObjCProtocol node) { node.visitChildren(visitor); diff --git a/pkgs/ffigen/lib/src/visitor/find_transitive_deps.dart b/pkgs/ffigen/lib/src/visitor/find_transitive_deps.dart new file mode 100644 index 000000000..e9bc98e5d --- /dev/null +++ b/pkgs/ffigen/lib/src/visitor/find_transitive_deps.dart @@ -0,0 +1,60 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../code_generator.dart'; +import '../config_provider/config.dart' show Config; + +import 'ast.dart'; + +class FindTransitiveDepsVisitation extends Visitation { + final transitives = {}; + + @override + void visitBinding(Binding node) { + if (node.isObjCImport) return; + node.visitChildren(visitor); + transitives.add(node); + } +} + +class FindDirectTransitiveDepsVisitation extends Visitation { + final Config config; + final Set includes; + final directTransitives = {}; + + FindDirectTransitiveDepsVisitation(this.config, this.includes); + + void _visitImpl(Binding node, bool forceVisitChildren) { + if (node.isObjCImport) return; + directTransitives.add(node); + if (forceVisitChildren || includes.contains(node)) { + node.visitChildren(visitor); + } + } + + @override + void visitObjCInterface(ObjCInterface node) { + _visitImpl(node, config.includeTransitiveObjCInterfaces); + + // Always visit the super type, regardless of whether the node is directly + // included. This ensures that super types of stubs are also stubs, rather + // than being omitted like the rest of the stub's children. + visitor.visit(node.superType); + } + + @override + void visitObjCCategory(ObjCCategory node) { + _visitImpl(node, config.includeTransitiveObjCCategories); + + // Same as visitObjCInterface's visit of superType. + visitor.visit(node.parent); + } + + @override + void visitObjCProtocol(ObjCProtocol node) => + _visitImpl(node, config.includeTransitiveObjCInterfaces); + + @override + void visitBinding(Binding node) => _visitImpl(node, true); +} diff --git a/pkgs/ffigen/lib/src/visitor/fix_overridden_methods.dart b/pkgs/ffigen/lib/src/visitor/fix_overridden_methods.dart index c3f3d0bd1..62914e53f 100644 --- a/pkgs/ffigen/lib/src/visitor/fix_overridden_methods.dart +++ b/pkgs/ffigen/lib/src/visitor/fix_overridden_methods.dart @@ -2,43 +2,165 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:logging/logging.dart'; + import '../code_generator.dart'; import 'ast.dart'; +final _logger = Logger('ffigen.visitor.FixOverriddenMethodsVisitation'); + class FixOverriddenMethodsVisitation extends Visitation { @override void visitObjCInterface(ObjCInterface node) { + // Visit the supertype, then perform all AST mutations, then visit the other + // children. That way we can be sure that the supertype's AST mutations have + // been completed before this node's mutations (this is important for + // _fixContravariantReturns). + visitor.visit(node.superType); + + _fixMethodVariance(node); + _fixMethodsVsProperties(node); + node.visitChildren(visitor); + } - // ObjC ignores nullability when deciding if an override for an inherited - // method is valid. But in Dart it's invalid to override a method and change - // it's return type from non-null to nullable, or its arg type from nullable - // to non-null. So in these cases we have to make the non-null type - // nullable, to avoid Dart compile errors. + (ObjCInterface?, ObjCMethod?) _findNearestWithMethod( + ObjCInterface node, ObjCMethod method) { for (var t = node.superType; t != null; t = t.superType) { - for (final method in node.methods) { - final superMethod = t.getMethod(method.originalName); - if (superMethod != null && - !superMethod.isClassMethod && - !method.isClassMethod) { - if (superMethod.returnType.typealiasType is! ObjCNullable && - method.returnType.typealiasType is ObjCNullable) { - superMethod.returnType = ObjCNullable(superMethod.returnType); - } - final numArgs = method.params.length < superMethod.params.length - ? method.params.length - : superMethod.params.length; - for (var i = 0; i < numArgs; ++i) { - final param = method.params[i]; - final superParam = superMethod.params[i]; - if (superParam.type.typealiasType is ObjCNullable && - param.type.typealiasType is! ObjCNullable) { - param.type = ObjCNullable(param.type); - } - } - } + final tMethod = t.getSimilarMethod(method); + if (tMethod != null) { + return (t, tMethod); + } + } + return (null, null); + } + + void _fixContravariantReturns(ObjCInterface node, ObjCMethod method, + ObjCInterface superType, ObjCMethod superMethod) { + // In Dart, method return types are covariant, but ObjC allows them to be + // contravariant. So fix these cases by changing the supertype's return type + // to match the subtype's return type. + + if (method.returnType.isSubtypeOf(superMethod.returnType)) { + // Covariant return, nothing to fix. + return; + } + + if (!superMethod.returnType.isSubtypeOf(method.returnType)) { + // Types are unrelated, so this can't be sensibly fixed. + _logger.severe( + '${node.originalName} is a subtype of ${superType.originalName} but ' + 'the return types of their ${method.originalName} methods are ' + 'unrelated'); + return; + } + + superMethod.returnType = method.returnType; + _logger.info('Changed the return type of ' + '${superType.originalName}.${superMethod.originalName} to ' + '${method.returnType} to match ${node.originalName}'); + + final (superSuperType, superSuperMethod) = + _findNearestWithMethod(superType, superMethod); + if (superSuperType != null && superSuperMethod != null) { + _fixContravariantReturns(node, method, superSuperType, superSuperMethod); + } + } + + void _fixCoavariantArgs(ObjCInterface node, ObjCMethod method, + ObjCInterface superType, ObjCMethod superMethod) { + // In Dart, method arg types are contravariant, but ObjC allows them to be + // covariant. So fix these cases by adding the `covariant` keyword to the + // parameter. + final n = method.params.length; + if (n != superMethod.params.length) { + _logger.severe( + '${node.originalName} is a subtype of ${superType.originalName} but ' + 'their ${method.originalName} methods have a different number of ' + 'parameters'); + return; + } + + for (var i = 0; i < n; ++i) { + final pt = method.params[i].type; + final st = superMethod.params[i].type; + + if (st.isSubtypeOf(pt)) { + // Contravariant param, nothing to fix. + continue; + } + + if (!pt.isSubtypeOf(st)) { + // Types are unrelated, so this can't be sensibly fixed. + _logger.severe( + '${node.originalName} is a subtype of ${superType.originalName} ' + 'but their ${method.originalName} methods have a parameter at ' + 'position ${i + 1} with an unrelated type'); + return; + } + + _logger.info('Set the parameter of ' + '${node.originalName}.${method.originalName} at position ${i + 1} to ' + 'be covariant'); + method.params[i].isCovariant = true; + } + } + + void _fixMethodVariance(ObjCInterface node) { + for (final method in node.methods) { + if (method.isClassMethod) continue; + final (superType, superMethod) = _findNearestWithMethod(node, method); + if (superType != null && superMethod != null) { + _fixContravariantReturns(node, method, superType, superMethod); + _fixCoavariantArgs(node, method, superType, superMethod); + } + } + } + + void _fixMethodsVsProperties(ObjCInterface node) { + // In ObjC, supertypes and subtypes can have a method that's an ordinary + // method in some classes of the heirarchy, and a property in others. This + // isn't allowed in Dart, so we change all such conflicts to properties. + // This change could cause more conflicts in the heirarchy, so first we walk + // up to find the root of the subtree that has this method, then we walk + // down the subtree to change all conflicting methods to properties. + for (final method in node.methods) { + if (method.isClassMethod) continue; + final (root, rootMethod) = _findRootWithMethod(node, method); + // If method and rootMethod are the same kind, then there's nothing to do. + if ((method.kind == ObjCMethodKind.propertyGetter) == + (rootMethod.kind == ObjCMethodKind.propertyGetter)) { + continue; + } + _convertAllSubtreeMethodsToProperties(root, rootMethod); + } + } + + (ObjCInterface, ObjCMethod) _findRootWithMethod( + ObjCInterface node, ObjCMethod method) { + var root = node; + var rootMethod = method; + for (ObjCInterface? t = node; t != null; t = t.superType) { + final tMethod = t.getSimilarMethod(method); + if (tMethod != null) { + root = t; + rootMethod = tMethod; } } + return (root, rootMethod); + } + + void _convertAllSubtreeMethodsToProperties( + ObjCInterface node, ObjCMethod rootMethod) { + final method = node.getSimilarMethod(rootMethod); + if (method != null && method.kind == ObjCMethodKind.method) { + method.kind = ObjCMethodKind.propertyGetter; + _logger.info( + 'Converted ${node.originalName}.${method.originalName} to a getter'); + } + for (final t in node.subtypes) { + _convertAllSubtreeMethodsToProperties(t, rootMethod); + } } } diff --git a/pkgs/ffigen/lib/src/visitor/list_bindings.dart b/pkgs/ffigen/lib/src/visitor/list_bindings.dart index 18bc21274..c278f6891 100644 --- a/pkgs/ffigen/lib/src/visitor/list_bindings.dart +++ b/pkgs/ffigen/lib/src/visitor/list_bindings.dart @@ -3,20 +3,117 @@ // BSD-style license that can be found in the LICENSE file. import '../code_generator.dart'; +import '../config_provider/config.dart' show Config; +import '../config_provider/config_types.dart' show Language; +import '../strings.dart' as strings; import 'ast.dart'; +enum _IncludeBehavior { + configOnly, + configOrTransitive, + configAndTransitive, + configOrDirectTransitive, +} + class ListBindingsVisitation extends Visitation { - final bindings = []; + final Config config; + final Set includes; + final Set transitives; + final Set directTransitives; + final bindings = {}; + + ListBindingsVisitation( + this.config, this.includes, this.transitives, this.directTransitives); + + void _add(Binding node) { + node.visitChildren(visitor); + bindings.add(node); + } + + bool _shouldInclude(Binding node, _IncludeBehavior behavior) { + if (node.isObjCImport) return false; + switch (behavior) { + case _IncludeBehavior.configOnly: + return includes.contains(node); + case _IncludeBehavior.configOrTransitive: + return includes.contains(node) || transitives.contains(node); + case _IncludeBehavior.configAndTransitive: + return includes.contains(node) && transitives.contains(node); + case _IncludeBehavior.configOrDirectTransitive: + return includes.contains(node) || directTransitives.contains(node); + } + } + + bool _visitImpl(Binding node, _IncludeBehavior behavior) { + if (_shouldInclude(node, behavior)) { + _add(node); + return true; + } + return false; + } + + @override + void visitBinding(Binding node) => + _visitImpl(node, _IncludeBehavior.configOrTransitive); @override - void visitNoLookUpBinding(NoLookUpBinding node) { - if (!node.isObjCImport) visitBinding(node); + void visitObjCInterface(ObjCInterface node) { + if (!_visitImpl( + node, + config.includeTransitiveObjCInterfaces + ? _IncludeBehavior.configOrTransitive + : _IncludeBehavior.configOnly) && + directTransitives.contains(node)) { + node.generateAsStub = true; + bindings.add(node); + } } + @override + void visitObjCCategory(ObjCCategory node) => _visitImpl( + node, + config.includeTransitiveObjCCategories + ? _IncludeBehavior.configOrDirectTransitive + : _IncludeBehavior.configOnly); + + @override + void visitObjCProtocol(ObjCProtocol node) => _visitImpl( + node, + config.includeTransitiveObjCProtocols + ? _IncludeBehavior.configOrTransitive + : _IncludeBehavior.configOnly); + + @override + void visitTypealias(Typealias node) { + _visitImpl( + node, + config.includeUnusedTypedefs + ? _IncludeBehavior.configOnly + : _IncludeBehavior.configAndTransitive); + + // Objective C has some core typedefs that are important to keep. + if (config.language == Language.objc && + node.originalName == strings.objcInstanceType) { + _add(node); + } + + // Visit typealias children if it's transitively referenced, regardless of + // whether the typealias itself is included by the config. + if (transitives.contains(node)) { + node.visitChildren(visitor); + } + } +} + +class MarkBindingsVisitation extends Visitation { + final Set bindings; + + MarkBindingsVisitation(this.bindings); + @override void visitBinding(Binding node) { node.visitChildren(visitor); - bindings.add(node); + node.generateBindings = bindings.contains(node); } } diff --git a/pkgs/ffigen/lib/src/visitor/opaque_compounds.dart b/pkgs/ffigen/lib/src/visitor/opaque_compounds.dart new file mode 100644 index 000000000..2dfcdd56f --- /dev/null +++ b/pkgs/ffigen/lib/src/visitor/opaque_compounds.dart @@ -0,0 +1,63 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../code_generator.dart'; +import '../config_provider/config.dart' show Config; +import '../config_provider/config_types.dart' show CompoundDependencies; + +import 'ast.dart'; + +class FindByValueCompoundsVisitation extends Visitation { + // Set of [Compounds] that are either directly included, or referred to by + // value (ie not by pointer). + final byValueCompounds = {}; + + @override + void visitCompound(Compound node) { + node.visitChildren(visitor); + byValueCompounds.add(node); + } + + @override + void visitPointerType(PointerType node) { + if (node.child.typealiasType is Compound) { + // Don't visit compounds through pointers. We're only interested in + // compounds that are referred to by value. + } else { + node.visitChildren(visitor); + } + } + + // If a node is only referred to by value through a directly included + // typealias, that doesn't count as by-value. The best way to implement this + // logic is to just exclude typealiases from the root set. + static Iterable rootNodes(Iterable included) => + included.where((n) => n is! Typealias); +} + +class ClearOpaqueCompoundMembersVisitation extends Visitation { + final Config config; + final Set byValueCompounds; + final Set included; + + ClearOpaqueCompoundMembersVisitation( + this.config, this.byValueCompounds, this.included); + + void _visitImpl(Compound node, CompoundDependencies compondDepsConfig) { + // If a compound isn't referred to by value, isn't explicitly included by + // the config filters, and the config is using opaque deps, convert the + // compound to be opaque by deleting its members. + if (!byValueCompounds.contains(node) && + !included.contains(node) && + compondDepsConfig == CompoundDependencies.opaque) { + node.members.clear(); + } + } + + @override + void visitStruct(Struct node) => _visitImpl(node, config.structDependencies); + + @override + void visitUnion(Union node) => _visitImpl(node, config.unionDependencies); +} diff --git a/pkgs/ffigen/lib/src/visitor/visitor.dart b/pkgs/ffigen/lib/src/visitor/visitor.dart index ef72bdf3c..9fed395ca 100644 --- a/pkgs/ffigen/lib/src/visitor/visitor.dart +++ b/pkgs/ffigen/lib/src/visitor/visitor.dart @@ -2,24 +2,34 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:logging/logging.dart'; + import '../code_generator.dart'; import 'ast.dart'; +final _logger = Logger('ffigen.visitor'); + /// Wrapper around [Visitation] to be used by callers. final class Visitor { - Visitor(this._visitation) { + Visitor(this._visitation, {bool debug = false}) : _debug = debug { _visitation.visitor = this; } final Visitation _visitation; final _seen = {}; + final bool _debug; + int _indentLevel = 0; /// Visits a node. void visit(AstNode? node) { - if (node == null || _seen.contains(node)) return; - _seen.add(node); - node.visit(_visitation); + if (node == null) return; + if (_debug) _logger.info('${' ' * _indentLevel++}$node'); + if (!_seen.contains(node)) { + _seen.add(node); + node.visit(_visitation); + } + if (_debug) --_indentLevel; } /// Helper method for visiting an iterable of nodes. @@ -60,7 +70,26 @@ abstract class Visitation { void visitLibraryImport(NoLookUpBinding node) => visitBinding(node); void visitObjCInterface(ObjCInterface node) => visitBindingType(node); void visitObjCProtocol(ObjCProtocol node) => visitNoLookUpBinding(node); + void visitObjCCategory(ObjCCategory node) => visitNoLookUpBinding(node); + void visitStruct(Struct node) => visitCompound(node); + void visitUnion(Union node) => visitCompound(node); + void visitCompound(Compound node) => visitBindingType(node); + void visitEnumClass(EnumClass node) => visitBindingType(node); + void visitFunc(Func node) => visitLookUpBinding(node); + void visitMacroConstant(MacroConstant node) => visitConstant(node); + void visitUnnamedEnumConstant(UnnamedEnumConstant node) => + visitConstant(node); + void visitConstant(Constant node) => visitNoLookUpBinding(node); + void visitGlobal(Global node) => visitLookUpBinding(node); + void visitTypealias(Typealias node) => visitBindingType(node); + void visitPointerType(PointerType node) => visitType(node); /// Default behavior for all visit methods. void visitAstNode(AstNode node) => node..visitChildren(visitor); } + +T visit(T visitation, Iterable roots, + {bool debug = false}) { + Visitor(visitation, debug: debug).visitAll(roots); + return visitation; +} diff --git a/pkgs/ffigen/pubspec.yaml b/pkgs/ffigen/pubspec.yaml index 4d3ebe3c2..0ae4f98b9 100644 --- a/pkgs/ffigen/pubspec.yaml +++ b/pkgs/ffigen/pubspec.yaml @@ -3,11 +3,13 @@ # BSD-style license that can be found in the LICENSE file. name: ffigen -version: 15.1.0-wip +version: 16.0.1-wip description: > Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files. repository: https://github.com/dart-lang/native/tree/main/pkgs/ffigen +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Affigen + topics: - interop - ffi @@ -17,9 +19,10 @@ environment: sdk: '>=3.4.0 <4.0.0' dependencies: - args: ^2.0.0 - cli_util: ^0.4.0 + args: ^2.6.0 + cli_util: ^0.4.2 collection: ^1.18.0 + dart_style: ^2.3.7 ffi: ^2.0.1 file: ^7.0.0 glob: ^2.0.0 @@ -34,11 +37,11 @@ dependencies: dev_dependencies: async: ^2.11.0 - coverage: ^1.10.0 + coverage: ^1.11.0 dart_flutter_team_lints: ^2.0.0 json_schema: ^5.1.1 leak_tracker: ^10.0.7 - objective_c: ^3.0.0 + objective_c: ^4.0.0 test: ^1.16.2 dependency_overrides: diff --git a/pkgs/ffigen/test/code_generator_tests/code_generator_test.dart b/pkgs/ffigen/test/code_generator_tests/code_generator_test.dart index 7d8d30dc5..182f8b614 100644 --- a/pkgs/ffigen/test/code_generator_tests/code_generator_test.dart +++ b/pkgs/ffigen/test/code_generator_tests/code_generator_test.dart @@ -655,20 +655,6 @@ void main() { ); _matchLib(library, 'boolean_dartbool'); }); - test('sort bindings', () { - final library = Library( - name: 'Bindings', - header: licenseHeader, - sort: true, - bindings: [ - Func(name: 'b', returnType: NativeType(SupportedNativeType.voidType)), - Func(name: 'a', returnType: NativeType(SupportedNativeType.voidType)), - Struct(name: 'D'), - Struct(name: 'C'), - ], - ); - _matchLib(library, 'sort_bindings'); - }); test('Pack Structs', () { final library = Library( name: 'Bindings', @@ -683,10 +669,10 @@ void main() { Struct(name: 'Pack2', pack: 2, members: [ CompoundMember(name: 'a', type: NativeType(SupportedNativeType.char)), ]), - Struct(name: 'Pack2', pack: 4, members: [ + Struct(name: 'Pack4', pack: 4, members: [ CompoundMember(name: 'a', type: NativeType(SupportedNativeType.char)), ]), - Struct(name: 'Pack2', pack: 8, members: [ + Struct(name: 'Pack8', pack: 8, members: [ CompoundMember(name: 'a', type: NativeType(SupportedNativeType.char)), ]), Struct(name: 'Pack16', pack: 16, members: [ @@ -744,21 +730,21 @@ void main() { _matchLib(library, 'unions'); }); test('Typealias Bindings', () { + final struct2 = Struct( + name: 'Struct2', + members: [CompoundMember(name: 'a', type: doubleType)]); + final struct2Typealias = Typealias(name: 'Struct2Typealias', type: struct2); + final struct3 = Struct(name: 'Struct3'); + final struct3Typealias = Typealias(name: 'Struct3Typealias', type: struct3); final library = Library( name: 'Bindings', header: '$licenseHeader\n// ignore_for_file: non_constant_identifier_names\n', bindings: [ Typealias(name: 'RawUnused', type: Struct(name: 'Struct1')), - Struct(name: 'WithTypealiasStruct', members: [ - CompoundMember( - name: 't', - type: Typealias( - name: 'Struct2Typealias', - type: Struct( - name: 'Struct2', - members: [CompoundMember(name: 'a', type: doubleType)]))) - ]), + Struct( + name: 'WithTypealiasStruct', + members: [CompoundMember(name: 't', type: struct2Typealias)]), Func( name: 'WithTypealiasStruct', returnType: PointerType(NativeFunc(FunctionType( @@ -767,11 +753,14 @@ void main() { parameters: [ Parameter( name: 't', - type: Typealias( - name: 'Struct3Typealias', type: Struct(name: 'Struct3')), + type: struct3Typealias, objCConsumed: false, ) ]), + struct2, + struct2Typealias, + struct3, + struct3Typealias, ], ); _matchLib(library, 'typealias'); diff --git a/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_packed_structs_bindings.dart b/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_packed_structs_bindings.dart index 5c1b17a5b..907fd807e 100644 --- a/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_packed_structs_bindings.dart +++ b/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_packed_structs_bindings.dart @@ -26,13 +26,13 @@ final class Pack2 extends ffi.Struct { } @ffi.Packed(4) -final class Pack21 extends ffi.Struct { +final class Pack4 extends ffi.Struct { @ffi.Uint8() external int a; } @ffi.Packed(8) -final class Pack22 extends ffi.Struct { +final class Pack8 extends ffi.Struct { @ffi.Uint8() external int a; } diff --git a/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_sort_bindings_bindings.dart b/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_sort_bindings_bindings.dart deleted file mode 100644 index 1e9d1dc11..000000000 --- a/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_sort_bindings_bindings.dart +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// AUTO GENERATED FILE, DO NOT EDIT. -// -// Generated by `package:ffigen`. -// ignore_for_file: type=lint -import 'dart:ffi' as ffi; - -class Bindings { - /// Holds the symbol lookup function. - final ffi.Pointer Function(String symbolName) - _lookup; - - /// The symbols are looked up in [dynamicLibrary]. - Bindings(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup; - - /// The symbols are looked up with [lookup]. - Bindings.fromLookup( - ffi.Pointer Function(String symbolName) - lookup) - : _lookup = lookup; - - void a() { - return _a(); - } - - late final _aPtr = _lookup>('a'); - late final _a = _aPtr.asFunction(); - - void b() { - return _b(); - } - - late final _bPtr = _lookup>('b'); - late final _b = _bPtr.asFunction(); -} - -final class C extends ffi.Opaque {} - -final class D extends ffi.Opaque {} diff --git a/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_typealias_bindings.dart b/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_typealias_bindings.dart index 66596bc8d..edde87fb8 100644 --- a/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_typealias_bindings.dart +++ b/pkgs/ffigen/test/code_generator_tests/expected_bindings/_expected_typealias_bindings.dart @@ -24,27 +24,29 @@ class Bindings { lookup) : _lookup = lookup; - ffi.Pointer> WithTypealiasStruct1( + ffi.Pointer> WithTypealiasStruct( Struct3Typealias t, ) { - return _WithTypealiasStruct1( + return _WithTypealiasStruct( t, ); } - late final _WithTypealiasStruct1Ptr = _lookup< + late final _WithTypealiasStructPtr = _lookup< ffi.NativeFunction< ffi.Pointer> Function( Struct3Typealias)>>('WithTypealiasStruct'); - late final _WithTypealiasStruct1 = _WithTypealiasStruct1Ptr.asFunction< + late final _WithTypealiasStruct = _WithTypealiasStructPtr.asFunction< ffi.Pointer> Function( Struct3Typealias)>(); } -final class Struct1 extends ffi.Opaque {} - typedef RawUnused = Struct1; +final class WithTypealiasStruct extends ffi.Struct { + external Struct2Typealias t; +} + final class Struct2 extends ffi.Struct { @ffi.Double() external double a; @@ -52,10 +54,6 @@ final class Struct2 extends ffi.Struct { typedef Struct2Typealias = Struct2; -final class WithTypealiasStruct extends ffi.Struct { - external Struct2Typealias t; -} - final class Struct3 extends ffi.Opaque {} typedef Struct3Typealias = Struct3; diff --git a/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_decl_collision_bindings.dart b/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_decl_collision_bindings.dart index 4c4c32a28..c045d1c89 100644 --- a/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_decl_collision_bindings.dart +++ b/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_decl_collision_bindings.dart @@ -26,21 +26,21 @@ class Bindings { _lookup>('testFunc'); late final _testFunc = _testFuncPtr.asFunction(); - void testFunc1() { + void testFunc() { return _testFunc1(); } - late final _testFunc1Ptr = + late final _testFuncPtr1 = _lookup>('testFunc'); - late final _testFunc1 = _testFunc1Ptr.asFunction(); + late final _testFunc1 = _testFuncPtr1.asFunction(); - void testCrossDecl1() { - return _testCrossDecl1(); + void testCrossDecl() { + return _testCrossDecl(); } - late final _testCrossDecl1Ptr = + late final _testCrossDeclPtr = _lookup>('testCrossDecl'); - late final _testCrossDecl1 = _testCrossDecl1Ptr.asFunction(); + late final _testCrossDecl = _testCrossDeclPtr.asFunction(); void ffi1() { return _ffi1(); @@ -53,26 +53,28 @@ class Bindings { final class TestStruct extends ffi.Opaque {} -final class TestStruct1 extends ffi.Opaque {} +final class TestStruct extends ffi.Opaque {} sealed class TestEnum {} -sealed class TestEnum1 {} +sealed class TestEnum {} const int Test_Macro = 0; -const int Test_Macro1 = 0; +const int Test_Macro = 0; typedef testAlias = ffi.Void; typedef DarttestAlias = void; +typedef testAlias = ffi.Void; +typedef DarttestAlias1 = void; final class testCrossDecl extends ffi.Opaque {} -const int testCrossDecl2 = 0; +const int testCrossDecl = 0; -sealed class testCrossDecl3 {} +sealed class testCrossDecl {} -typedef testCrossDecl4 = ffi.Void; +typedef testCrossDecl = ffi.Void; typedef DarttestCrossDecl = void; final class ffi extends ffi.Opaque {} diff --git a/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_symbol_address_collision_bindings.dart b/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_symbol_address_collision_bindings.dart index 21ff85188..00908da63 100644 --- a/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_symbol_address_collision_bindings.dart +++ b/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_decl_symbol_address_collision_bindings.dart @@ -55,6 +55,3 @@ final class addresses extends ffi.Opaque {} final class _SymbolAddresses extends ffi.Opaque {} sealed class Bindings {} - -typedef Native_library = ffi.Void Function(); -typedef Dart_library = void Function(); diff --git a/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_reserved_keyword_collision_bindings.dart b/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_reserved_keyword_collision_bindings.dart index 812c8714f..e81e2e326 100644 --- a/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_reserved_keyword_collision_bindings.dart +++ b/pkgs/ffigen/test/collision_tests/expected_bindings/_expected_reserved_keyword_collision_bindings.dart @@ -4,37 +4,30 @@ // ignore_for_file: type=lint import 'dart:ffi' as ffi; -class Bindings { +class NativeLibrary { /// Holds the symbol lookup function. final ffi.Pointer Function(String symbolName) _lookup; /// The symbols are looked up in [dynamicLibrary]. - Bindings(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup; + NativeLibrary(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; /// The symbols are looked up with [lookup]. - Bindings.fromLookup( + NativeLibrary.fromLookup( ffi.Pointer Function(String symbolName) lookup) : _lookup = lookup; - void show1() { - return _show1(); - } - - late final _show1Ptr = - _lookup>('show'); - late final _show1 = _show1Ptr.asFunction(); - void implements1( - int if1, - int abstract1, + int dynamic1, int in1, + int deferred1, ) { return _implements1( - if1, - abstract1, + dynamic1, in1, + deferred1, ); } @@ -43,19 +36,29 @@ class Bindings { 'implements'); late final _implements1 = _implements1Ptr.asFunction(); + + late final ffi.Pointer _import1 = _lookup('import'); + + int get import1 => _import1.value; + + set import1(int value) => _import1.value = value; } final class abstract1 extends ffi.Opaque {} -final class abstract2 extends ffi.Opaque {} +enum export1 { + covariant1(0); -final class if1 extends ffi.Opaque {} + final int value; + const export1(this.value); -sealed class return1 {} - -sealed class export1 {} + static export1 fromValue(int value) => switch (value) { + 0 => covariant1, + _ => throw ArgumentError("Unknown value for export1: $value"), + }; +} -const int else1 = 0; +final class show1 extends ffi.Opaque {} typedef var1 = ffi.Void; typedef Dartvar = void; diff --git a/pkgs/ffigen/test/collision_tests/reserved_keyword_collision.h b/pkgs/ffigen/test/collision_tests/reserved_keyword_collision.h new file mode 100644 index 000000000..1ea919482 --- /dev/null +++ b/pkgs/ffigen/test/collision_tests/reserved_keyword_collision.h @@ -0,0 +1,10 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +struct abstract {}; +union show {}; +enum export { covariant }; +void implements(int dynamic, int in, int deferred) {} +int import = 123; +typedef void var; diff --git a/pkgs/ffigen/test/collision_tests/reserved_keyword_collision_test.dart b/pkgs/ffigen/test/collision_tests/reserved_keyword_collision_test.dart index 7d325ce27..b7cdc5da7 100644 --- a/pkgs/ffigen/test/collision_tests/reserved_keyword_collision_test.dart +++ b/pkgs/ffigen/test/collision_tests/reserved_keyword_collision_test.dart @@ -2,7 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:ffigen/src/code_generator.dart'; +import 'package:ffigen/src/config_provider.dart'; +import 'package:ffigen/src/header_parser.dart' as parser; import 'package:logging/logging.dart'; import 'package:test/test.dart'; @@ -14,41 +15,20 @@ void main() { logWarnings(Level.SEVERE); }); test('reserved keyword collision', () { - final library = Library(name: 'Bindings', bindings: [ - Struct(name: 'abstract'), - Struct(name: 'abstract'), - Struct(name: 'if'), - EnumClass(name: 'return'), - EnumClass(name: 'export'), - Func( - name: 'show', returnType: NativeType(SupportedNativeType.voidType)), - Func( - name: 'implements', - parameters: [ - Parameter( - type: intType, - name: 'if', - objCConsumed: false, - ), - Parameter( - type: intType, - name: 'abstract', - objCConsumed: false, - ), - Parameter( - type: intType, - name: 'in', - objCConsumed: false, - ), - ], - returnType: NativeType(SupportedNativeType.voidType)), - Constant( - name: 'else', - rawType: 'int', - rawValue: '0', - ), - Typealias(name: 'var', type: NativeType(SupportedNativeType.voidType)), - ]); + final library = parser.parse(Config( + output: Uri.file('unused'), + entryPoints: [ + Uri.file('test/collision_tests/reserved_keyword_collision.h') + ], + structDecl: DeclarationFilters.includeAll, + unionDecl: DeclarationFilters.includeAll, + enumClassDecl: DeclarationFilters.includeAll, + functionDecl: DeclarationFilters.includeAll, + globals: DeclarationFilters.includeAll, + typedefs: DeclarationFilters.includeAll, + includeUnusedTypedefs: true, + sort: true, + )); matchLibraryWithExpected( library, 'reserved_keyword_collision_test_output.dart', [ 'test', diff --git a/pkgs/ffigen/test/config_tests/no_cursor_definition_warn_test.dart b/pkgs/ffigen/test/config_tests/no_cursor_definition_warn_test.dart index e8df5daca..28d73a508 100644 --- a/pkgs/ffigen/test/config_tests/no_cursor_definition_warn_test.dart +++ b/pkgs/ffigen/test/config_tests/no_cursor_definition_warn_test.dart @@ -32,9 +32,7 @@ ${strings.structs}: logString = logArr.join('\n'); }); test('No warning for missing cursor definition.', () { - // No warning since C is not included directly. - expect(logString.contains('NoDefinitionStructInC'), false); - // Warning since D is included. + expect(logString.contains('NoDefinitionStructInC'), true); expect(logString.contains('NoDefinitionStructInD'), true); }); }); diff --git a/pkgs/ffigen/test/header_parser_tests/dart_handle_test.dart b/pkgs/ffigen/test/header_parser_tests/dart_handle_test.dart index 497cb50cc..e32957c3d 100644 --- a/pkgs/ffigen/test/header_parser_tests/dart_handle_test.dart +++ b/pkgs/ffigen/test/header_parser_tests/dart_handle_test.dart @@ -22,7 +22,7 @@ void main() { ${strings.name}: 'NativeLibrary' ${strings.description}: 'Dart_Handle Test' ${strings.output}: 'unused' -${strings.compilerOpts}: '-I${path.join(getSdkPath(), "include")}' +${strings.compilerOpts}: '-I${path.join(sdkPath, "include")}' ${strings.headers}: ${strings.entryPoints}: diff --git a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_opaque_dependencies_bindings.dart b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_opaque_dependencies_bindings.dart index 1e11c5a46..ff3d64d34 100644 --- a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_opaque_dependencies_bindings.dart +++ b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_opaque_dependencies_bindings.dart @@ -49,12 +49,12 @@ class NativeLibrary { _func2Ptr.asFunction Function(ffi.Pointer)>(); } +final class A extends ffi.Opaque {} + final class B extends ffi.Opaque {} typedef BAlias = B; -final class A extends ffi.Opaque {} - final class C extends ffi.Opaque {} final class NoDefinitionStructInD extends ffi.Opaque {} @@ -72,10 +72,10 @@ final class E extends ffi.Struct { external D d; } -final class UB extends ffi.Opaque {} - final class UA extends ffi.Opaque {} +final class UB extends ffi.Opaque {} + final class UC extends ffi.Opaque {} final class UD extends ffi.Union { diff --git a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_regress_384_bindings.dart b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_regress_384_bindings.dart index ab9ec8f1c..4b1a42053 100644 --- a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_regress_384_bindings.dart +++ b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_regress_384_bindings.dart @@ -4,7 +4,7 @@ // ignore_for_file: type=lint import 'dart:ffi' as ffi; -/// Regression test for #384 +/// https://github.com/dart-lang/ffigen/issues/384 class NativeLibrary { /// Holds the symbol lookup function. final ffi.Pointer Function(String symbolName) diff --git a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_sort_bindings.dart b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_sort_bindings.dart new file mode 100644 index 000000000..894e6fa55 --- /dev/null +++ b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_sort_bindings.dart @@ -0,0 +1,17 @@ +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint +import 'dart:ffi' as ffi; + +typedef aaaa = ffff; + +final class bbbb extends ffi.Opaque {} + +final class cccc extends ffi.Opaque {} + +final class dddd extends ffi.Opaque {} + +typedef eeee = cccc; + +final class ffff extends ffi.Opaque {} diff --git a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_typedef_bindings.dart b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_typedef_bindings.dart index 4c2b1b372..5e8a16e03 100644 --- a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_typedef_bindings.dart +++ b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_typedef_bindings.dart @@ -136,8 +136,6 @@ enum _NamedEnumInTypedef { }; } -typedef SpecifiedTypeAsIntPtr = ffi.Char; -typedef DartSpecifiedTypeAsIntPtr = int; typedef NestingASpecifiedType = ffi.IntPtr; typedef DartNestingASpecifiedType = int; diff --git a/pkgs/ffigen/test/header_parser_tests/globals_test.dart b/pkgs/ffigen/test/header_parser_tests/globals_test.dart index 9d0a43177..e3efbfceb 100644 --- a/pkgs/ffigen/test/header_parser_tests/globals_test.dart +++ b/pkgs/ffigen/test/header_parser_tests/globals_test.dart @@ -84,6 +84,10 @@ ${strings.ignoreSourceErrors}: true Library expectedLibrary() { final globalStruct = Struct(name: 'EmptyStruct'); + final globalStructAlias = Typealias( + name: 'EmptyStruct_Alias', + type: globalStruct, + ); return Library( name: 'Bindings', bindings: [ @@ -121,12 +125,10 @@ Library expectedLibrary() { type: globalStruct, exposeSymbolAddress: true, ), + globalStructAlias, Global( name: 'globalStruct_from_alias', - type: Typealias( - name: 'EmptyStruct_Alias', - type: globalStruct, - ), + type: globalStructAlias, exposeSymbolAddress: true, ) ], diff --git a/pkgs/ffigen/test/header_parser_tests/nested_parsing_test.dart b/pkgs/ffigen/test/header_parser_tests/nested_parsing_test.dart index b03e15f39..f61590f84 100644 --- a/pkgs/ffigen/test/header_parser_tests/nested_parsing_test.dart +++ b/pkgs/ffigen/test/header_parser_tests/nested_parsing_test.dart @@ -83,10 +83,40 @@ Library expectedLibrary() { type: intType, ), ]); + final unnamedUnion1 = Union( + name: 'UnnamedUnion1', + members: [ + CompoundMember( + name: 'a', + type: floatType, + ), + ], + ); + final unnamedUnion2 = Union( + name: 'UnnamedUnion2', + members: [ + CompoundMember( + name: 'b', + type: floatType, + ), + ], + ); + final unnamedUnion3 = Union( + name: 'UnnamedUnion3', + members: [ + CompoundMember( + name: 'd', + type: floatType, + ), + ], + ); return Library( name: 'Bindings', bindings: [ unnamedInternalStruct, + unnamedUnion1, + unnamedUnion2, + unnamedUnion3, struct2, Struct(name: 'Struct1', members: [ CompoundMember( @@ -117,39 +147,15 @@ Library expectedLibrary() { members: [ CompoundMember( name: '', - type: Union( - name: 'UnnamedUnion1', - members: [ - CompoundMember( - name: 'a', - type: floatType, - ), - ], - ), + type: unnamedUnion1, ), CompoundMember( name: 'c', - type: Union( - name: 'UnnamedUnion2', - members: [ - CompoundMember( - name: 'b', - type: floatType, - ), - ], - ), + type: unnamedUnion2, ), CompoundMember( name: 'e', - type: Union( - name: 'UnnamedUnion3', - members: [ - CompoundMember( - name: 'd', - type: floatType, - ), - ], - ), + type: unnamedUnion3, ), ], ), diff --git a/pkgs/ffigen/test/header_parser_tests/regress_384_test.dart b/pkgs/ffigen/test/header_parser_tests/regress_384_test.dart index b5751d10f..834d02d9f 100644 --- a/pkgs/ffigen/test/header_parser_tests/regress_384_test.dart +++ b/pkgs/ffigen/test/header_parser_tests/regress_384_test.dart @@ -18,7 +18,7 @@ void main() { actual = parser.parse( testConfig(''' ${strings.name}: 'NativeLibrary' -${strings.description}: 'Regression test for #384' +${strings.description}: 'https://github.com/dart-lang/ffigen/issues/384' ${strings.output}: 'unused' ${strings.headers}: ${strings.entryPoints}: diff --git a/pkgs/ffigen/test/header_parser_tests/sort.h b/pkgs/ffigen/test/header_parser_tests/sort.h new file mode 100644 index 000000000..f17227d9d --- /dev/null +++ b/pkgs/ffigen/test/header_parser_tests/sort.h @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +union dddd {}; +typedef union ffff {} aaaa; +struct cccc {}; +typedef struct cccc eeee; +struct bbbb {}; diff --git a/pkgs/ffigen/test/header_parser_tests/sort_test.dart b/pkgs/ffigen/test/header_parser_tests/sort_test.dart new file mode 100644 index 000000000..933103624 --- /dev/null +++ b/pkgs/ffigen/test/header_parser_tests/sort_test.dart @@ -0,0 +1,37 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:ffigen/src/code_generator.dart'; +import 'package:ffigen/src/config_provider.dart'; +import 'package:ffigen/src/header_parser.dart' as parser; +import 'package:test/test.dart'; + +import '../test_utils.dart'; + +late Library actual; + +void main() { + group('sort_test', () { + setUpAll(() { + logWarnings(); + actual = parser.parse(Config( + output: Uri.file('unused'), + entryPoints: [Uri.file('test/header_parser_tests/sort.h')], + structDecl: DeclarationFilters.includeAll, + unionDecl: DeclarationFilters.includeAll, + typedefs: DeclarationFilters.includeAll, + includeUnusedTypedefs: true, + sort: true, + )); + }); + test('Expected Bindings', () { + matchLibraryWithExpected(actual, 'header_parser_sort_test_output.dart', [ + 'test', + 'header_parser_tests', + 'expected_bindings', + '_expected_sort_bindings.dart', + ]); + }); + }); +} diff --git a/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart b/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart index f9b11d0cf..0a3e67375 100644 --- a/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart +++ b/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart @@ -6077,10 +6077,24 @@ final class CXModuleMapDescriptorImpl extends ffi.Opaque {} /// Object encapsulating information about a module.map file. typedef CXModuleMapDescriptor = ffi.Pointer; +/// An "index" that consists of a set of translation units that would typically +/// be linked together into an executable or library. +typedef CXIndex = ffi.Pointer; + final class CXTargetInfoImpl extends ffi.Opaque {} +/// An opaque type representing target information for a given translation unit. +typedef CXTargetInfo = ffi.Pointer; + final class CXTranslationUnitImpl extends ffi.Opaque {} +/// A single translation unit, which resides in an index. +typedef CXTranslationUnit = ffi.Pointer; + +/// Opaque pointer representing client data that will be passed through to +/// various callbacks and visitors. +typedef CXClientData = ffi.Pointer; + /// Provides the contents of a file that has not yet been saved to disk. final class CXUnsavedFile extends ffi.Struct { /// The file whose contents have not yet been saved. @@ -6196,10 +6210,6 @@ enum CXCursor_ExceptionSpecificationKind { }; } -/// An "index" that consists of a set of translation units that would typically -/// be linked together into an executable or library. -typedef CXIndex = ffi.Pointer; - enum CXGlobalOptFlags { /// Used to indicate that no special CXIndex options are needed. CXGlobalOpt_None(0), @@ -6238,9 +6248,6 @@ final class CXFileUniqueID extends ffi.Struct { external ffi.Array data; } -/// A single translation unit, which resides in an index. -typedef CXTranslationUnit = ffi.Pointer; - /// Identifies a specific source location within a translation unit. final class CXSourceLocation extends ffi.Struct { @ffi.Array.multi([2]) @@ -6305,13 +6312,13 @@ enum CXDiagnosticSeverity { }; } -/// A group of CXDiagnostics. -typedef CXDiagnosticSet = ffi.Pointer; - /// A single diagnostic, containing the diagnostic's severity, location, text, /// source ranges, and fix-it hints. typedef CXDiagnostic = ffi.Pointer; +/// A group of CXDiagnostics. +typedef CXDiagnosticSet = ffi.Pointer; + /// Describes the kind of error that occurred (if any) in a call to /// clang_loadDiagnostics. enum CXLoadDiag_Error { @@ -6602,9 +6609,6 @@ final class CXTUResourceUsage extends ffi.Struct { external ffi.Pointer entries; } -/// An opaque type representing target information for a given translation unit. -typedef CXTargetInfo = ffi.Pointer; - /// Describes the kind of entity that a cursor refers to. enum CXCursorKind { /// A declaration whose specific kind is not exposed via this interface. @@ -8211,9 +8215,6 @@ enum CXChildVisitResult { }; } -/// Opaque pointer representing client data that will be passed through to -/// various callbacks and visitors. -typedef CXClientData = ffi.Pointer; typedef CXCursorVisitorFunction = ffi.UnsignedInt Function( CXCursor cursor, CXCursor parent, CXClientData client_data); typedef DartCXCursorVisitorFunction = CXChildVisitResult Function( @@ -8223,6 +8224,10 @@ typedef DartCXCursorVisitorFunction = CXChildVisitResult Function( typedef CXCursorVisitor = ffi.Pointer>; +/// Opaque pointer representing a policy that controls pretty printing for +/// clang_getCursorPrettyPrinted. +typedef CXPrintingPolicy = ffi.Pointer; + /// Properties for the printing policy. enum CXPrintingPolicyProperty { CXPrintingPolicy_Indentation(0), @@ -8297,10 +8302,6 @@ enum CXPrintingPolicyProperty { } } -/// Opaque pointer representing a policy that controls pretty printing for -/// clang_getCursorPrettyPrinted. -typedef CXPrintingPolicy = ffi.Pointer; - /// Property attributes for a CXCursor_ObjCPropertyDecl. enum CXObjCPropertyAttrKind { CXObjCPropertyAttr_noattr(0), @@ -8813,6 +8814,20 @@ enum CXResult { }; } +/// The client's data object that is associated with a CXFile. +typedef CXIdxClientFile = ffi.Pointer; + +/// The client's data object that is associated with a semantic entity. +typedef CXIdxClientEntity = ffi.Pointer; + +/// The client's data object that is associated with a semantic container of +/// entities. +typedef CXIdxClientContainer = ffi.Pointer; + +/// The client's data object that is associated with an AST file (PCH or +/// module). +typedef CXIdxClientASTFile = ffi.Pointer; + /// Source location passed to index callbacks. final class CXIdxLoc extends ffi.Struct { @ffi.Array.multi([2]) @@ -9258,17 +9273,6 @@ final class CXIdxEntityRefInfo extends ffi.Struct { CXSymbolRole get role => CXSymbolRole.fromValue(roleAsInt); } -/// The client's data object that is associated with a CXFile. -typedef CXIdxClientFile = ffi.Pointer; - -/// The client's data object that is associated with an AST file (PCH or -/// module). -typedef CXIdxClientASTFile = ffi.Pointer; - -/// The client's data object that is associated with a semantic container of -/// entities. -typedef CXIdxClientContainer = ffi.Pointer; - /// A group of callbacks used by #clang_indexSourceFile and /// #clang_indexTranslationUnit. final class IndexerCallbacks extends ffi.Struct { @@ -9325,9 +9329,6 @@ final class IndexerCallbacks extends ffi.Struct { indexEntityReference; } -/// The client's data object that is associated with a semantic entity. -typedef CXIdxClientEntity = ffi.Pointer; - /// An indexing action/session, to be applied to one or multiple translation /// units. typedef CXIndexAction = ffi.Pointer; diff --git a/pkgs/ffigen/test/large_integration_tests/_expected_sqlite_bindings.dart b/pkgs/ffigen/test/large_integration_tests/_expected_sqlite_bindings.dart index 4114ec79b..7245d890b 100644 --- a/pkgs/ffigen/test/large_integration_tests/_expected_sqlite_bindings.dart +++ b/pkgs/ffigen/test/large_integration_tests/_expected_sqlite_bindings.dart @@ -10720,6 +10720,26 @@ class SQLite { final class sqlite3 extends ffi.Opaque {} +typedef sqlite_int64 = ffi.LongLong; +typedef Dartsqlite_int64 = int; +typedef sqlite_uint64 = ffi.UnsignedLongLong; +typedef Dartsqlite_uint64 = int; +typedef sqlite3_int64 = sqlite_int64; +typedef sqlite3_uint64 = sqlite_uint64; +typedef sqlite3_callbackFunction = ffi.Int Function( + ffi.Pointer, + ffi.Int, + ffi.Pointer>, + ffi.Pointer>); +typedef Dartsqlite3_callbackFunction = int Function(ffi.Pointer, int, + ffi.Pointer>, ffi.Pointer>); + +/// The type for a callback function. +/// This is legacy and deprecated. It is included for historical +/// compatibility and is not documented. +typedef sqlite3_callback + = ffi.Pointer>; + final class sqlite3_io_methods extends ffi.Opaque {} final class sqlite3_file extends ffi.Struct { @@ -10731,9 +10751,6 @@ final class sqlite3_mutex extends ffi.Opaque {} final class sqlite3_api_routines extends ffi.Opaque {} -typedef sqlite_int64 = ffi.LongLong; -typedef Dartsqlite_int64 = int; -typedef sqlite3_int64 = sqlite_int64; typedef sqlite3_syscall_ptrFunction = ffi.Void Function(); typedef Dartsqlite3_syscall_ptrFunction = void Function(); typedef sqlite3_syscall_ptr @@ -10893,16 +10910,32 @@ final class sqlite3_mem_methods extends ffi.Struct { external ffi.Pointer pAppData; } -typedef sqlite_uint64 = ffi.UnsignedLongLong; -typedef Dartsqlite_uint64 = int; -typedef sqlite3_uint64 = sqlite_uint64; - final class sqlite3_stmt extends ffi.Opaque {} final class sqlite3_value extends ffi.Opaque {} final class sqlite3_context extends ffi.Opaque {} +typedef sqlite3_destructor_typeFunction = ffi.Void Function( + ffi.Pointer); +typedef Dartsqlite3_destructor_typeFunction = void Function( + ffi.Pointer); + +/// CAPI3REF: Constants Defining Special Destructor Behavior +/// +/// These are special values for the destructor that is passed in as the +/// final argument to routines like [sqlite3_result_blob()]. ^If the destructor +/// argument is SQLITE_STATIC, it means that the content pointer is constant +/// and will never change. It does not need to be destroyed. ^The +/// SQLITE_TRANSIENT value means that the content will likely change in +/// the near future and that SQLite should make its own private copy of +/// the content before returning. +/// +/// The typedef is necessary to work around problems in certain +/// C++ compilers. +typedef sqlite3_destructor_type + = ffi.Pointer>; + final class sqlite3_index_constraint extends ffi.Struct { /// Column constrained. -1 for ROWID @ffi.Int() @@ -11932,6 +11965,21 @@ final class Fts5ExtensionApi extends ffi.Struct { ffi.Pointer)>> xPhraseNextColumn; } +typedef fts5_extension_functionFunction = ffi.Void Function( + ffi.Pointer pApi, + ffi.Pointer pFts, + ffi.Pointer pCtx, + ffi.Int nVal, + ffi.Pointer> apVal); +typedef Dartfts5_extension_functionFunction = void Function( + ffi.Pointer pApi, + ffi.Pointer pFts, + ffi.Pointer pCtx, + int nVal, + ffi.Pointer> apVal); +typedef fts5_extension_function + = ffi.Pointer>; + final class Fts5Tokenizer extends ffi.Opaque {} final class fts5_tokenizer extends ffi.Struct { @@ -11966,21 +12014,6 @@ final class fts5_tokenizer extends ffi.Struct { ffi.Int)>>)>> xTokenize; } -typedef fts5_extension_functionFunction = ffi.Void Function( - ffi.Pointer pApi, - ffi.Pointer pFts, - ffi.Pointer pCtx, - ffi.Int nVal, - ffi.Pointer> apVal); -typedef Dartfts5_extension_functionFunction = void Function( - ffi.Pointer pApi, - ffi.Pointer pFts, - ffi.Pointer pCtx, - int nVal, - ffi.Pointer> apVal); -typedef fts5_extension_function - = ffi.Pointer>; - final class fts5_api extends ffi.Struct { /// Currently always set to 2 @ffi.Int() diff --git a/pkgs/ffigen/test/large_integration_tests/large_objc_test.dart b/pkgs/ffigen/test/large_integration_tests/large_objc_test.dart index 52409555c..58f919c54 100644 --- a/pkgs/ffigen/test/large_integration_tests/large_objc_test.dart +++ b/pkgs/ffigen/test/large_integration_tests/large_objc_test.dart @@ -11,10 +11,9 @@ library; import 'dart:async'; import 'dart:io'; -import 'dart:math'; import 'package:ffigen/ffigen.dart'; -import 'package:ffigen/src/config_provider/config.dart'; +import 'package:ffigen/src/code_generator/utils.dart'; import 'package:ffigen/src/config_provider/config_types.dart'; import 'package:logging/logging.dart'; import 'package:pub_semver/pub_semver.dart'; @@ -32,34 +31,15 @@ void main() { // reasonable amount of time. // TODO(https://github.com/dart-lang/sdk/issues/56247): Remove this. const inclusionRatio = 0.1; - final rand = Random(1234); - bool randInclude([_, __]) => rand.nextDouble() < inclusionRatio; - final randomFilter = DeclarationFilters( - shouldInclude: randInclude, - shouldIncludeMember: randInclude, - ); - - // TODO(https://github.com/dart-lang/native/issues/1220): Allow these. - const disallowedMethods = { - 'accessKey', - 'allowsCellularAccess', - 'allowsConstrainedNetworkAccess', - 'attributedString', - 'cachePolicy', - 'candidateListTouchBarItem', - 'delegate', - 'hyphenationFactor', - 'image', - 'isProxy', - 'objCType', - 'tag', - 'title', - }; - final interfaceFilter = DeclarationFilters( - shouldInclude: randInclude, - shouldIncludeMember: (_, method) => - randInclude() && !disallowedMethods.contains(method), - ); + const seed = 1234; + bool randInclude(String kind, Declaration clazz, [String? method]) => + fnvHash32('$seed.$kind.${clazz.usr}.$method') < + ((1 << 32) * inclusionRatio); + DeclarationFilters randomFilter(String kind) => DeclarationFilters( + shouldInclude: (Declaration clazz) => randInclude(kind, clazz), + shouldIncludeMember: (Declaration clazz, String method) => + randInclude('$kind.memb', clazz, method), + ); const outFile = 'test/large_integration_tests/large_objc_bindings.dart'; const outObjCFile = 'test/large_integration_tests/large_objc_bindings.m'; @@ -70,15 +50,19 @@ void main() { outputObjC: Uri.file(outObjCFile), entryPoints: [Uri.file('test/large_integration_tests/large_objc_test.h')], formatOutput: false, - functionDecl: randomFilter, - structDecl: randomFilter, - unionDecl: randomFilter, - enumClassDecl: randomFilter, - unnamedEnumConstants: randomFilter, - globals: randomFilter, - typedefs: randomFilter, - objcInterfaces: interfaceFilter, - objcProtocols: randomFilter, + includeTransitiveObjCInterfaces: false, + includeTransitiveObjCProtocols: false, + includeTransitiveObjCCategories: false, + functionDecl: randomFilter('functionDecl'), + structDecl: randomFilter('structDecl'), + unionDecl: randomFilter('unionDecl'), + enumClassDecl: randomFilter('enumClassDecl'), + unnamedEnumConstants: randomFilter('unnamedEnumConstants'), + globals: randomFilter('globals'), + typedefs: randomFilter('typedefs'), + objcInterfaces: randomFilter('objcInterfaces'), + objcProtocols: randomFilter('objcProtocols'), + objcCategories: randomFilter('objcCategories'), externalVersions: ExternalVersions( ios: Versions(min: Version(12, 0, 0)), macos: Versions(min: Version(10, 14, 0)), diff --git a/pkgs/ffigen/test/native_objc_test/bad_override_config.yaml b/pkgs/ffigen/test/native_objc_test/bad_override_config.yaml new file mode 100644 index 000000000..c605b7fd9 --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/bad_override_config.yaml @@ -0,0 +1,23 @@ +name: BadOverrideTestObjCLibrary +description: 'Tests various overrides that are valid in ObjC but invalid in Dart' +language: objc +output: 'bad_override_bindings.dart' +exclude-all-by-default: true +objc-interfaces: + include: + - Polygon + - Triangle + - Rectangle + - Square + - BadOverrideGrandparent + - BadOverrideParent + - BadOverrideUncle + - BadOverrideAunt + - BadOverrideChild + - BadOverrideSibbling + - BadOverrideGrandchild +headers: + entry-points: + - 'bad_override_test.m' +preamble: | + // ignore_for_file: camel_case_types, non_constant_identifier_names, unnecessary_non_null_assertion, unused_element, unused_field diff --git a/pkgs/ffigen/test/native_objc_test/bad_override_test.dart b/pkgs/ffigen/test/native_objc_test/bad_override_test.dart new file mode 100644 index 000000000..9be1a9d4a --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/bad_override_test.dart @@ -0,0 +1,78 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Objective C support is only available on mac. +@TestOn('mac-os') + +import 'dart:ffi'; +import 'dart:io'; + +import 'package:ffi/ffi.dart'; +import 'package:test/test.dart'; +import '../test_utils.dart'; +import 'bad_override_bindings.dart'; +import 'util.dart'; + +void main() { + group('bad overrides', () { + setUpAll(() { + // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. + DynamicLibrary.open('../objective_c/test/objective_c.dylib'); + final dylib = File('test/native_objc_test/objc_test.dylib'); + verifySetupFile(dylib); + DynamicLibrary.open(dylib.absolute.path); + generateBindingsForCoverage('bad_override'); + }); + + test('Method vs getter', () { + // In ObjC, supertypes and subtypes can have a method that's an ordinary + // method in some classes of the heirarchy, and a property in others. This + // isn't allowed in Dart, so we change all such conflicts to properties. + // https://github.com/dart-lang/native/issues/1220 + expect(BadOverrideParent.new1().methodVsGetter, 1); + expect(BadOverrideChild.new1().methodVsGetter, 11); + expect(BadOverrideSibbling.new1().methodVsGetter, 12); + expect(BadOverrideGrandchild.new1().methodVsGetter, 111); + + var inst = BadOverrideParent.new1(); + expect(inst.methodVsGetter, 1); + inst = BadOverrideChild.new1(); + expect(inst.methodVsGetter, 11); + inst = BadOverrideSibbling.new1(); + expect(inst.methodVsGetter, 12); + inst = BadOverrideGrandchild.new1(); + expect(inst.methodVsGetter, 111); + + // Uncle isn't affected by the transform, so has an ordinary method. + expect(BadOverrideUncle.new1().methodVsGetter(), 2); + }); + + test('Contravariant returns', () { + // Return types are supposed to be covariant, but ObjC allows them to be + // contravariant. + // https://github.com/dart-lang/native/issues/1220 + Polygon parentResult = BadOverrideParent.new1().contravariantReturn(); + expect(parentResult.name().toString(), 'Rectangle'); + + Polygon childResult = BadOverrideChild.new1().contravariantReturn(); + expect(childResult.name().toString(), 'Triangle'); + }); + + test('Covariant args', () { + // Arg types are supposed to be contravariant, but ObjC allows them to be + // covariant. + // https://github.com/dart-lang/native/issues/1220 + final square = Square.new1(); + final triangle = Triangle.new1(); + + var parent = BadOverrideParent.new1(); + expect(parent.covariantArg_(square).toString(), 'Polygon: Square'); + expect(parent.covariantArg_(triangle).toString(), 'Polygon: Triangle'); + + parent = BadOverrideChild.new1(); + expect(parent.covariantArg_(square).toString(), 'Rectangle: Square'); + expect(() => parent.covariantArg_(triangle), throwsA(isA())); + }); + }); +} diff --git a/pkgs/ffigen/test/native_objc_test/bad_override_test.m b/pkgs/ffigen/test/native_objc_test/bad_override_test.m new file mode 100644 index 000000000..12376721f --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/bad_override_test.m @@ -0,0 +1,95 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#import +#import + +@interface Polygon : NSObject {} +-(NSString*)name; +@end +@implementation Polygon +-(NSString*)name { return @"Polygon"; } +@end + +@interface Triangle : Polygon {} +-(NSString*)name; +@end +@implementation Triangle +-(NSString*)name { return @"Triangle"; } +@end + +@interface Rectangle : Polygon {} +-(NSString*)name; +@end +@implementation Rectangle +-(NSString*)name { return @"Rectangle"; } +@end + +@interface Square : Rectangle {} +-(NSString*)name; +@end +@implementation Square +-(NSString*)name { return @"Square"; } +@end + + + +@interface BadOverrideGrandparent : NSObject {} +@end +@implementation BadOverrideGrandparent +@end + +@interface BadOverrideParent : BadOverrideGrandparent {} +-(int32_t)methodVsGetter; +-(Rectangle*)contravariantReturn; +-(NSString*)covariantArg:(Polygon*)poly; +@end +@implementation BadOverrideParent +-(int32_t)methodVsGetter { return 1; } +-(Rectangle*)contravariantReturn { return [Rectangle new]; } + +-(NSString*)covariantArg:(Polygon*)poly { + return [@"Polygon: " stringByAppendingString: [poly name]]; +} +@end + +@interface BadOverrideUncle : BadOverrideGrandparent {} +-(int32_t)methodVsGetter; +@end +@implementation BadOverrideUncle +-(int32_t)methodVsGetter { return 2; } +@end + +@interface BadOverrideAunt : BadOverrideGrandparent {} +@end +@implementation BadOverrideAunt +@end + +@interface BadOverrideChild : BadOverrideParent {} +@property (readonly) int32_t methodVsGetter; +-(Polygon*)contravariantReturn; +-(NSString*)covariantArg:(Rectangle*)rect; +@end +@implementation BadOverrideChild +-(int32_t)methodVsGetter { return 11; } +-(Polygon*)contravariantReturn { return [Triangle new]; } + +-(NSString*)covariantArg:(Rectangle*)rect { + return [@"Rectangle: " stringByAppendingString: [rect name]]; +} +@end + +@interface BadOverrideSibbling : BadOverrideParent {} +-(int32_t)methodVsGetter; +@end +@implementation BadOverrideSibbling +-(int32_t)methodVsGetter { return 12; } +@end + +@interface BadOverrideGrandchild : BadOverrideParent {} +-(int32_t)methodVsGetter; +@end +@implementation BadOverrideGrandchild +-(int32_t)methodVsGetter { return 111; } +@end diff --git a/pkgs/ffigen/test/native_objc_test/block_annotation_config.yaml b/pkgs/ffigen/test/native_objc_test/block_annotation_config.yaml index ea7706b5e..e66cfbf36 100644 --- a/pkgs/ffigen/test/native_objc_test/block_annotation_config.yaml +++ b/pkgs/ffigen/test/native_objc_test/block_annotation_config.yaml @@ -13,6 +13,7 @@ objc-interfaces: include: - EmptyObject - BlockAnnotationTest + - NSThread objc-protocols: include: - BlockAnnotationTestProtocol diff --git a/pkgs/ffigen/test/native_objc_test/block_config.yaml b/pkgs/ffigen/test/native_objc_test/block_config.yaml index fb4b130d4..85888062a 100644 --- a/pkgs/ffigen/test/native_objc_test/block_config.yaml +++ b/pkgs/ffigen/test/native_objc_test/block_config.yaml @@ -8,12 +8,15 @@ exclude-all-by-default: true objc-interfaces: include: - BlockTester + - DummyObject + - NSThread typedefs: include: - IntBlock - FloatBlock - DoubleBlock - Vec4Block + - SelectorBlock - VoidBlock - ObjectBlock - NullableObjectBlock diff --git a/pkgs/ffigen/test/native_objc_test/block_inherit_config.yaml b/pkgs/ffigen/test/native_objc_test/block_inherit_config.yaml index de9c85bb9..c94ae220e 100644 --- a/pkgs/ffigen/test/native_objc_test/block_inherit_config.yaml +++ b/pkgs/ffigen/test/native_objc_test/block_inherit_config.yaml @@ -19,6 +19,6 @@ typedefs: - AcceptPlatypus headers: entry-points: - - 'block_inherit_test.m' + - 'block_inherit_test.h' preamble: | // ignore_for_file: camel_case_types, non_constant_identifier_names, unnecessary_non_null_assertion, unused_element, unused_field diff --git a/pkgs/ffigen/test/native_objc_test/block_inherit_test.h b/pkgs/ffigen/test/native_objc_test/block_inherit_test.h new file mode 100644 index 000000000..e6afb923d --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/block_inherit_test.h @@ -0,0 +1,42 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#import + +@interface Mammal : NSObject {} +- (BOOL)laysEggs; +@end + +@interface Platypus : Mammal {} +@end + +typedef Mammal* (^ReturnMammal)(); +typedef Platypus* (^ReturnPlatypus)(); +typedef BOOL (^AcceptMammal)(Mammal*); +typedef BOOL (^AcceptPlatypus)(Platypus*); + +// Note: Returns are covariant, args are contravariant. +// Platypus <: Mammal +// ReturnPlatypus <: ReturnMammal (covariant) +// AcceptMammal <: AcceptPlatypus (contravariant) + +@interface BlockInheritTestBase : NSObject {} +// Returns are covariant, args are contravariant. +- (Mammal*) getAnimal ; +- (BOOL) acceptAnimal: (Platypus*)platypus; +- (ReturnMammal) getReturner ; +- (AcceptPlatypus) getAccepter ; +- (Mammal*) invokeReturner: (ReturnPlatypus)returner ; +- (BOOL) invokeAccepter: (AcceptMammal)accepter; +@end + +@interface BlockInheritTestChild : BlockInheritTestBase {} +// Returns are covariant, args are contravariant. +- (Platypus*) getAnimal ; +- (BOOL) acceptAnimal: (Mammal*)mammal; +- (ReturnPlatypus) getReturner ; +- (AcceptMammal) getAccepter ; +- (Mammal*) invokeReturner: (ReturnMammal)returner ; +- (BOOL) invokeAccepter: (AcceptPlatypus)accepter; +@end diff --git a/pkgs/ffigen/test/native_objc_test/block_inherit_test.m b/pkgs/ffigen/test/native_objc_test/block_inherit_test.m index 4d412c71e..9193bf777 100644 --- a/pkgs/ffigen/test/native_objc_test/block_inherit_test.m +++ b/pkgs/ffigen/test/native_objc_test/block_inherit_test.m @@ -1,41 +1,19 @@ -// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #import -@interface Mammal : NSObject {} -- (BOOL)laysEggs; -@end +#include "block_inherit_test.h" + @implementation Mammal - (BOOL)laysEggs { return NO; } @end -@interface Platypus : Mammal {} -@end @implementation Platypus - (BOOL)laysEggs { return YES; } @end -typedef Mammal* (^ReturnMammal)(); -typedef Platypus* (^ReturnPlatypus)(); -typedef BOOL (^AcceptMammal)(Mammal*); -typedef BOOL (^AcceptPlatypus)(Platypus*); - -// Note: Returns are covariant, args are contravariant. -// Platypus <: Mammal -// ReturnPlatypus <: ReturnMammal (covariant) -// AcceptMammal <: AcceptPlatypus (contravariant) - -@interface BlockInheritTestBase : NSObject {} -// Returns are covariant, args are contravariant. -- (Mammal*) getAnimal ; -- (BOOL) acceptAnimal: (Platypus*)platypus; -- (ReturnMammal) getReturner ; -- (AcceptPlatypus) getAccepter ; -- (Mammal*) invokeReturner: (ReturnPlatypus)returner ; -- (BOOL) invokeAccepter: (AcceptMammal)accepter; -@end @implementation BlockInheritTestBase - (Mammal*) getAnimal { return [Mammal new]; } - (BOOL) acceptAnimal: (Platypus*)platypus { return [platypus laysEggs]; } @@ -58,15 +36,6 @@ - (BOOL) invokeAccepter: (AcceptMammal)accepter { } @end -@interface BlockInheritTestChild : BlockInheritTestBase {} -// Returns are covariant, args are contravariant. -- (Platypus*) getAnimal ; -- (BOOL) acceptAnimal: (Mammal*)mammal; -- (ReturnPlatypus) getReturner ; -- (AcceptMammal) getAccepter ; -- (Mammal*) invokeReturner: (ReturnMammal)returner ; -- (BOOL) invokeAccepter: (AcceptPlatypus)accepter; -@end @implementation BlockInheritTestChild - (Platypus*) getAnimal { return [Platypus new]; } - (BOOL) acceptAnimal: (Mammal*)mammal { return [mammal laysEggs]; } diff --git a/pkgs/ffigen/test/native_objc_test/block_test.dart b/pkgs/ffigen/test/native_objc_test/block_test.dart index 8cd6cb74c..63e60f2ba 100644 --- a/pkgs/ffigen/test/native_objc_test/block_test.dart +++ b/pkgs/ffigen/test/native_objc_test/block_test.dart @@ -27,6 +27,7 @@ typedef ListenerBlock = ObjCBlock_ffiVoid_IntBlock; typedef FloatBlock = ObjCBlock_ffiFloat_ffiFloat; typedef DoubleBlock = ObjCBlock_ffiDouble_ffiDouble; typedef Vec4Block = ObjCBlock_Vec4_Vec4; +typedef SelectorBlock = ObjCBlock_ffiVoid_objcObjCSelector; typedef ObjectBlock = ObjCBlock_DummyObject_DummyObject; typedef NullableObjectBlock = ObjCBlock_DummyObject_DummyObject1; typedef NullableStringBlock = ObjCBlock_NSString_NSString; @@ -162,6 +163,19 @@ void main() { }); }); + test('Selector block', () { + late String sel; + final block = SelectorBlock.fromFunction((Pointer x) { + sel = x.toDartString(); + }); + + block('Hello'.toSelector()); + expect(sel, 'Hello'); + + BlockTester.callSelectorBlock_(block); + expect(sel, 'Select'); + }); + test('Object block', () { bool isCalled = false; final block = ObjectBlock.fromFunction((DummyObject x) { diff --git a/pkgs/ffigen/test/native_objc_test/block_test.h b/pkgs/ffigen/test/native_objc_test/block_test.h index d13e2ac80..6172e8a08 100644 --- a/pkgs/ffigen/test/native_objc_test/block_test.h +++ b/pkgs/ffigen/test/native_objc_test/block_test.h @@ -35,6 +35,7 @@ typedef float (^FloatBlock)(float); typedef double (^DoubleBlock)(double); typedef Vec4 (^Vec4Block)(Vec4); typedef void (^VoidBlock)(); +typedef void (^SelectorBlock)(SEL); typedef DummyObject* (^ObjectBlock)(DummyObject*); typedef DummyObject* _Nullable (^NullableObjectBlock)(DummyObject* _Nullable); typedef NSString* _Nullable (^NullableStringBlock)(NSString* _Nullable); @@ -64,6 +65,7 @@ typedef void (^NoTrampolineListenerBlock)(int32_t, Vec4, const char*); + (float)callFloatBlock:(FloatBlock)block; + (double)callDoubleBlock:(DoubleBlock)block; + (Vec4)callVec4Block:(Vec4Block)block; ++ (void)callSelectorBlock:(SelectorBlock)block; + (DummyObject*)callObjectBlock:(ObjectBlock)block NS_RETURNS_RETAINED; + (nullable DummyObject*)callNullableObjectBlock:(NullableObjectBlock)block NS_RETURNS_RETAINED; diff --git a/pkgs/ffigen/test/native_objc_test/block_test.m b/pkgs/ffigen/test/native_objc_test/block_test.m index ee65f31ab..9d3c7d327 100644 --- a/pkgs/ffigen/test/native_objc_test/block_test.m +++ b/pkgs/ffigen/test/native_objc_test/block_test.m @@ -153,6 +153,10 @@ + (Vec4)callVec4Block:(Vec4Block)block { return block(vec4); } ++ (void)callSelectorBlock:(SelectorBlock)block { + block(sel_registerName("Select")); +} + + (DummyObject*)callObjectBlock:(ObjectBlock)block NS_RETURNS_RETAINED { return block([DummyObject new]); } diff --git a/pkgs/ffigen/test/native_objc_test/category_config.yaml b/pkgs/ffigen/test/native_objc_test/category_config.yaml index 5c267388e..2263a9d74 100644 --- a/pkgs/ffigen/test/native_objc_test/category_config.yaml +++ b/pkgs/ffigen/test/native_objc_test/category_config.yaml @@ -6,10 +6,18 @@ exclude-all-by-default: true objc-interfaces: include: - Thing + - ChildOfThing +objc-categories: + include: + - Sub + - Mul + - CatImplementsProto + - InstanceTypeCategory + - InterfaceOnBuiltInType headers: entry-points: - - 'category_test.m' + - 'category_test.h' # Include it twice, as a regression test for #353 - - 'category_test.m' + - 'category_test.h' preamble: | // ignore_for_file: camel_case_types, non_constant_identifier_names, unnecessary_non_null_assertion, unused_element, unused_field diff --git a/pkgs/ffigen/test/native_objc_test/category_test.dart b/pkgs/ffigen/test/native_objc_test/category_test.dart index 7152b4213..dbde5a95b 100644 --- a/pkgs/ffigen/test/native_objc_test/category_test.dart +++ b/pkgs/ffigen/test/native_objc_test/category_test.dart @@ -8,14 +8,14 @@ import 'dart:ffi'; import 'dart:io'; +import 'package:objective_c/objective_c.dart'; import 'package:test/test.dart'; + import '../test_utils.dart'; import 'category_bindings.dart'; import 'util.dart'; void main() { - late Thing testInstance; - group('categories', () { setUpAll(() { // TODO(https://github.com/dart-lang/native/issues/1068): Remove this. @@ -23,15 +23,55 @@ void main() { final dylib = File('test/native_objc_test/objc_test.dylib'); verifySetupFile(dylib); DynamicLibrary.open(dylib.absolute.path); - testInstance = Thing.new1(); generateBindingsForCoverage('category'); }); - test('Category method', () { - expect(testInstance.add_Y_(1000, 234), 1234); - expect(testInstance.sub_Y_(1234, 1000), 234); - expect(testInstance.mul_Y_(1234, 1000), 1234000); - expect(testInstance.someProperty, 456); + test('Category methods', () { + final thing = Thing.new1(); + expect(thing.add_Y_(1000, 234), 1234); + expect(thing.sub_Y_(1234, 1000), 234); + expect(thing.mul_Y_(1234, 1000), 1234000); + expect(thing.someProperty, 456); + expect(thing.anonymousCategoryMethod(), 404); + expect(Thing.anonymousCategoryStaticMethod(), 128); + expect(Sub.staticMethod(), 123); + }); + + test('Protocol methods', () { + final thing = Thing.new1(); + expect(thing.protoMethod(), 987); + expect(CatImplementsProto.staticProtoMethod(), 654); + }); + + test('Instancetype', () { + Thing thing1 = Thing.new1(); + expect(Thing.isInstance(thing1), isTrue); + expect(ChildOfThing.isInstance(thing1), isFalse); + + Thing thing2 = thing1.instancetypeMethod(); + expect(thing2, isNot(thing1)); + expect(Thing.isInstance(thing2), isTrue); + expect(ChildOfThing.isInstance(thing2), isFalse); + + ChildOfThing child1 = ChildOfThing.new1(); + expect(Thing.isInstance(child1), isTrue); + expect(ChildOfThing.isInstance(child1), isTrue); + + ChildOfThing child2 = child1.instancetypeMethod(); + expect(child2, isNot(child1)); + expect(Thing.isInstance(child2), isTrue); + expect(ChildOfThing.isInstance(child2), isTrue); + }); + + test('Category on built-in type', () { + final str = 'Hello'.toNSString(); + + expect(str.method().toString(), 'HelloWorld!'); + expect(InterfaceOnBuiltInType.staticMethod().method().toString(), + 'GoodbyeWorld!'); + + NSString str2 = str.instancetypeMethod(); + expect(str2.toString(), 'Hello'); }); }); } diff --git a/pkgs/ffigen/test/native_objc_test/category_test.h b/pkgs/ffigen/test/native_objc_test/category_test.h new file mode 100644 index 000000000..000694f9e --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/category_test.h @@ -0,0 +1,47 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#import +#import + +@interface Thing : NSObject {} +-(int32_t)add:(int32_t)x Y:(int32_t) y; +@end + +@interface Thing (Sub) +-(int32_t)sub:(int32_t)x Y:(int32_t) y; ++(int32_t)staticMethod; +@end + +@interface Thing (Mul) +-(int32_t)mul:(int32_t)x Y:(int32_t) y; + +@property (readonly) int32_t someProperty; +@end + +@protocol CatTestProtocol +-(int32_t)protoMethod; ++(int32_t)staticProtoMethod; +@end + +@interface Thing (CatImplementsProto) +@end + +@interface Thing (InstanceTypeCategory) +-(instancetype)instancetypeMethod; +@end + +@interface Thing () +-(int32_t)anonymousCategoryMethod; ++(int32_t)anonymousCategoryStaticMethod; +@end + +@interface ChildOfThing : Thing {} +@end + +@interface NSString (InterfaceOnBuiltInType) +-(NSString*)method; ++(NSString*)staticMethod; +-(instancetype)instancetypeMethod; +@end diff --git a/pkgs/ffigen/test/native_objc_test/category_test.m b/pkgs/ffigen/test/native_objc_test/category_test.m index 63cd8731c..290ddcfe7 100644 --- a/pkgs/ffigen/test/native_objc_test/category_test.m +++ b/pkgs/ffigen/test/native_objc_test/category_test.m @@ -1,29 +1,31 @@ -#import +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. -@interface Thing : NSObject {} --(int32_t)add:(int32_t)x Y:(int32_t) y; -@end +#import "category_test.h" @implementation Thing -(int32_t)add:(int32_t)x Y:(int32_t) y { return x + y; } -@end -@interface Thing (Sub) --(int32_t)sub:(int32_t)x Y:(int32_t) y; +-(int32_t)anonymousCategoryMethod { + return 404; +} + ++(int32_t)anonymousCategoryStaticMethod { + return 128; +} @end @implementation Thing (Sub) -(int32_t)sub:(int32_t)x Y:(int32_t) y { return x - y; } -@end - -@interface Thing (Mul) --(int32_t)mul:(int32_t)x Y:(int32_t) y; -@property (readonly) int32_t someProperty; ++(int32_t)staticMethod { + return 123; +} @end @implementation Thing (Mul) @@ -35,3 +37,36 @@ -(int32_t)someProperty { return 456; } @end + +@implementation Thing (CatImplementsProto) +-(int32_t)protoMethod { + return 987; +} + ++(int32_t)staticProtoMethod { + return 654; +} +@end + +@implementation Thing (InstanceTypeCategory) +-(instancetype)instancetypeMethod { + return [[self class] new]; +} +@end + +@implementation ChildOfThing +@end + +@implementation NSString (InterfaceOnBuiltInType) +-(NSString*)method { + return [self stringByAppendingString:@"World!"]; +} + ++(NSString*)staticMethod { + return @"Goodbye"; +} + +-(instancetype)instancetypeMethod { + return [self copy]; +} +@end diff --git a/pkgs/ffigen/test/native_objc_test/deprecated_test.dart b/pkgs/ffigen/test/native_objc_test/deprecated_test.dart index d3f6e0770..6ac305a5b 100644 --- a/pkgs/ffigen/test/native_objc_test/deprecated_test.dart +++ b/pkgs/ffigen/test/native_objc_test/deprecated_test.dart @@ -26,10 +26,13 @@ String bindingsForVersion({Version? iosMinVer, Version? macosMinVer}) { output: Uri.file('test/native_objc_test/deprecated_bindings.dart'), entryPoints: [Uri.file('test/native_objc_test/deprecated_test.m')], formatOutput: false, + includeTransitiveObjCCategories: false, objcInterfaces: DeclarationFilters.include( {'DeprecatedInterfaceMethods', 'DeprecatedInterface'}), objcProtocols: DeclarationFilters.include( {'DeprecatedProtocolMethods', 'DeprecatedProtocol'}), + objcCategories: DeclarationFilters.include( + {'DeprecatedCategoryMethods', 'DeprecatedCategory'}), functionDecl: DeclarationFilters.include({'normalFunction', 'deprecatedFunction'}), structDecl: @@ -66,6 +69,11 @@ void main() { expect(bindings, contains('DeprecatedProtocolMethods ')); }); + test('protocols', () { + expect(bindings, contains('DeprecatedCategory ')); + expect(bindings, contains('DeprecatedCategoryMethods ')); + }); + test('interface methods', () { expect(bindings, contains('normalMethod')); expect(bindings, contains('unavailableMac')); @@ -114,6 +122,30 @@ void main() { expect(bindings, contains('setProtDeprecatedProperty')); }); + test('category methods', () { + expect(bindings, contains('catNormalMethod')); + expect(bindings, contains('catUnavailableMac')); + expect(bindings, contains('catUnavailableIos')); + expect(bindings, contains('catUnavailableBoth')); + expect(bindings, contains('catDepMac2')); + expect(bindings, contains('catDepMac3')); + expect(bindings, contains('catDepIos2')); + expect(bindings, contains('catDepIos2Mac2')); + expect(bindings, contains('catDepIos2Mac3')); + expect(bindings, contains('catDepIos3')); + expect(bindings, contains('catDepIos3Mac2')); + expect(bindings, contains('catDepIos3Mac3')); + expect(bindings, contains('catAlwaysDeprecated')); + expect(bindings, contains('catAlwaysUnavailable')); + }); + + test('category properties', () { + expect(bindings, contains('get catNormalProperty')); + expect(bindings, contains('set catNormalProperty')); + expect(bindings, contains('get catDeprecatedProperty')); + expect(bindings, contains('set catDeprecatedProperty')); + }); + test('functions', () { expect(bindings, contains('normalFunction')); expect(bindings, contains('deprecatedFunction')); @@ -158,6 +190,11 @@ void main() { expect(bindings, contains('DeprecatedProtocolMethods ')); }); + test('categories', () { + expect(bindings, isNot(contains('DeprecatedCategory '))); + expect(bindings, contains('DeprecatedCategoryMethods ')); + }); + test('interface methods', () { expect(bindings, contains('normalMethod')); expect(bindings, contains('unavailableMac')); @@ -206,6 +243,30 @@ void main() { expect(bindings, isNot(contains('setProtDeprecatedProperty'))); }); + test('category methods', () { + expect(bindings, contains('catNormalMethod')); + expect(bindings, contains('catUnavailableMac')); + expect(bindings, isNot(contains('catUnavailableIos'))); + expect(bindings, isNot(contains('catUnavailableBoth'))); + expect(bindings, contains('catDepMac2')); + expect(bindings, contains('catDepMac3')); + expect(bindings, isNot(contains('catDepIos2'))); + expect(bindings, isNot(contains('catDepIos2Mac2'))); + expect(bindings, isNot(contains('catDepIos2Mac3'))); + expect(bindings, contains('catDepIos3')); + expect(bindings, contains('catDepIos3Mac2')); + expect(bindings, contains('catDepIos3Mac3')); + expect(bindings, isNot(contains('catAlwaysDeprecated'))); + expect(bindings, isNot(contains('catAlwaysUnavailable'))); + }); + + test('category properties', () { + expect(bindings, contains('get catNormalProperty')); + expect(bindings, contains('set catNormalProperty')); + expect(bindings, isNot(contains('get catDeprecatedProperty'))); + expect(bindings, isNot(contains('set catDeprecatedProperty'))); + }); + test('functions', () { expect(bindings, contains('normalFunction')); expect(bindings, isNot(contains('deprecatedFunction'))); @@ -299,6 +360,30 @@ void main() { expect(bindings, isNot(contains('setProtDeprecatedProperty'))); }); + test('category methods', () { + expect(bindings, contains('catNormalMethod')); + expect(bindings, contains('catUnavailableMac')); + expect(bindings, contains('catUnavailableIos')); + expect(bindings, isNot(contains('catUnavailableBoth'))); + expect(bindings, contains('catDepMac2')); + expect(bindings, contains('catDepMac3')); + expect(bindings, contains('catDepIos2')); + expect(bindings, isNot(contains('catDepIos2Mac2'))); + expect(bindings, contains('catDepIos2Mac3')); + expect(bindings, contains('catDepIos3')); + expect(bindings, contains('catDepIos3Mac2')); + expect(bindings, contains('catDepIos3Mac3')); + expect(bindings, isNot(contains('catAlwaysDeprecated'))); + expect(bindings, isNot(contains('catAlwaysUnavailable'))); + }); + + test('category properties', () { + expect(bindings, contains('get catNormalProperty')); + expect(bindings, contains('set catNormalProperty')); + expect(bindings, isNot(contains('get catDeprecatedProperty'))); + expect(bindings, isNot(contains('set catDeprecatedProperty'))); + }); + test('functions', () { expect(bindings, contains('normalFunction')); expect(bindings, isNot(contains('deprecatedFunction'))); @@ -392,6 +477,30 @@ void main() { expect(bindings, isNot(contains('setProtDeprecatedProperty'))); }); + test('category methods', () { + expect(bindings, contains('catNormalMethod')); + expect(bindings, contains('catUnavailableMac')); + expect(bindings, contains('catUnavailableIos')); + expect(bindings, isNot(contains('catUnavailableBoth'))); + expect(bindings, contains('catDepMac2')); + expect(bindings, contains('catDepMac3')); + expect(bindings, contains('catDepIos2')); + expect(bindings, isNot(contains('catDepIos2Mac2'))); + expect(bindings, isNot(contains('catDepIos2Mac3'))); + expect(bindings, contains('catDepIos3')); + expect(bindings, isNot(contains('catDepIos3Mac2'))); + expect(bindings, isNot(contains('catDepIos3Mac3'))); + expect(bindings, isNot(contains('catAlwaysDeprecated'))); + expect(bindings, isNot(contains('catAlwaysUnavailable'))); + }); + + test('category properties', () { + expect(bindings, contains('get catNormalProperty')); + expect(bindings, contains('set catNormalProperty')); + expect(bindings, isNot(contains('get catDeprecatedProperty'))); + expect(bindings, isNot(contains('set catDeprecatedProperty'))); + }); + test('functions', () { expect(bindings, contains('normalFunction')); expect(bindings, isNot(contains('deprecatedFunction'))); diff --git a/pkgs/ffigen/test/native_objc_test/deprecated_test.m b/pkgs/ffigen/test/native_objc_test/deprecated_test.m index 51a99f63c..b7a74b4a7 100644 --- a/pkgs/ffigen/test/native_objc_test/deprecated_test.m +++ b/pkgs/ffigen/test/native_objc_test/deprecated_test.m @@ -8,6 +8,10 @@ @interface DeprecatedInterface : NSObject; @protocol DeprecatedProtocol @end +API_DEPRECATED("test", ios(1.0, 2.0), macos(1.0, 2.0)) +@interface NSObject (DeprecatedCategory) +@end + @interface DeprecatedInterfaceMethods : NSObject; -(int)normalMethod; @@ -61,6 +65,25 @@ -(int)protAlwaysUnavailable __attribute__((unavailable)); @property int protDeprecatedProperty API_DEPRECATED("test", ios(1.0, 2.0), macos(1.0, 2.0)); @end +@interface NSObject (DeprecatedCategoryMethods) +-(int)catNormalMethod; +-(int)catUnavailableMac API_UNAVAILABLE(macos); +-(int)catUnavailableIos API_UNAVAILABLE(ios); +-(int)catUnavailableBoth API_UNAVAILABLE(ios, macos); +-(int)catDepMac2 API_DEPRECATED("test", macos(1.0, 2.0)); +-(int)catDepMac3 API_DEPRECATED("test", macos(1.0, 3.0)); +-(int)catDepIos2 API_DEPRECATED("test", ios(1.0, 2.0)); +-(int)catDepIos2Mac2 API_DEPRECATED("test", ios(1.0, 2.0), macos(1.0, 2.0)); +-(int)catDepIos2Mac3 API_DEPRECATED("test", ios(1.0, 2.0), macos(1.0, 3.0)); +-(int)catDepIos3 API_DEPRECATED("test", ios(1.0, 3.0)); +-(int)catDepIos3Mac2 API_DEPRECATED("test", ios(1.0, 3.0), macos(1.0, 2.0)); +-(int)catDepIos3Mac3 API_DEPRECATED("test", ios(1.0, 3.0), macos(1.0, 3.0)); +-(int)catAlwaysDeprecated __attribute__((deprecated)); +-(int)catAlwaysUnavailable __attribute__((unavailable)); +@property int catNormalProperty; +@property int catDeprecatedProperty API_DEPRECATED("test", ios(1.0, 2.0), macos(1.0, 2.0)); +@end + int normalFunction(); int deprecatedFunction() API_DEPRECATED("test", ios(1.0, 2.0), macos(1.0, 2.0)); diff --git a/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart b/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart index 8e887bba7..509d81221 100644 --- a/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart +++ b/pkgs/ffigen/test/native_objc_test/method_filtering_test.dart @@ -45,6 +45,11 @@ void main() { expect(bindings, contains('includedProtocolMethod')); expect(bindings, isNot(contains('excludedProtocolMethod'))); }); + + test('transitive deps', () { + expect(bindings, isNot(contains('TransitiveInterface'))); + expect(bindings, isNot(contains('someTransitiveMethod'))); + }); }); }); } diff --git a/pkgs/ffigen/test/native_objc_test/method_filtering_test.m b/pkgs/ffigen/test/native_objc_test/method_filtering_test.m index d76fd3526..92c5075db 100644 --- a/pkgs/ffigen/test/native_objc_test/method_filtering_test.m +++ b/pkgs/ffigen/test/native_objc_test/method_filtering_test.m @@ -4,11 +4,16 @@ #import +@interface TransitiveInterface : NSObject {} ++ (instancetype)someTransitiveMethod: (double)arg; +@end + @interface MethodFilteringTestInterface : NSObject {} + (instancetype)includedStaticMethod; + (instancetype)excludedStaticMethod; - (instancetype)includedInstanceMethod: (int32_t)arg with: (int32_t)otherArg; -- (instancetype)excludedInstanceMethod: (int32_t)arg with: (int32_t)otherArg; +- (instancetype)excludedInstanceMethod: (int32_t)arg + with: (TransitiveInterface*)otherArg; @property (assign) NSObject* includedProperty; @property (assign) NSObject* excludedProperty; @end diff --git a/pkgs/ffigen/test/native_objc_test/method_test.dart b/pkgs/ffigen/test/native_objc_test/method_test.dart index d463cb295..db909f699 100644 --- a/pkgs/ffigen/test/native_objc_test/method_test.dart +++ b/pkgs/ffigen/test/native_objc_test/method_test.dart @@ -99,5 +99,11 @@ void main() { expect(result.w, 4); }); }); + + test('Instance and static methods with same name', () { + // Test for https://github.com/dart-lang/native/issues/1136 + expect(testInstance.instStaticSameName(), 123); + expect(MethodInterface.instStaticSameName1(), 456); + }); }); } diff --git a/pkgs/ffigen/test/native_objc_test/method_test.m b/pkgs/ffigen/test/native_objc_test/method_test.m index b75cada8b..d5137ab52 100644 --- a/pkgs/ffigen/test/native_objc_test/method_test.m +++ b/pkgs/ffigen/test/native_objc_test/method_test.m @@ -26,6 +26,11 @@ -(float)addFloats:(float)x Y:(float) y; -(double)addDoubles:(double)x Y:(double) y; -(Vec4)Vec4; +// An instance method and a static method with the same name. +// https://github.com/dart-lang/native/issues/1136 +- (int32_t)instStaticSameName; ++ (int32_t)instStaticSameName; + @end @implementation MethodInterface @@ -88,4 +93,12 @@ -(Vec4)Vec4 { return u; } +- (int32_t)instStaticSameName { + return 123; +} + ++ (int32_t)instStaticSameName { + return 456; +} + @end diff --git a/pkgs/ffigen/test/native_objc_test/nullable_test.dart b/pkgs/ffigen/test/native_objc_test/nullable_test.dart index 0d6da50bc..46ed32626 100644 --- a/pkgs/ffigen/test/native_objc_test/nullable_test.dart +++ b/pkgs/ffigen/test/native_objc_test/nullable_test.dart @@ -71,5 +71,11 @@ void main() { false); }); }); + + test('Nullable typealias', () { + // Regression test for https://github.com/dart-lang/native/issues/1701 + expect(NullableInterface.returnNullableAlias_(true), isNull); + expect(NullableInterface.returnNullableAlias_(false)?.toString(), "Hi"); + }); }); } diff --git a/pkgs/ffigen/test/native_objc_test/nullable_test.m b/pkgs/ffigen/test/native_objc_test/nullable_test.m index 06d257d59..82f573b85 100644 --- a/pkgs/ffigen/test/native_objc_test/nullable_test.m +++ b/pkgs/ffigen/test/native_objc_test/nullable_test.m @@ -1,5 +1,7 @@ #import +typedef NSString* MyString; + @interface NullableInterface : NSObject { } @@ -7,6 +9,7 @@ +(BOOL) isNullWithNullableNSObjectArg:(nullable NSObject *)x; +(BOOL) isNullWithNotNullableNSObjectPtrArg:(NSObject *)x; +(BOOL) isNullWithExplicitNonNullableNSObjectPtrArg:(nonnull NSObject *)x; +(nullable NSObject *) returnNil:(BOOL)r; ++(nullable MyString) returnNullableAlias:(BOOL)r; @property (nullable, retain) NSObject *nullableObjectProperty; @@ -34,4 +37,12 @@ +(nullable NSObject *) returnNil:(BOOL)r { } } ++(nullable MyString) returnNullableAlias:(BOOL)r { + if (r) { + return nil; + } else { + return @"Hi"; + } +} + @end diff --git a/pkgs/ffigen/test/native_objc_test/property_test.dart b/pkgs/ffigen/test/native_objc_test/property_test.dart index 9242a8ca3..c2d8eda41 100644 --- a/pkgs/ffigen/test/native_objc_test/property_test.dart +++ b/pkgs/ffigen/test/native_objc_test/property_test.dart @@ -79,5 +79,11 @@ void main() { expect(testInstance.doubleProperty, 1.23); }); }); + + test('Instance and static properties with same name', () { + // Test for https://github.com/dart-lang/native/issues/1136 + expect(testInstance.instStaticSameName, 123); + expect(PropertyInterface.getInstStaticSameName1(), 456); + }); }); } diff --git a/pkgs/ffigen/test/native_objc_test/property_test.m b/pkgs/ffigen/test/native_objc_test/property_test.m index 0085034cf..defc478a9 100644 --- a/pkgs/ffigen/test/native_objc_test/property_test.m +++ b/pkgs/ffigen/test/native_objc_test/property_test.m @@ -21,6 +21,11 @@ @interface PropertyInterface : NSObject { @property double doubleProperty; @property Vec4 structProperty; +// An instance property and a static property with the same name. +// https://github.com/dart-lang/native/issues/1136 +@property(readonly) int32_t instStaticSameName; +@property(class, readonly) int32_t instStaticSameName; + @end @implementation PropertyInterface @@ -43,4 +48,12 @@ + (void)setClassReadWriteProperty:(int32_t)x { _classReadWriteProperty = x; } +- (int32_t)instStaticSameName { + return 123; +} + ++ (int32_t)instStaticSameName { + return 456; +} + @end diff --git a/pkgs/ffigen/test/native_objc_test/protocol_test.dart b/pkgs/ffigen/test/native_objc_test/protocol_test.dart index c55a0e16a..d6176506e 100644 --- a/pkgs/ffigen/test/native_objc_test/protocol_test.dart +++ b/pkgs/ffigen/test/native_objc_test/protocol_test.dart @@ -73,6 +73,10 @@ void main() { // Method from a protocol that isn't included by the filters. expect(protocolImpl.fooMethod(), 2468); + + // Class methods. + expect(ObjCProtocolImpl.requiredClassMethod(), 9876); + expect(ObjCProtocolImpl.optionalClassMethod(), 5432); }); test('Unimplemented method', () { @@ -94,6 +98,9 @@ void main() { expect(() => protocolImpl.optionalMethod_(structPtr.ref), throwsA(isA())); calloc.free(structPtr); + + expect(() => ObjCProtocolImpl.unimplementedOtionalClassMethod(), + throwsA(isA())); }); }); @@ -251,7 +258,7 @@ void main() { final sel = registerName('instanceMethod:withDouble:'); final signature = getProtocolMethodSignature(protocol, sel, - isRequired: true, isInstanceMethod: true); + isRequired: true, isInstanceMethod: true)!; final block = InstanceMethodBlock.fromFunction( (Pointer p, NSString s, double x) { return 'DartProxy: $s: $x'.toNSString(); @@ -261,7 +268,7 @@ void main() { final optSel = registerName('optionalMethod:'); final optSignature = getProtocolMethodSignature(protocol, optSel, - isRequired: false, isInstanceMethod: true); + isRequired: false, isInstanceMethod: true)!; final optBlock = OptionalMethodBlock.fromFunction((Pointer p, SomeStruct s) { return s.y - s.x; @@ -272,7 +279,7 @@ void main() { final otherSel = registerName('otherMethod:b:c:d:'); final otherSignature = getProtocolMethodSignature( secondProtocol, otherSel, - isRequired: true, isInstanceMethod: true); + isRequired: true, isInstanceMethod: true)!; final otherBlock = OtherMethodBlock.fromFunction( (Pointer p, int a, int b, int c, int d) { return a * b * c * d; @@ -332,7 +339,7 @@ void main() { final sel = registerName('instanceMethod:withDouble:'); final signature = getProtocolMethodSignature(protocol, sel, - isRequired: true, isInstanceMethod: true); + isRequired: true, isInstanceMethod: true)!; final block = InstanceMethodBlock.fromFunction( (Pointer p, NSString s, double x) => 'Hello'.toNSString()); proxyBuilder.implementMethod_withSignature_andBlock_( @@ -400,5 +407,17 @@ void main() { final proto = UnusedProtocol.implement(someMethod: () => 123); expect(proto, isNotNull); }); + + test('Disabled method', () { + // Regression test for https://github.com/dart-lang/native/issues/1702. + expect(MyProtocol.instanceMethod_withDouble_.isAvailable, isTrue); + expect(MyProtocol.optionalMethod_.isAvailable, isTrue); + expect(MyProtocol.disabledMethod.isAvailable, isFalse); + + expect( + () => MyProtocol.disabledMethod + .implement(ObjCProtocolBuilder(), () => 123), + throwsA(isA())); + }); }); } diff --git a/pkgs/ffigen/test/native_objc_test/protocol_test.h b/pkgs/ffigen/test/native_objc_test/protocol_test.h index c3ef28788..21262a248 100644 --- a/pkgs/ffigen/test/native_objc_test/protocol_test.h +++ b/pkgs/ffigen/test/native_objc_test/protocol_test.h @@ -25,6 +25,25 @@ typedef struct { @optional - (void)voidMethod:(int32_t)x; +// Class methods aren't supported in protocol implementation from Dart, but they +// are still codegenned for any native interfaces that implement this protocol. +@required ++ (int32_t)requiredClassMethod; + +@optional ++ (int32_t)optionalClassMethod; + +@optional ++ (int32_t)unimplementedOtionalClassMethod; + +// For https://github.com/dart-lang/native/issues/1702 regression test, disable +// a method (in practice this would be due to API versioning) and verify that +// the protocol builder fails gracefully. +#ifndef DISABLE_METHOD +@optional +- (int32_t)disabledMethod; +#endif + @end diff --git a/pkgs/ffigen/test/native_objc_test/protocol_test.m b/pkgs/ffigen/test/native_objc_test/protocol_test.m index c6eaa5618..91b7a7f40 100644 --- a/pkgs/ffigen/test/native_objc_test/protocol_test.m +++ b/pkgs/ffigen/test/native_objc_test/protocol_test.m @@ -4,6 +4,8 @@ #import +#define DISABLE_METHOD 1 + #include "protocol_test.h" @implementation ProtocolConsumer : NSObject @@ -49,6 +51,14 @@ - (int32_t)fooMethod { return 2468; } ++ (int32_t)requiredClassMethod { + return 9876; +} + ++ (int32_t)optionalClassMethod { + return 5432; +} + @end diff --git a/pkgs/ffigen/test/native_objc_test/static_func_config.yaml b/pkgs/ffigen/test/native_objc_test/static_func_config.yaml index 0a45ba852..e023c6e2c 100644 --- a/pkgs/ffigen/test/native_objc_test/static_func_config.yaml +++ b/pkgs/ffigen/test/native_objc_test/static_func_config.yaml @@ -13,6 +13,9 @@ functions: - staticFuncConsumesArg - objc_autoreleasePoolPush - objc_autoreleasePoolPop +objc-interfaces: + include: + - StaticFuncTestObj headers: entry-points: - 'static_func_test.m' diff --git a/pkgs/ffigen/test/native_objc_test/static_func_native_config.yaml b/pkgs/ffigen/test/native_objc_test/static_func_native_config.yaml index cc855fc0f..c7a566bed 100644 --- a/pkgs/ffigen/test/native_objc_test/static_func_native_config.yaml +++ b/pkgs/ffigen/test/native_objc_test/static_func_native_config.yaml @@ -14,6 +14,9 @@ functions: - staticFuncConsumesArg - objc_autoreleasePoolPush - objc_autoreleasePoolPop +objc-interfaces: + include: + - StaticFuncTestObj headers: entry-points: - 'static_func_test.m' diff --git a/pkgs/ffigen/test/native_objc_test/transitive_test.dart b/pkgs/ffigen/test/native_objc_test/transitive_test.dart new file mode 100644 index 000000000..31b765037 --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/transitive_test.dart @@ -0,0 +1,280 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Objective C support is only available on mac. +@TestOn('mac-os') + +import 'dart:ffi'; +import 'dart:io'; + +import 'package:ffi/ffi.dart'; +import 'package:ffigen/ffigen.dart'; +import 'package:ffigen/src/config_provider/config.dart'; +import 'package:ffigen/src/config_provider/config_types.dart'; +import 'package:logging/logging.dart'; +import 'package:pub_semver/pub_semver.dart'; +import 'package:test/test.dart'; +import '../test_utils.dart'; +import 'util.dart'; + +String generate({ + bool includeTransitiveObjCInterfaces = false, + bool includeTransitiveObjCProtocols = false, + bool includeTransitiveObjCCategories = false, +}) { + final config = Config( + wrapperName: 'TransitiveTestObjCLibrary', + wrapperDocComment: 'Tests transitive inclusion', + language: Language.objc, + output: Uri.file('test/native_objc_test/transitive_bindings.dart'), + entryPoints: [Uri.file('test/native_objc_test/transitive_test.h')], + formatOutput: true, + objcInterfaces: DeclarationFilters.include({ + 'DirectlyIncluded', + 'DirectlyIncludedWithProtocol', + 'DirectlyIncludedIntForCat' + }), + objcProtocols: DeclarationFilters.include({'DirectlyIncludedProtocol'}), + objcCategories: DeclarationFilters.include({'DirectlyIncludedCategory'}), + includeTransitiveObjCInterfaces: includeTransitiveObjCInterfaces, + includeTransitiveObjCProtocols: includeTransitiveObjCProtocols, + includeTransitiveObjCCategories: includeTransitiveObjCCategories, + ); + FfiGen(logLevel: Level.SEVERE).run(config); + return File('test/native_objc_test/transitive_bindings.dart') + .readAsStringSync(); +} + +enum Inclusion { omitted, stubbed, included } + +void main() { + group('transitive', () { + late String bindings; + + Inclusion incItf(String name) { + bool classDef = bindings.contains('class $name '); + bool stubWarn = bindings.contains('WARNING: $name is a stub.'); + bool isInst = bindings + .contains('/// Returns whether [obj] is an instance of [$name].'); + bool any = bindings.contains(RegExp('\\W$name\\W')); + if (classDef && stubWarn && !isInst && any) return Inclusion.stubbed; + if (classDef && !stubWarn && isInst && any) return Inclusion.included; + if (!classDef && !stubWarn && !isInst && !any) return Inclusion.omitted; + throw Exception( + 'Bad interface: $name ($classDef, $stubWarn, $isInst, $any)'); + } + + Inclusion incProto(String name) { + bool classDef = bindings.contains('class $name '); + bool any = bindings.contains(RegExp('\\W$name\\W')); + if (classDef && any) return Inclusion.included; + if (!classDef && !any) return Inclusion.omitted; + throw Exception('Bad protocol: $name ($classDef, $any)'); + } + + Inclusion incCat(String name) { + bool classDef = bindings.contains('extension $name '); + bool any = bindings.contains(RegExp('\\W$name\\W')); + if (classDef && any) return Inclusion.included; + if (!classDef && !any) return Inclusion.omitted; + throw Exception('Bad protocol: $name ($classDef, $any)'); + } + + group('transitive interfaces', () { + test('included', () { + bindings = generate(includeTransitiveObjCInterfaces: true); + + expect(incItf('DoublyTransitive'), Inclusion.included); + expect(incItf('TransitiveSuper'), Inclusion.included); + expect(incItf('Transitive'), Inclusion.included); + expect(incItf('SuperSuperType'), Inclusion.included); + expect(incItf('DoublySuperTransitive'), Inclusion.included); + expect(incItf('SuperTransitive'), Inclusion.included); + expect(incItf('SuperType'), Inclusion.included); + expect(incItf('DirectlyIncluded'), Inclusion.included); + expect(incItf('NotIncludedSuperType'), Inclusion.omitted); + expect(incItf('NotIncludedTransitive'), Inclusion.omitted); + expect(incItf('NotIncludedSuperType'), Inclusion.omitted); + + expect(bindings.contains('doubleMethod'), isTrue); + expect(bindings.contains('transitiveSuperMethod'), isTrue); + expect(bindings.contains('transitiveMethod'), isTrue); + expect(bindings.contains('superSuperMethod'), isTrue); + expect(bindings.contains('doublySuperMethod'), isTrue); + expect(bindings.contains('superTransitiveMethod'), isTrue); + expect(bindings.contains('superMethod'), isTrue); + expect(bindings.contains('directMethod'), isTrue); + expect(bindings.contains('notIncludedSuperMethod'), isFalse); + expect(bindings.contains('notIncludedTransitiveMethod'), isFalse); + expect(bindings.contains('notIncludedMethod'), isFalse); + }); + + test('stubbed', () { + bindings = generate(includeTransitiveObjCInterfaces: false); + + expect(incItf('DoublyTransitive'), Inclusion.omitted); + expect(incItf('TransitiveSuper'), Inclusion.stubbed); + expect(incItf('Transitive'), Inclusion.stubbed); + expect(incItf('SuperSuperType'), Inclusion.included); + expect(incItf('DoublySuperTransitive'), Inclusion.omitted); + expect(incItf('SuperTransitive'), Inclusion.stubbed); + expect(incItf('SuperType'), Inclusion.included); + expect(incItf('DirectlyIncluded'), Inclusion.included); + expect(incItf('NotIncludedSuperType'), Inclusion.omitted); + expect(incItf('NotIncludedTransitive'), Inclusion.omitted); + expect(incItf('NotIncludedSuperType'), Inclusion.omitted); + + expect(bindings.contains('doubleMethod'), isFalse); + expect(bindings.contains('transitiveSuperMethod'), isFalse); + expect(bindings.contains('transitiveMethod'), isFalse); + expect(bindings.contains('superSuperMethod'), isTrue); + expect(bindings.contains('doublySuperMethod'), isFalse); + expect(bindings.contains('superTransitiveMethod'), isFalse); + expect(bindings.contains('superMethod'), isTrue); + expect(bindings.contains('directMethod'), isTrue); + expect(bindings.contains('notIncludedSuperMethod'), isFalse); + expect(bindings.contains('notIncludedTransitiveMethod'), isFalse); + expect(bindings.contains('notIncludedMethod'), isFalse); + }); + }); + + group('transitive protocols', () { + test('included', () { + bindings = generate(includeTransitiveObjCProtocols: true); + + // TODO(https://github.com/dart-lang/native/issues/1462): Transitive + // protocols should be included. + expect(incProto('DoublyTransitiveProtocol'), Inclusion.omitted); + expect(incProto('TransitiveSuperProtocol'), Inclusion.omitted); + expect(incProto('TransitiveProtocol'), Inclusion.omitted); + expect(incProto('SuperSuperProtocol'), Inclusion.included); + expect(incProto('DoublySuperTransitiveProtocol'), Inclusion.omitted); + expect(incProto('SuperTransitiveProtocol'), Inclusion.omitted); + expect(incProto('SuperProtocol'), Inclusion.included); + expect(incProto('AnotherSuperProtocol'), Inclusion.included); + expect(incProto('DirectlyIncludedProtocol'), Inclusion.included); + expect(incProto('NotIncludedSuperProtocol'), Inclusion.omitted); + expect(incProto('NotIncludedTransitiveProtocol'), Inclusion.omitted); + expect(incProto('NotIncludedProtocol'), Inclusion.omitted); + expect(incProto('SuperFromInterfaceProtocol'), Inclusion.included); + expect(incProto('TransitiveFromInterfaceProtocol'), Inclusion.omitted); + expect(incItf('DirectlyIncludedWithProtocol'), Inclusion.included); + + expect(bindings.contains('doubleProtoMethod'), isFalse); + expect(bindings.contains('transitiveSuperProtoMethod'), isFalse); + expect(bindings.contains('transitiveProtoMethod'), isFalse); + expect(bindings.contains('superSuperProtoMethod'), isTrue); + expect(bindings.contains('doublySuperProtoMethod'), isFalse); + expect(bindings.contains('superTransitiveProtoMethod'), isFalse); + expect(bindings.contains('superProtoMethod'), isTrue); + expect(bindings.contains('anotherSuperProtoMethod'), isTrue); + expect(bindings.contains('directProtoMethod'), isTrue); + expect(bindings.contains('notIncludedSuperProtoMethod'), isFalse); + expect(bindings.contains('notIncludedTransitiveProtoMethod'), isFalse); + expect(bindings.contains('notIncludedProtoMethod'), isFalse); + expect(bindings.contains('superFromInterfaceProtoMethod'), isTrue); + expect( + bindings.contains('transitiveFromInterfaceProtoMethod'), isFalse); + expect(bindings.contains('directlyIncludedWithProtoMethod'), isTrue); + }); + + test('not included', () { + bindings = generate(includeTransitiveObjCProtocols: false); + + expect(incProto('DoublyTransitiveProtocol'), Inclusion.omitted); + expect(incProto('TransitiveSuperProtocol'), Inclusion.omitted); + expect(incProto('TransitiveProtocol'), Inclusion.omitted); + expect(incProto('SuperSuperProtocol'), Inclusion.omitted); + expect(incProto('DoublySuperTransitiveProtocol'), Inclusion.omitted); + expect(incProto('SuperTransitiveProtocol'), Inclusion.omitted); + expect(incProto('SuperProtocol'), Inclusion.omitted); + expect(incProto('AnotherSuperProtocol'), Inclusion.omitted); + expect(incProto('DirectlyIncludedProtocol'), Inclusion.included); + expect(incProto('NotIncludedSuperProtocol'), Inclusion.omitted); + expect(incProto('NotIncludedTransitiveProtocol'), Inclusion.omitted); + expect(incProto('NotIncludedProtocol'), Inclusion.omitted); + expect(incProto('SuperFromInterfaceProtocol'), Inclusion.omitted); + expect(incProto('TransitiveFromInterfaceProtocol'), Inclusion.omitted); + expect(incItf('DirectlyIncludedWithProtocol'), Inclusion.included); + + expect(bindings.contains('doubleProtoMethod'), isFalse); + expect(bindings.contains('transitiveSuperProtoMethod'), isFalse); + expect(bindings.contains('transitiveProtoMethod'), isFalse); + expect(bindings.contains('superSuperProtoMethod'), isTrue); + expect(bindings.contains('doublySuperProtoMethod'), isFalse); + expect(bindings.contains('superTransitiveProtoMethod'), isFalse); + expect(bindings.contains('superProtoMethod'), isTrue); + expect(bindings.contains('anotherSuperProtoMethod'), isTrue); + expect(bindings.contains('directProtoMethod'), isTrue); + expect(bindings.contains('notIncludedSuperProtoMethod'), isFalse); + expect(bindings.contains('notIncludedTransitiveProtoMethod'), isFalse); + expect(bindings.contains('notIncludedProtoMethod'), isFalse); + expect(bindings.contains('superFromInterfaceProtoMethod'), isTrue); + expect( + bindings.contains('transitiveFromInterfaceProtoMethod'), isFalse); + expect(bindings.contains('directlyIncludedWithProtoMethod'), isTrue); + }); + }); + + group('transitive categories', () { + test('included', () { + bindings = generate(includeTransitiveObjCCategories: true); + + expect(incItf('IntOfDirectCat'), Inclusion.stubbed); + expect(incItf('TransitiveIntOfDirectCat'), Inclusion.stubbed); + expect(incProto('TransitiveProtOfDirectCat'), Inclusion.omitted); + expect(incCat('DirectlyIncludedCategory'), Inclusion.included); + expect(incItf('DoubleTransitiveIntOfTransitiveCat'), Inclusion.omitted); + expect(incCat('TransitiveCatOfTransitiveInt'), Inclusion.omitted); + expect(incItf('DirectlyIncludedIntForCat'), Inclusion.included); + expect(incItf('TransitiveIntOfTransitiveCat'), Inclusion.stubbed); + expect(incCat('TransitiveCatOfDirectInt'), Inclusion.included); + expect(incCat('NotIncludedCategory'), Inclusion.omitted); + + expect(bindings.contains('intOfDirectCatMethod'), isFalse); + expect(bindings.contains('transitiveIntOfCatMethod'), isFalse); + expect(bindings.contains('transitiveProtOfDirectCatMethod'), isTrue); + expect(bindings.contains('directlyIncludedCategoryMethod'), isTrue); + expect(bindings.contains('doubleTransitiveIntOfTransitiveCatMethod'), + isFalse); + expect( + bindings.contains('transitiveCatOfTransitiveIntMethod'), isFalse); + expect(bindings.contains('directlyIncludedIntForCatMethod'), isTrue); + expect( + bindings.contains('transitiveIntOfTransitiveCatMethod'), isFalse); + expect(bindings.contains('transitiveCatOfDirectIntMethod'), isTrue); + expect(bindings.contains('notIncludedCategoryMethod'), isFalse); + }); + + test('not included', () { + bindings = generate(includeTransitiveObjCCategories: false); + + expect(incItf('IntOfDirectCat'), Inclusion.stubbed); + expect(incItf('TransitiveIntOfDirectCat'), Inclusion.stubbed); + expect(incProto('TransitiveProtOfDirectCat'), Inclusion.omitted); + expect(incCat('DirectlyIncludedCategory'), Inclusion.included); + expect(incItf('DoubleTransitiveIntOfTransitiveCat'), Inclusion.omitted); + expect(incCat('TransitiveCatOfTransitiveInt'), Inclusion.omitted); + expect(incItf('DirectlyIncludedIntForCat'), Inclusion.included); + expect(incItf('TransitiveIntOfTransitiveCat'), Inclusion.omitted); + expect(incCat('TransitiveCatOfDirectInt'), Inclusion.omitted); + expect(incCat('NotIncludedCategory'), Inclusion.omitted); + + expect(bindings.contains('intOfDirectCatMethod'), isFalse); + expect(bindings.contains('transitiveIntOfCatMethod'), isFalse); + expect(bindings.contains('transitiveProtOfDirectCatMethod'), isTrue); + expect(bindings.contains('directlyIncludedCategoryMethod'), isTrue); + expect(bindings.contains('doubleTransitiveIntOfTransitiveCatMethod'), + isFalse); + expect( + bindings.contains('transitiveCatOfTransitiveIntMethod'), isFalse); + expect(bindings.contains('directlyIncludedIntForCatMethod'), isTrue); + expect( + bindings.contains('transitiveIntOfTransitiveCatMethod'), isFalse); + expect(bindings.contains('transitiveCatOfDirectIntMethod'), isFalse); + expect(bindings.contains('notIncludedCategoryMethod'), isFalse); + }); + }); + }); +} diff --git a/pkgs/ffigen/test/native_objc_test/transitive_test.h b/pkgs/ffigen/test/native_objc_test/transitive_test.h new file mode 100644 index 000000000..3f8168536 --- /dev/null +++ b/pkgs/ffigen/test/native_objc_test/transitive_test.h @@ -0,0 +1,155 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// === Interfaces === + +@interface DoublyTransitive {} +-(double)doubleMethod; +@end + +@interface TransitiveSuper {} +-(int)transitiveSuperMethod; +@end + +@interface Transitive : TransitiveSuper {} +-(DoublyTransitive*)transitiveMethod; +@end + +@interface SuperSuperType {} +-(int)superSuperMethod; +@end + +@interface DoublySuperTransitive {} +-(double)doublySuperMethod; +@end + +@interface SuperTransitive {} +-(DoublySuperTransitive*)superTransitiveMethod; +@end + +@interface SuperType : SuperSuperType {} +-(SuperTransitive*)superMethod; +@end + +@interface DirectlyIncluded : SuperType {} +-(Transitive*)directMethod; +@end + +@interface NotIncludedSuperType {} +-(int)notIncludedSuperMethod; +@end + +@interface NotIncludedTransitive {} +-(int)notIncludedTransitiveMethod; +@end + +@interface NotIncluded : NotIncludedSuperType {} +-(NotIncludedTransitive*)notIncludedMethod; +@end + + +// === Protocols === + +@protocol DoublyTransitiveProtocol +-(double)doubleProtoMethod; +@end + +@protocol TransitiveSuperProtocol +-(int)transitiveSuperProtoMethod; +@end + +@protocol TransitiveProtocol +-(id)transitiveProtoMethod; +@end + +@protocol SuperSuperProtocol +-(int)superSuperProtoMethod; +@end + +@protocol DoublySuperTransitiveProtocol +-(double)doublySuperProtoMethod; +@end + +@protocol SuperTransitiveProtocol +-(id)superTransitiveProtoMethod; +@end + +@protocol SuperProtocol +-(id)superProtoMethod; +@end + +@protocol AnotherSuperProtocol +-(int)anotherSuperProtoMethod; +@end + +@protocol DirectlyIncludedProtocol +-(id)directProtoMethod; +@end + +@protocol NotIncludedSuperProtocol +-(int)notIncludedSuperProtoMethod; +@end + +@protocol NotIncludedTransitiveProtocol +-(int)notIncludedTransitiveProtoMethod; +@end + +@protocol NotIncludedProtocol +-(id)notIncludedProtoMethod; +@end + +@protocol SuperFromInterfaceProtocol +-(int)superFromInterfaceProtoMethod; +@end + +@protocol TransitiveFromInterfaceProtocol +-(int)transitiveFromInterfaceProtoMethod; +@end + +@interface DirectlyIncludedWithProtocol {} +-(id)directlyIncludedWithProtoMethod; +@end + + +// === Categories === + +@interface IntOfDirectCat {} +-(int)intOfDirectCatMethod; +@end + +@interface TransitiveIntOfDirectCat {} +-(int)transitiveIntOfCatMethod; +@end + +@protocol TransitiveProtOfDirectCat +-(int)transitiveProtOfDirectCatMethod; +@end + +@interface IntOfDirectCat (DirectlyIncludedCategory) +-(TransitiveIntOfDirectCat*)directlyIncludedCategoryMethod; +@end + +@interface DoubleTransitiveIntOfTransitiveCat {} +-(int)doubleTransitiveIntOfTransitiveCatMethod; +@end + +@interface TransitiveIntOfDirectCat (TransitiveCatOfTransitiveInt) +-(DoubleTransitiveIntOfTransitiveCat*)transitiveCatOfTransitiveIntMethod; +@end + +@interface DirectlyIncludedIntForCat {} +-(int)directlyIncludedIntForCatMethod; +@end + +@interface TransitiveIntOfTransitiveCat {} +-(int)transitiveIntOfTransitiveCatMethod; +@end + +@interface DirectlyIncludedIntForCat (TransitiveCatOfDirectInt) +-(TransitiveIntOfTransitiveCat*)transitiveCatOfDirectIntMethod; +@end + +@interface NotIncluded (NotIncludedCategory) +-(int)notIncludedCategoryMethod; +@end diff --git a/pkgs/ffigen/test/rename_tests/rename_test.dart b/pkgs/ffigen/test/rename_tests/rename_test.dart index 263b3569e..c9b820699 100644 --- a/pkgs/ffigen/test/rename_tests/rename_test.dart +++ b/pkgs/ffigen/test/rename_tests/rename_test.dart @@ -162,6 +162,10 @@ Library expectedLibrary() { final struct1 = Struct(name: '${structPrefix}Struct1'); final struct2 = Struct(name: 'Struct2'); final struct3 = Struct(name: 'Struct3'); + final struct5Alias = Typealias( + name: 'Struct5_Alias_Renamed', + type: Struct(name: '${structPrefix}Struct5'), + ); return Library( name: 'Bindings', bindings: [ @@ -240,9 +244,7 @@ Library expectedLibrary() { parameters: [ Parameter( name: 's', - type: Typealias( - name: 'Struct5_Alias_Renamed', - type: Struct(name: '${structPrefix}Struct5')), + type: struct5Alias, objCConsumed: false, ), ], @@ -328,6 +330,7 @@ Library expectedLibrary() { rawType: 'int', rawValue: '1', ), + struct5Alias, ], ); } diff --git a/pkgs/ffigen/test/test_utils.dart b/pkgs/ffigen/test/test_utils.dart index fadf43dd0..d1803815d 100644 --- a/pkgs/ffigen/test/test_utils.dart +++ b/pkgs/ffigen/test/test_utils.dart @@ -16,14 +16,8 @@ import 'package:yaml/yaml.dart' as yaml; extension LibraryTestExt on Library { /// Get a [Binding]'s generated string with a given name. - String getBindingAsString(String name) { - try { - final b = bindings.firstWhere((element) => element.name == name); - return b.toBindingString(writer).string; - } catch (e) { - throw NotFoundException("Binding '$name' not found."); - } - } + String getBindingAsString(String name) => + getBinding(name).toBindingString(writer).string; /// Get a [Binding] with a given name. Binding getBinding(String name) { @@ -84,6 +78,8 @@ void matchLibrarySymbolFileWithExpected(Library library, String pathForActual, }); } +const bool updateExpectations = false; + /// Generates actual file using library and tests using [expect] with expected. /// /// This will not delete the actual debug file incase [expect] throws an error. @@ -95,6 +91,7 @@ void _matchFileWithExpected({ fileWriter, String Function(String)? codeNormalizer, }) { + final expectedPath = path.joinAll(pathToExpected); final file = File( path.join(strings.tmpDir, pathForActual), ); @@ -103,13 +100,17 @@ void _matchFileWithExpected({ final actual = _normalizeGeneratedCode(file.readAsStringSync(), codeNormalizer); final expected = _normalizeGeneratedCode( - File(path.joinAll(pathToExpected)).readAsStringSync(), codeNormalizer); + File(expectedPath).readAsStringSync(), codeNormalizer); expect(actual.split('\n'), expected.split('\n')); if (file.existsSync()) { file.delete(); } } catch (e) { print('Failed test: Debug generated file: ${file.absolute.path}'); + if (updateExpectations) { + print('Updating expectations. Check the diffs!'); + file.copySync(expectedPath); + } rethrow; } } diff --git a/pkgs/ffigen/test/unit_tests/subtyping_test.dart b/pkgs/ffigen/test/unit_tests/subtyping_test.dart new file mode 100644 index 000000000..191767dad --- /dev/null +++ b/pkgs/ffigen/test/unit_tests/subtyping_test.dart @@ -0,0 +1,261 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:ffigen/src/code_generator.dart'; +import 'package:test/test.dart'; + +void main() { + group('subtyping', () { + final builtInFunctions = ObjCBuiltInFunctions('', false); + + ObjCInterface makeInterface(String name, ObjCInterface? superType, + [List methods = const []]) { + final itf = ObjCInterface( + usr: name, + originalName: name, + builtInFunctions: builtInFunctions, + ); + if (superType != null) { + itf.superType = superType; + superType.subtypes.add(itf); + } + for (final m in methods) { + itf.addMethod(m); + } + itf.filled = true; + return itf; + } + + final grandparent = makeInterface('Grandparent', null); + final parent = makeInterface('Parent', grandparent); + final uncle = makeInterface('Uncle', grandparent); + final child = makeInterface('Child', parent); + + ObjCBlock makeBlock(Type returnType, List argTypes) => ObjCBlock( + returnType: returnType, + params: [ + for (final t in argTypes) Parameter(type: t, objCConsumed: false), + ], + returnsRetained: false, + builtInFunctions: builtInFunctions); + + group('ObjCInterface', () { + test('subtype', () { + expect(parent.isSubtypeOf(parent), isTrue); + expect(child.isSubtypeOf(child), isTrue); + + expect(parent.isSubtypeOf(grandparent), isTrue); + expect(grandparent.isSubtypeOf(parent), isFalse); + + expect(child.isSubtypeOf(grandparent), isTrue); + expect(grandparent.isSubtypeOf(child), isFalse); + + expect(child.isSubtypeOf(uncle), isFalse); + expect(uncle.isSubtypeOf(child), isFalse); + }); + + test('supertype', () { + expect(parent.isSupertypeOf(parent), isTrue); + expect(child.isSupertypeOf(child), isTrue); + + expect(parent.isSupertypeOf(grandparent), isFalse); + expect(grandparent.isSupertypeOf(parent), isTrue); + + expect(child.isSupertypeOf(grandparent), isFalse); + expect(grandparent.isSupertypeOf(child), isTrue); + + expect(child.isSupertypeOf(uncle), isFalse); + expect(uncle.isSupertypeOf(child), isFalse); + }); + }); + + group('FunctionType', () { + FunctionType makeFunc(Type returnType, List argTypes) => + FunctionType(returnType: returnType, parameters: [ + for (final t in argTypes) Parameter(type: t, objCConsumed: false), + ]); + + test('covariant returns', () { + // Return types are covariant. S Function() <: T Function() if S <: T. + final returnsParent = makeFunc(parent, []); + final returnsChild = makeFunc(child, []); + + expect(returnsParent.isSubtypeOf(returnsParent), isTrue); + expect(returnsChild.isSubtypeOf(returnsChild), isTrue); + expect(returnsChild.isSubtypeOf(returnsParent), isTrue); + expect(returnsParent.isSubtypeOf(returnsChild), isFalse); + }); + + test('contravariant args', () { + // Arg types are contravariant. Function(S) <: Function(T) if T <: S. + final acceptsParent = makeFunc(voidType, [parent]); + final acceptsChild = makeFunc(voidType, [child]); + + expect(acceptsParent.isSubtypeOf(acceptsParent), isTrue); + expect(acceptsChild.isSubtypeOf(acceptsChild), isTrue); + expect(acceptsChild.isSubtypeOf(acceptsParent), isFalse); + expect(acceptsParent.isSubtypeOf(acceptsChild), isTrue); + }); + + test('multiple args', () { + expect( + makeFunc(voidType, [parent, parent]) + .isSubtypeOf(makeFunc(voidType, [parent, parent])), + isTrue); + expect( + makeFunc(voidType, [parent, parent]) + .isSubtypeOf(makeFunc(voidType, [child, child])), + isTrue); + expect( + makeFunc(voidType, [child, child]) + .isSubtypeOf(makeFunc(voidType, [parent, parent])), + isFalse); + expect( + makeFunc(voidType, [child, parent]) + .isSubtypeOf(makeFunc(voidType, [parent, child])), + isFalse); + expect( + makeFunc(voidType, [parent, parent, parent]) + .isSubtypeOf(makeFunc(voidType, [child, child])), + isFalse); + expect( + makeFunc(voidType, [parent]) + .isSubtypeOf(makeFunc(voidType, [child, child])), + isFalse); + }); + + test('args and returns', () { + expect(makeFunc(child, [parent]).isSubtypeOf(makeFunc(parent, [child])), + isTrue); + expect(makeFunc(parent, [parent]).isSubtypeOf(makeFunc(child, [child])), + isFalse); + expect(makeFunc(child, [child]).isSubtypeOf(makeFunc(parent, [parent])), + isFalse); + expect(makeFunc(parent, [child]).isSubtypeOf(makeFunc(child, [parent])), + isFalse); + }); + + test('NativeFunc', () { + final returnsParent = NativeFunc(makeFunc(parent, [])); + final returnsChild = NativeFunc(makeFunc(child, [])); + + expect(returnsParent.isSubtypeOf(returnsParent), isTrue); + expect(returnsChild.isSubtypeOf(returnsChild), isTrue); + expect(returnsChild.isSubtypeOf(returnsParent), isTrue); + expect(returnsParent.isSubtypeOf(returnsChild), isFalse); + }); + }); + + group('ObjCBlock', () { + test('covariant returns', () { + // Return types are covariant. S Function() <: T Function() if S <: T. + final returnsParent = makeBlock(parent, []); + final returnsChild = makeBlock(child, []); + + expect(returnsParent.isSubtypeOf(returnsParent), isTrue); + expect(returnsChild.isSubtypeOf(returnsChild), isTrue); + expect(returnsChild.isSubtypeOf(returnsParent), isTrue); + expect(returnsParent.isSubtypeOf(returnsChild), isFalse); + }); + + test('contravariant args', () { + // Arg types are contravariant. Function(S) <: Function(T) if T <: S. + final acceptsParent = makeBlock(voidType, [parent]); + final acceptsChild = makeBlock(voidType, [child]); + + expect(acceptsParent.isSubtypeOf(acceptsParent), isTrue); + expect(acceptsChild.isSubtypeOf(acceptsChild), isTrue); + expect(acceptsChild.isSubtypeOf(acceptsParent), isFalse); + expect(acceptsParent.isSubtypeOf(acceptsChild), isTrue); + }); + + test('multiple args', () { + expect( + makeBlock(voidType, [parent, parent]) + .isSubtypeOf(makeBlock(voidType, [parent, parent])), + isTrue); + expect( + makeBlock(voidType, [parent, parent]) + .isSubtypeOf(makeBlock(voidType, [child, child])), + isTrue); + expect( + makeBlock(voidType, [child, child]) + .isSubtypeOf(makeBlock(voidType, [parent, parent])), + isFalse); + expect( + makeBlock(voidType, [child, parent]) + .isSubtypeOf(makeBlock(voidType, [parent, child])), + isFalse); + expect( + makeBlock(voidType, [parent, parent, parent]) + .isSubtypeOf(makeBlock(voidType, [child, child])), + isFalse); + expect( + makeBlock(voidType, [parent]) + .isSubtypeOf(makeBlock(voidType, [child, child])), + isFalse); + }); + + test('args and returns', () { + expect( + makeBlock(child, [parent]).isSubtypeOf(makeBlock(parent, [child])), + isTrue); + expect( + makeBlock(parent, [parent]).isSubtypeOf(makeBlock(child, [child])), + isFalse); + expect( + makeBlock(child, [child]).isSubtypeOf(makeBlock(parent, [parent])), + isFalse); + expect( + makeBlock(parent, [child]).isSubtypeOf(makeBlock(child, [parent])), + isFalse); + }); + }); + + test('ObjCNullable', () { + expect(ObjCNullable(parent).isSubtypeOf(ObjCNullable(parent)), isTrue); + expect(ObjCNullable(child).isSubtypeOf(ObjCNullable(parent)), isTrue); + expect(ObjCNullable(parent).isSubtypeOf(ObjCNullable(child)), isFalse); + expect(parent.isSubtypeOf(ObjCNullable(parent)), isTrue); + expect(ObjCNullable(parent).isSubtypeOf(parent), isFalse); + expect(child.isSubtypeOf(ObjCNullable(parent)), isTrue); + expect(ObjCNullable(child).isSubtypeOf(parent), isFalse); + expect(ObjCNullable(parent).isSubtypeOf(child), isFalse); + expect(parent.isSubtypeOf(ObjCNullable(child)), isFalse); + }); + + test('Typealias', () { + Typealias makeTypealias(Type t) => Typealias(name: '', type: t); + expect(makeTypealias(parent).isSubtypeOf(makeTypealias(parent)), isTrue); + expect(makeTypealias(child).isSubtypeOf(makeTypealias(parent)), isTrue); + expect(makeTypealias(parent).isSubtypeOf(makeTypealias(child)), isFalse); + expect(parent.isSubtypeOf(makeTypealias(parent)), isTrue); + expect(makeTypealias(parent).isSubtypeOf(parent), isTrue); + expect(child.isSubtypeOf(makeTypealias(parent)), isTrue); + expect(makeTypealias(child).isSubtypeOf(parent), isTrue); + expect(makeTypealias(parent).isSubtypeOf(child), isFalse); + expect(parent.isSubtypeOf(makeTypealias(child)), isFalse); + }); + + test('ObjCObjectPointer', () { + expect(ObjCObjectPointer().isSubtypeOf(ObjCObjectPointer()), isTrue); + expect(parent.isSubtypeOf(ObjCObjectPointer()), isTrue); + expect(ObjCObjectPointer().isSubtypeOf(parent), isFalse); + + final block = makeBlock(voidType, []); + expect(block.isSubtypeOf(ObjCObjectPointer()), isTrue); + expect(ObjCObjectPointer().isSubtypeOf(block), isFalse); + }); + + test('ObjCBlockPointer', () { + expect(ObjCBlockPointer().isSubtypeOf(ObjCBlockPointer()), isTrue); + expect(parent.isSubtypeOf(ObjCBlockPointer()), isFalse); + expect(ObjCBlockPointer().isSubtypeOf(parent), isFalse); + + final block = makeBlock(voidType, []); + expect(block.isSubtypeOf(ObjCBlockPointer()), isTrue); + expect(ObjCBlockPointer().isSubtypeOf(block), isFalse); + }); + }); +} diff --git a/pkgs/jni/CHANGELOG.md b/pkgs/jni/CHANGELOG.md index ab37ff4ef..db31af1ea 100644 --- a/pkgs/jni/CHANGELOG.md +++ b/pkgs/jni/CHANGELOG.md @@ -1,9 +1,25 @@ -## 0.12.1-wip +## 0.13.0 -- Add `JniUtils.fromReferenceAddress` which helps with sending `JObject`s +- **Breaking Change**: Separated primitive arrays from object arrays. + Previously, a primitive array like an array of bytes was typed + `JArray`. Now `JArray` only accepts `JObject`s as types and + primitive arrays like arrays of bytes have their own types such as + `JByteArray`. + + This enables all arrays to implement `Iterable` which makes it possible to use + them in a for-loop or use methods such as `map` on them. + +- Added nullable type classes for all Java objects. +- Fixed a problem where interfaces implemented in Dart would crash when calling + the default object methods: `equals`, `hashCode`, and `toString`. + +## 0.12.2 + +- Added `JniUtils.fromReferenceAddress` which helps with sending `JObject`s through method channels. You can send the address of the pointer as `long` and reconstruct the class using the helper method. - Fixed a bug where it would be possible for a type class inference to fail. +- Return 'null' when calling `toString` on a null object. ## 0.12.0 diff --git a/pkgs/jni/java/src/main/java/com/github/dart_lang/jni/PortProxyBuilder.java b/pkgs/jni/java/src/main/java/com/github/dart_lang/jni/PortProxyBuilder.java index 2f70b2b5d..178d25115 100644 --- a/pkgs/jni/java/src/main/java/com/github/dart_lang/jni/PortProxyBuilder.java +++ b/pkgs/jni/java/src/main/java/com/github/dart_lang/jni/PortProxyBuilder.java @@ -9,8 +9,20 @@ public class PortProxyBuilder implements InvocationHandler { private static final PortCleaner cleaner = new PortCleaner(); + private static final Method equals; + private static final Method hashCode; + private static final Method toString; static { + Class object = Object.class; + try { + equals = object.getDeclaredMethod("equals", object); + hashCode = object.getDeclaredMethod("hashCode"); + toString = object.getDeclaredMethod("toString"); + } catch (NoSuchMethodException e) { + // Never happens. + throw new Error(); + } System.loadLibrary("dartjni"); } @@ -115,6 +127,15 @@ private static native Object[] _invoke( @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (method.equals(equals)) { + return proxy == args[0]; + } + if (method.equals(hashCode)) { + return System.identityHashCode(proxy); + } + if (method.equals(toString)) { + return proxy.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(proxy)); + } DartImplementation implementation = implementations.get(method.getDeclaringClass().getName()); String descriptor = getDescriptor(method); boolean isBlocking = !asyncMethods.contains(descriptor); diff --git a/pkgs/jni/lib/_internal.dart b/pkgs/jni/lib/_internal.dart index 768be191f..9b5ce9aad 100644 --- a/pkgs/jni/lib/_internal.dart +++ b/pkgs/jni/lib/_internal.dart @@ -34,7 +34,6 @@ export 'src/method_invocation.dart'; export 'src/types.dart' show JAccessible, - JArrayElementType, JCallable, JConstructable, JObjType, diff --git a/pkgs/jni/lib/jni.dart b/pkgs/jni/lib/jni.dart index cb069dc21..2ebe0c375 100644 --- a/pkgs/jni/lib/jni.dart +++ b/pkgs/jni/lib/jni.dart @@ -63,6 +63,7 @@ library; export 'package:ffi/ffi.dart' show Arena, using; export 'src/errors.dart'; +export 'src/jarray.dart'; export 'src/jimplementer.dart'; export 'src/jni.dart' hide ProtectedJniExtensions, StringMethodsForJni; export 'src/jobject.dart'; @@ -75,7 +76,6 @@ export 'src/third_party/generated_bindings.dart' export 'src/types.dart' hide JAccessible, - JArrayElementType, JCallable, JConstructable, JObjType, diff --git a/pkgs/jni/lib/jni_symbols.yaml b/pkgs/jni/lib/jni_symbols.yaml index ac4a74c0c..c06c5eb91 100644 --- a/pkgs/jni/lib/jni_symbols.yaml +++ b/pkgs/jni/lib/jni_symbols.yaml @@ -4,50 +4,62 @@ files: 'java.lang.Object': name: JObject type_class: JObjectType + nullable_type_class: JObjectNullableType super_count: 0 'java.lang.String': name: JString type_class: JStringType + nullable_type_class: JStringNullableType super_count: 1 'java.lang.Number': name: JNumber type_class: JNumberType + nullable_type_class: JNumberNullableType super_count: 1 'java.lang.Byte': name: JByte type_class: JByteType + nullable_type_class: JByteNullableType super_count: 2 'java.lang.Short': name: JShort type_class: JShortType + nullable_type_class: JShortNullableType super_count: 2 'java.lang.Integer': name: JInteger type_class: JIntegerType + nullable_type_class: JIntegerNullableType super_count: 2 'java.lang.Long': name: JLong type_class: JLongType + nullable_type_class: JLongNullableType super_count: 2 'java.lang.Float': name: JFloat type_class: JFloatType + nullable_type_class: JFloatNullableType super_count: 2 'java.lang.Double': name: JDouble type_class: JDoubleType + nullable_type_class: JDoubleNullableType super_count: 2 'java.lang.Boolean': name: JBoolean type_class: JBooleanType + nullable_type_class: JBooleanNullableType super_count: 1 'java.lang.Character': name: JCharacter type_class: JCharacterType + nullable_type_class: JCharacterNullableType super_count: 1 'java.util.Set': name: JSet type_class: JSetType + nullable_type_class: JSetNullableType super_count: 1 type_params: E: @@ -55,6 +67,7 @@ files: 'java.util.List': name: JList type_class: JListType + nullable_type_class: JListNullableType super_count: 1 type_params: E: @@ -62,6 +75,7 @@ files: 'java.util.Iterator': name: JIterator type_class: JIteratorType + nullable_type_class: JIteratorNullableType super_count: 1 type_params: E: @@ -69,6 +83,7 @@ files: 'java.util.Map': name: JMap type_class: JMapType + nullable_type_class: JMapNullableType super_count: 1 type_params: K: @@ -78,8 +93,10 @@ files: 'java.nio.Buffer': name: JBuffer type_class: JBufferType + nullable_type_class: JBufferNullableType super_count: 1 'java.nio.ByteBuffer': name: JByteBuffer type_class: JByteBufferType + nullable_type_class: JByteBufferNullableType super_count: 2 diff --git a/pkgs/jni/lib/src/accessors.dart b/pkgs/jni/lib/src/accessors.dart index c90bd9529..548acb4cd 100644 --- a/pkgs/jni/lib/src/accessors.dart +++ b/pkgs/jni/lib/src/accessors.dart @@ -67,7 +67,7 @@ extension JniResultMethods on JniResult { return pointer == nullptr ? jNullReference : JGlobalReference(pointer); } - T object(JObjType type) { + T object(JObjType type) { return type.fromReference(reference); } diff --git a/pkgs/jni/lib/src/jarray.dart b/pkgs/jni/lib/src/jarray.dart index ff31034b8..f3eea8cb8 100644 --- a/pkgs/jni/lib/src/jarray.dart +++ b/pkgs/jni/lib/src/jarray.dart @@ -4,11 +4,61 @@ // ignore_for_file: unnecessary_cast, overridden_fields -part of 'types.dart'; +import 'dart:ffi'; +import 'dart:typed_data'; + +import 'package:ffi/ffi.dart'; +import 'package:meta/meta.dart'; + +import 'jni.dart'; +import 'jobject.dart'; +import 'jreference.dart'; +import 'third_party/generated_bindings.dart'; +import 'types.dart'; + +final class JArrayNullableType + extends JObjType?> { + @internal + final JObjType elementType; + + @internal + const JArrayNullableType(this.elementType); + + @internal + @override + String get signature => '[${elementType.signature}'; + + @internal + @override + JArray? fromReference(JReference reference) => + reference.isNull ? null : JArray.fromReference(elementType, reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); -final class JArrayType extends JObjType> { @internal - final JArrayElementType elementType; + @override + JObjType?> get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => Object.hash(JArrayNullableType, elementType); + + @override + bool operator ==(Object other) { + return other.runtimeType == (JArrayNullableType) && + other is JArrayNullableType && + elementType == other.elementType; + } +} + +final class JArrayType extends JObjType> { + @internal + final JObjType elementType; @internal const JArrayType(this.elementType); @@ -20,12 +70,16 @@ final class JArrayType extends JObjType> { @internal @override JArray fromReference(JReference reference) => - JArray.fromReference(elementType, reference); + JArray.fromReference(elementType, reference); @internal @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType?> get nullableType => JArrayNullableType(elementType); + @internal @override final int superCount = 1; @@ -41,28 +95,58 @@ final class JArrayType extends JObjType> { } } -class JArray extends JObject { +class JArray extends JObject with Iterable { @internal - final JArrayElementType elementType; + final JObjType elementType; @internal @override final JArrayType $type; /// The type which includes information such as the signature of this class. - static JArrayType type(JArrayElementType innerType) => - JArrayType(innerType); + static JArrayType type(JObjType innerType) => + JArrayType(innerType); + + /// The type which includes information such as the signature of this class. + static JArrayNullableType nullableType( + JObjType innerType) => + JArrayNullableType(innerType); /// Construct a new [JArray] with [reference] as its underlying reference. JArray.fromReference(this.elementType, JReference reference) - : $type = type(elementType), + : $type = type(elementType), super.fromReference(reference); /// Creates a [JArray] of the given length from the given [elementType]. /// /// The [length] must be a non-negative integer. - factory JArray(JArrayElementType elementType, int length) { - return elementType._newArray(length); + /// For objects, [elementType] must be a nullable type as this constructor + /// initializes all elements with `null`. + factory JArray(JObjType elementType, int length) { + RangeError.checkNotNegative(length); + if (!elementType.isNullable) { + throw StateError('Element type of JArray must be nullable when ' + 'all elements with null\n\n' + 'Try using .nullableType instead'); + } + return _newArray(elementType, length); + } + + static JArray<$E> _newArray<$E extends JObject?>( + JObjType<$E> elementType, int length, + [$E? fill]) { + final classRef = elementType.jClass.reference; + final fillRef = fill?.reference ?? jNullReference; + final array = JArray<$E>.fromReference( + elementType, + JGlobalReference(Jni.env.NewObjectArray( + length, + classRef.pointer, + fillRef.pointer, + )), + ); + classRef.release(); + return array; } /// Creates a [JArray] of the given length with [fill] at each position. @@ -72,29 +156,88 @@ class JArray extends JObject { {JObjType<$E>? E}) { RangeError.checkNotNegative(length); E ??= fill.$type as JObjType<$E>; - return E._newArray(length, fill); + return _newArray<$E>(E, length, fill); } - int? _length; - /// The number of elements in this array. - int get length { - return _length ??= Jni.env.GetArrayLength(reference.pointer); + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + E elementAt(int index) { + RangeError.checkValidIndex(index, this); + final pointer = Jni.env.GetObjectArrayElement(reference.pointer, index); + if (pointer == nullptr) { + return null as E; + } + return (elementType as JObjType) + .fromReference(JGlobalReference(pointer)); + } + + E operator [](int index) { + return elementAt(index); } + + void operator []=(int index, E value) { + RangeError.checkValidIndex(index, this); + final valueRef = value?.reference ?? jNullReference; + Jni.env.SetObjectArrayElement(reference.pointer, index, valueRef.pointer); + } + + void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { + RangeError.checkValidRange(start, end, length); + final rangeLength = end - start; + final it = iterable.skip(skipCount).take(rangeLength); + for (final (index, element) in it.indexed) { + this[index] = element; + } + } + + @override + Iterator get iterator => _JArrayIterator(this); } -extension NativeArray on JArray { - void _allocate( - int byteCount, - void Function(Pointer ptr) use, - ) { - using((arena) { - final ptr = arena.allocate(byteCount); - use(ptr); - }, malloc); +class _JArrayIterator implements Iterator { + final Iterable _iterable; + final int _length; + int _index; + E? _current; + + _JArrayIterator(Iterable iterable) + : _iterable = iterable, + _length = iterable.length, + _index = 0; + + @override + E get current => _current as E; + + @override + @pragma('vm:prefer-inline') + bool moveNext() { + final length = _iterable.length; + if (_length != length) { + throw ConcurrentModificationError(_iterable); + } + if (_index >= length) { + _current = null; + return false; + } + _current = _iterable.elementAt(_index); + _index++; + return true; } } +void _allocate( + int byteCount, + void Function(Pointer ptr) use, +) { + using((arena) { + final ptr = arena.allocate(byteCount); + use(ptr); + }, malloc); +} + extension on Allocator { Pointer? get _nativeFree { return switch (this) { @@ -105,12 +248,117 @@ extension on Allocator { } } -extension BoolArray on JArray { - bool operator [](int index) { +final class JBooleanArrayNullableType extends JObjType { + @internal + const JBooleanArrayNullableType(); + + @internal + @override + String get signature => '[Z'; + + @internal + @override + JBooleanArray? fromReference(JReference reference) => + reference.isNull ? null : JBooleanArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JBooleanArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JBooleanArrayNullableType && + other is JBooleanArrayNullableType; + } +} + +final class JBooleanArrayType extends JObjType { + @internal + const JBooleanArrayType(); + + @internal + @override + String get signature => '[Z'; + + @internal + @override + JBooleanArray fromReference(JReference reference) => + JBooleanArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => + const JBooleanArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JBooleanArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JBooleanArrayType && other is JBooleanArrayType; + } +} + +class JBooleanArray extends JObject with Iterable { + @internal + @override + final JBooleanArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JBooleanArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JBooleanArrayNullableType(); + + /// Construct a new [JBooleanArray] with [reference] as its underlying + /// reference. + JBooleanArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JBooleanArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JBooleanArray(int length) { + RangeError.checkNotNegative(length); + return JBooleanArray.fromReference( + JGlobalReference(Jni.env.NewBooleanArray(length)), + ); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + bool elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetBooleanArrayElement(reference.pointer, index); } + bool operator [](int index) { + return elementAt(index); + } + void operator []=(int index, bool value) { RangeError.checkValidIndex(index, this); Jni.env.SetBooleanArrayElement(reference.pointer, index, value); @@ -136,14 +384,120 @@ extension BoolArray on JArray { Jni.env.SetBooleanArrayRegion(reference.pointer, start, rangeLength, ptr); }); } + + @override + Iterator get iterator => _JArrayIterator(this); } -extension ByteArray on JArray { - int operator [](int index) { +final class JByteArrayNullableType extends JObjType { + @internal + const JByteArrayNullableType(); + + @internal + @override + String get signature => '[B'; + + @internal + @override + JByteArray? fromReference(JReference reference) => + reference.isNull ? null : JByteArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JByteArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JByteArrayNullableType && + other is JByteArrayNullableType; + } +} + +final class JByteArrayType extends JObjType { + @internal + const JByteArrayType(); + + @internal + @override + String get signature => '[B'; + + @internal + @override + JByteArray fromReference(JReference reference) => + JByteArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JByteArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JByteArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JByteArrayType && other is JByteArrayType; + } +} + +class JByteArray extends JObject with Iterable { + @internal + @override + final JByteArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JByteArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JByteArrayNullableType(); + + /// Construct a new [JByteArray] with [reference] as its underlying + /// reference. + JByteArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JByteArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JByteArray(int length) { + RangeError.checkNotNegative(length); + return JByteArray.fromReference( + JGlobalReference(Jni.env.NewByteArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + int elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetByteArrayElement(reference.pointer, index); } + int operator [](int index) { + return elementAt(index); + } + void operator []=(int index, int value) { RangeError.checkValidIndex(index, this); Jni.env.SetByteArrayElement(reference.pointer, index, value); @@ -168,50 +522,262 @@ extension ByteArray on JArray { Jni.env.SetByteArrayRegion(reference.pointer, start, rangeLength, ptr); }); } + + @override + Iterator get iterator => _JArrayIterator(this); } -/// `JArray` is a 16-bit integer array. -/// -/// Due to variable length encoding, the number of code units is not equal to -/// the number of characters. -extension CharArray on JArray { - int operator [](int index) { - RangeError.checkValidIndex(index, this); - return Jni.env.GetCharArrayElement(reference.pointer, index); - } +final class JCharArrayNullableType extends JObjType { + @internal + const JCharArrayNullableType(); - void operator []=(int index, int value) { - RangeError.checkValidIndex(index, this); - Jni.env.SetCharArrayElement(reference.pointer, index, value); - } + @internal + @override + String get signature => '[C'; - Uint16List getRange(int start, int end, {Allocator allocator = malloc}) { - RangeError.checkValidRange(start, end, length); - final rangeLength = end - start; - final buffer = allocator(rangeLength); - Jni.env.GetCharArrayRegion(reference.pointer, start, rangeLength, buffer); - return buffer.asTypedList(rangeLength, finalizer: allocator._nativeFree); - } + @internal + @override + JCharArray? fromReference(JReference reference) => + reference.isNull ? null : JCharArray.fromReference(reference); - void setRange(int start, int end, Iterable iterable, - [int skipCount = 0]) { - RangeError.checkValidRange(start, end, length); - final rangeLength = end - start; - _allocate(sizeOf() * rangeLength, (ptr) { - ptr - .asTypedList(rangeLength) - .setRange(0, rangeLength, iterable, skipCount); - Jni.env.SetCharArrayRegion(reference.pointer, start, rangeLength, ptr); - }); - } -} + @internal + @override + JObjType get superType => const JObjectNullableType(); -extension ShortArray on JArray { - int operator [](int index) { + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JCharArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JCharArrayNullableType && + other is JCharArrayNullableType; + } +} + +final class JCharArrayType extends JObjType { + @internal + const JCharArrayType(); + + @internal + @override + String get signature => '[C'; + + @internal + @override + JCharArray fromReference(JReference reference) => + JCharArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JCharArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JCharArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JCharArrayType && other is JCharArrayType; + } +} + +/// `JCharArray` is a 16-bit integer array. +/// +/// Due to variable length encoding, the number of code units is not equal to +/// the number of characters. +class JCharArray extends JObject with Iterable { + @internal + @override + final JCharArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JCharArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JCharArrayNullableType(); + + /// Construct a new [JCharArray] with [reference] as its underlying + /// reference. + JCharArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JCharArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JCharArray(int length) { + RangeError.checkNotNegative(length); + return JCharArray.fromReference( + JGlobalReference(Jni.env.NewCharArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + int elementAt(int index) { + RangeError.checkValidIndex(index, this); + return Jni.env.GetCharArrayElement(reference.pointer, index); + } + + int operator [](int index) { + return elementAt(index); + } + + void operator []=(int index, int value) { + RangeError.checkValidIndex(index, this); + Jni.env.SetCharArrayElement(reference.pointer, index, value); + } + + Uint16List getRange(int start, int end, {Allocator allocator = malloc}) { + RangeError.checkValidRange(start, end, length); + final rangeLength = end - start; + final buffer = allocator(rangeLength); + Jni.env.GetCharArrayRegion(reference.pointer, start, rangeLength, buffer); + return buffer.asTypedList(rangeLength, finalizer: allocator._nativeFree); + } + + void setRange(int start, int end, Iterable iterable, + [int skipCount = 0]) { + RangeError.checkValidRange(start, end, length); + final rangeLength = end - start; + _allocate(sizeOf() * rangeLength, (ptr) { + ptr + .asTypedList(rangeLength) + .setRange(0, rangeLength, iterable, skipCount); + Jni.env.SetCharArrayRegion(reference.pointer, start, rangeLength, ptr); + }); + } + + @override + Iterator get iterator => _JArrayIterator(this); +} + +final class JShortArrayNullableType extends JObjType { + @internal + const JShortArrayNullableType(); + + @internal + @override + String get signature => '[S'; + + @internal + @override + JShortArray? fromReference(JReference reference) => + reference.isNull ? null : JShortArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JShortArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JShortArrayNullableType && + other is JShortArrayNullableType; + } +} + +final class JShortArrayType extends JObjType { + @internal + const JShortArrayType(); + + @internal + @override + String get signature => '[S'; + + @internal + @override + JShortArray fromReference(JReference reference) => + JShortArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JShortArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JShortArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JShortArrayType && other is JShortArrayType; + } +} + +class JShortArray extends JObject with Iterable { + @internal + @override + final JShortArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JShortArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JShortArrayNullableType(); + + /// Construct a new [JShortArray] with [reference] as its underlying + /// reference. + JShortArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JShortArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JShortArray(int length) { + RangeError.checkNotNegative(length); + return JShortArray.fromReference( + JGlobalReference(Jni.env.NewShortArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + int elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetShortArrayElement(reference.pointer, index); } + int operator [](int index) { + return elementAt(index); + } + void operator []=(int index, int value) { RangeError.checkValidIndex(index, this); Jni.env.SetShortArrayElement(reference.pointer, index, value); @@ -236,14 +802,120 @@ extension ShortArray on JArray { Jni.env.SetShortArrayRegion(reference.pointer, start, rangeLength, ptr); }); } + + @override + Iterator get iterator => _JArrayIterator(this); } -extension IntArray on JArray { - int operator [](int index) { +final class JIntArrayNullableType extends JObjType { + @internal + const JIntArrayNullableType(); + + @internal + @override + String get signature => '[I'; + + @internal + @override + JIntArray? fromReference(JReference reference) => + reference.isNull ? null : JIntArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JIntArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JIntArrayNullableType && + other is JIntArrayNullableType; + } +} + +final class JIntArrayType extends JObjType { + @internal + const JIntArrayType(); + + @internal + @override + String get signature => '[I'; + + @internal + @override + JIntArray fromReference(JReference reference) => + JIntArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JIntArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JIntArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JIntArrayType && other is JIntArrayType; + } +} + +class JIntArray extends JObject with Iterable { + @internal + @override + final JIntArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JIntArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JIntArrayNullableType(); + + /// Construct a new [JIntArray] with [reference] as its underlying + /// reference. + JIntArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JIntArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JIntArray(int length) { + RangeError.checkNotNegative(length); + return JIntArray.fromReference( + JGlobalReference(Jni.env.NewIntArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + int elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetIntArrayElement(reference.pointer, index); } + int operator [](int index) { + return elementAt(index); + } + void operator []=(int index, int value) { RangeError.checkValidIndex(index, this); Jni.env.SetIntArrayElement(reference.pointer, index, value); @@ -268,14 +940,120 @@ extension IntArray on JArray { Jni.env.SetIntArrayRegion(reference.pointer, start, rangeLength, ptr); }); } + + @override + Iterator get iterator => _JArrayIterator(this); } -extension LongArray on JArray { - int operator [](int index) { +final class JLongArrayNullableType extends JObjType { + @internal + const JLongArrayNullableType(); + + @internal + @override + String get signature => '[J'; + + @internal + @override + JLongArray? fromReference(JReference reference) => + reference.isNull ? null : JLongArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JLongArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JLongArrayNullableType && + other is JLongArrayNullableType; + } +} + +final class JLongArrayType extends JObjType { + @internal + const JLongArrayType(); + + @internal + @override + String get signature => '[J'; + + @internal + @override + JLongArray fromReference(JReference reference) => + JLongArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JLongArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JLongArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JLongArrayType && other is JLongArrayType; + } +} + +class JLongArray extends JObject with Iterable { + @internal + @override + final JLongArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JLongArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JLongArrayNullableType(); + + /// Construct a new [JLongArray] with [reference] as its underlying + /// reference. + JLongArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JLongArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JLongArray(int length) { + RangeError.checkNotNegative(length); + return JLongArray.fromReference( + JGlobalReference(Jni.env.NewLongArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + int elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetLongArrayElement(reference.pointer, index); } + int operator [](int index) { + return elementAt(index); + } + void operator []=(int index, int value) { RangeError.checkValidIndex(index, this); Jni.env.SetLongArrayElement(reference.pointer, index, value); @@ -300,14 +1078,120 @@ extension LongArray on JArray { Jni.env.SetLongArrayRegion(reference.pointer, start, rangeLength, ptr); }); } + + @override + Iterator get iterator => _JArrayIterator(this); } -extension FloatArray on JArray { - double operator [](int index) { +final class JFloatArrayNullableType extends JObjType { + @internal + const JFloatArrayNullableType(); + + @internal + @override + String get signature => '[F'; + + @internal + @override + JFloatArray? fromReference(JReference reference) => + reference.isNull ? null : JFloatArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JFloatArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JFloatArrayNullableType && + other is JFloatArrayNullableType; + } +} + +final class JFloatArrayType extends JObjType { + @internal + const JFloatArrayType(); + + @internal + @override + String get signature => '[F'; + + @internal + @override + JFloatArray fromReference(JReference reference) => + JFloatArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JFloatArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JFloatArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JFloatArrayType && other is JFloatArrayType; + } +} + +class JFloatArray extends JObject with Iterable { + @internal + @override + final JFloatArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JFloatArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JFloatArrayNullableType(); + + /// Construct a new [JFloatArray] with [reference] as its underlying + /// reference. + JFloatArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JFloatArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JFloatArray(int length) { + RangeError.checkNotNegative(length); + return JFloatArray.fromReference( + JGlobalReference(Jni.env.NewFloatArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + double elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetFloatArrayElement(reference.pointer, index); } + double operator [](int index) { + return elementAt(index); + } + void operator []=(int index, double value) { RangeError.checkValidIndex(index, this); Jni.env.SetFloatArrayElement(reference.pointer, index, value); @@ -332,14 +1216,120 @@ extension FloatArray on JArray { Jni.env.SetFloatArrayRegion(reference.pointer, start, rangeLength, ptr); }); } + + @override + Iterator get iterator => _JArrayIterator(this); } -extension DoubleArray on JArray { - double operator [](int index) { +final class JDoubleArrayNullableType extends JObjType { + @internal + const JDoubleArrayNullableType(); + + @internal + @override + String get signature => '[D'; + + @internal + @override + JDoubleArray? fromReference(JReference reference) => + reference.isNull ? null : JDoubleArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JDoubleArrayNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JDoubleArrayNullableType && + other is JDoubleArrayNullableType; + } +} + +final class JDoubleArrayType extends JObjType { + @internal + const JDoubleArrayType(); + + @internal + @override + String get signature => '[D'; + + @internal + @override + JDoubleArray fromReference(JReference reference) => + JDoubleArray.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType get nullableType => const JDoubleArrayNullableType(); + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JDoubleArrayType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JDoubleArrayType && other is JDoubleArrayType; + } +} + +class JDoubleArray extends JObject with Iterable { + @internal + @override + final JDoubleArrayType $type; + + /// The type which includes information such as the signature of this class. + static const type = JDoubleArrayType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JDoubleArrayNullableType(); + + /// Construct a new [JDoubleArray] with [reference] as its underlying + /// reference. + JDoubleArray.fromReference(super.reference) + : $type = type, + super.fromReference(); + + /// Creates a [JDoubleArray] of the given [length]. + /// + /// The [length] must be a non-negative integer. + factory JDoubleArray(int length) { + RangeError.checkNotNegative(length); + return JDoubleArray.fromReference( + JGlobalReference(Jni.env.NewDoubleArray(length))); + } + + /// The number of elements in this array. + @override + late final length = Jni.env.GetArrayLength(reference.pointer); + + @override + double elementAt(int index) { RangeError.checkValidIndex(index, this); return Jni.env.GetDoubleArrayElement(reference.pointer, index); } + double operator [](int index) { + return elementAt(index); + } + void operator []=(int index, double value) { RangeError.checkValidIndex(index, this); Jni.env.SetDoubleArrayElement(reference.pointer, index, value); @@ -364,27 +1354,7 @@ extension DoubleArray on JArray { Jni.env.SetDoubleArrayRegion(reference.pointer, start, rangeLength, ptr); }); } -} -extension ObjectArray on JArray { - T operator [](int index) { - RangeError.checkValidIndex(index, this); - return (elementType as JObjType).fromReference(JGlobalReference( - Jni.env.GetObjectArrayElement(reference.pointer, index))); - } - - void operator []=(int index, T value) { - RangeError.checkValidIndex(index, this); - Jni.env.SetObjectArrayElement( - reference.pointer, index, value.reference.pointer); - } - - void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { - RangeError.checkValidRange(start, end, length); - final rangeLength = end - start; - final it = iterable.skip(skipCount).take(rangeLength); - for (final (index, element) in it.indexed) { - this[index] = element; - } - } + @override + Iterator get iterator => _JArrayIterator(this); } diff --git a/pkgs/jni/lib/src/jclass.dart b/pkgs/jni/lib/src/jclass.dart index 7f9bb4dfc..4807580e0 100644 --- a/pkgs/jni/lib/src/jclass.dart +++ b/pkgs/jni/lib/src/jclass.dart @@ -40,38 +40,48 @@ class JClass extends JObject { /// A thin wrapper over a [JFieldIDPtr] of an instance field. extension type JInstanceFieldId._fromPointer(JFieldIDPtr pointer) { JInstanceFieldId._(JClass jClass, String name, String signature) - : pointer = using((arena) => Jni.env.GetFieldID( - jClass.reference.pointer, - name.toNativeChars(arena), - signature.toNativeChars(arena), - )); + : pointer = using((arena) { + final jClassRef = jClass.reference; + return Jni.env.GetFieldID( + jClassRef.pointer, + name.toNativeChars(arena), + signature.toNativeChars(arena), + ); + }); DartT get(JObject object, JAccessible type) { - return type._instanceGet(object.reference.pointer, this as JFieldIDPtr); + final objectRef = object.reference; + return type._instanceGet(objectRef.pointer, this as JFieldIDPtr); } void set( JObject object, JAccessible type, DartT value) { - type._instanceSet(object.reference.pointer, this as JFieldIDPtr, value); + final objectRef = object.reference; + type._instanceSet(objectRef.pointer, this as JFieldIDPtr, value); } } /// A thin wrapper over a [JFieldIDPtr] of an static field. extension type JStaticFieldId._fromPointer(JFieldIDPtr pointer) { JStaticFieldId._(JClass jClass, String name, String signature) - : pointer = using((arena) => Jni.env.GetStaticFieldID( - jClass.reference.pointer, - name.toNativeChars(arena), - signature.toNativeChars(arena), - )); + : pointer = using((arena) { + final jClassRef = jClass.reference; + return Jni.env.GetStaticFieldID( + jClassRef.pointer, + name.toNativeChars(arena), + signature.toNativeChars(arena), + ); + }); DartT get(JClass jClass, JAccessible type) { - return type._staticGet(jClass.reference.pointer, this as JFieldIDPtr); + final jClassRef = jClass.reference; + return type._staticGet(jClassRef.pointer, this as JFieldIDPtr); } void set( JObject object, JAccessible type, DartT value) { - type._staticSet(object.reference.pointer, this as JFieldIDPtr, value); + final objectRef = object.reference; + type._staticSet(objectRef.pointer, this as JFieldIDPtr, value); } } @@ -81,11 +91,14 @@ extension type JInstanceMethodId._fromPointer(JMethodIDPtr pointer) { JClass jClass, String name, String signature, - ) : pointer = using((arena) => Jni.env.GetMethodID( - jClass.reference.pointer, - name.toNativeChars(arena), - signature.toNativeChars(arena), - )); + ) : pointer = using((arena) { + final jClassRef = jClass.reference; + return Jni.env.GetMethodID( + jClassRef.pointer, + name.toNativeChars(arena), + signature.toNativeChars(arena), + ); + }); /// Calls the instance method on [object] with the given arguments. DartT call( @@ -93,8 +106,11 @@ extension type JInstanceMethodId._fromPointer(JMethodIDPtr pointer) { JCallable returnType, List args, ) { - return using((arena) => returnType._instanceCall(object.reference.pointer, - this as JMethodIDPtr, toJValues(args, allocator: arena))); + return using((arena) { + final objectRef = object.reference; + return returnType._instanceCall(objectRef.pointer, this as JMethodIDPtr, + toJValues(args, allocator: arena)); + }); } } @@ -104,11 +120,14 @@ extension type JStaticMethodId._fromPointer(JMethodIDPtr pointer) { JClass jClass, String name, String signature, - ) : pointer = using((arena) => Jni.env.GetStaticMethodID( - jClass.reference.pointer, - name.toNativeChars(arena), - signature.toNativeChars(arena), - )); + ) : pointer = using((arena) { + final jClassRef = jClass.reference; + return Jni.env.GetStaticMethodID( + jClassRef.pointer, + name.toNativeChars(arena), + signature.toNativeChars(arena), + ); + }); /// Calls the static method on [jClass] with the given arguments. DartT call( @@ -116,7 +135,8 @@ extension type JStaticMethodId._fromPointer(JMethodIDPtr pointer) { JCallable returnType, List args, ) { - return using((arena) => returnType._staticCall(jClass.reference.pointer, + final jClassRef = jClass.reference; + return using((arena) => returnType._staticCall(jClassRef.pointer, this as JMethodIDPtr, toJValues(args, allocator: arena))); } } @@ -126,16 +146,22 @@ extension type JConstructorId._fromPointer(JMethodIDPtr pointer) { JConstructorId._( JClass jClass, String signature, - ) : pointer = using((arena) => Jni.env.GetMethodID( - jClass.reference.pointer, - ''.toNativeChars(arena), - signature.toNativeChars(arena), - )); + ) : pointer = using((arena) { + final jClassRef = jClass.reference; + return Jni.env.GetMethodID( + jClassRef.pointer, + ''.toNativeChars(arena), + signature.toNativeChars(arena), + ); + }); /// Constructs an instance of [jClass] with the given arguments. DartT call(JClass jClass, JConstructable returnType, List args) { - return using((arena) => returnType._newObject(jClass.reference.pointer, - this as JMethodIDPtr, toJValues(args, allocator: arena))); + return using((arena) { + final jClassRef = jClass.reference; + return returnType._newObject(jClassRef.pointer, this as JMethodIDPtr, + toJValues(args, allocator: arena)); + }); } } diff --git a/pkgs/jni/lib/src/jimplementer.dart b/pkgs/jni/lib/src/jimplementer.dart index 8b66b8a8f..6d77cd2d3 100644 --- a/pkgs/jni/lib/src/jimplementer.dart +++ b/pkgs/jni/lib/src/jimplementer.dart @@ -70,10 +70,12 @@ class JImplementer extends JObject { List asyncMethods, ) { using((arena) { + final binaryNameRef = + (binaryName.toJString()..releasedBy(arena)).reference; _addImplementation( reference.pointer, _addImplementationId as JMethodIDPtr, - (binaryName.toJString()..releasedBy(arena)).reference.pointer, + binaryNameRef.pointer, port.sendPort.nativePort, pointer.address, (asyncMethods diff --git a/pkgs/jni/lib/src/jni.dart b/pkgs/jni/lib/src/jni.dart index 6d19e844d..29423de00 100644 --- a/pkgs/jni/lib/src/jni.dart +++ b/pkgs/jni/lib/src/jni.dart @@ -249,10 +249,12 @@ extension ProtectedJniExtensions on Jni { /// Returns a new DartException. static Pointer newDartException(Object exception) { JObjectPtr? cause; - if (exception is JObject && - Jni.env.IsInstanceOf( - exception.reference.pointer, _jThrowableClass.reference.pointer)) { - cause = exception.reference.pointer; + if (exception is JObject) { + final exceptionRef = exception.reference; + if (Jni.env.IsInstanceOf( + exceptionRef.pointer, _jThrowableClass.reference.pointer)) { + cause = exceptionRef.pointer; + } } return Jni._bindings .DartException__ctor( diff --git a/pkgs/jni/lib/src/jobject.dart b/pkgs/jni/lib/src/jobject.dart index 9390b7aee..537e99605 100644 --- a/pkgs/jni/lib/src/jobject.dart +++ b/pkgs/jni/lib/src/jobject.dart @@ -3,14 +3,50 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:ffi'; -import 'package:ffi/ffi.dart'; import 'package:meta/meta.dart' show internal; -import 'jni.dart'; +import '../jni.dart'; import 'jreference.dart'; -import 'lang/jstring.dart'; import 'types.dart'; +final class JObjectNullableType extends JObjType { + @internal + const JObjectNullableType(); + + @internal + @override + String get signature => 'Ljava/lang/Object;'; + + @internal + @override + JObject? fromReference(JReference reference) => + reference.isNull ? null : JObject.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + // TODO(#70): Once interface implementation lands, other than [superType], + // we should have a list of implemented interfaces. + + @internal + @override + final int superCount = 0; + + @override + int get hashCode => (JObjectNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JObjectNullableType && + other is JObjectNullableType; + } +} + final class JObjectType extends JObjType { @internal const JObjectType(); @@ -28,6 +64,10 @@ final class JObjectType extends JObjType { @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType get nullableType => const JObjectNullableType(); + // TODO(#70): Once interface implementation lands, other than [superType], // we should have a list of implemented interfaces. @@ -57,8 +97,14 @@ class JObject { /// The type which includes information such as the signature of this class. static const JObjType type = JObjectType(); + static const JObjType nullableType = JObjectNullableType(); + /// Constructs a [JObject] with the underlying [reference]. - JObject.fromReference(this.reference); + JObject.fromReference(this.reference) { + if (reference.isNull) { + throw JNullError(); + } + } /// Returns [JClass] corresponding to concrete class of this object. /// @@ -71,8 +117,6 @@ class JObject { return JClass.fromReference(JGlobalReference(classRef)); } - bool get isNull => reference.isNull; - /// Releases the underlying [reference]. /// /// Releasing in one isolate while using or releasing in another isolate might @@ -84,7 +128,7 @@ class JObject { /// Casts this object to another [type]. /// /// If [releaseOriginal] is `true`, the casted object will be released. - T as( + T as( JObjType type, { bool releaseOriginal = false, }) { @@ -111,7 +155,7 @@ class JObject { static final _hashCodeId = _class.instanceMethodId(r'hashCode', r'()I'); @override - int get hashCode => _hashCodeId(this, const jintType(), []); + int get hashCode => _hashCodeId(this, const jintType(), [])!; static final _equalsId = _class.instanceMethodId(r'equals', r'(Ljava/lang/Object;)Z'); @@ -120,7 +164,8 @@ class JObject { if (other is! JObject) { return false; } - return _equalsId(this, const jbooleanType(), [other.reference.pointer]); + final otherRef = other.reference; + return _equalsId(this, const jbooleanType(), [otherRef.pointer])!; } static final _toStringId = diff --git a/pkgs/jni/lib/src/jprimitives.dart b/pkgs/jni/lib/src/jprimitives.dart index 7e0997120..c63210e96 100644 --- a/pkgs/jni/lib/src/jprimitives.dart +++ b/pkgs/jni/lib/src/jprimitives.dart @@ -15,10 +15,7 @@ abstract final class jbyte extends JPrimitive { } final class jbyteType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jbyteType(); @@ -57,14 +54,6 @@ final class jbyteType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, int val) { return Jni.env.SetStaticByteField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewByteArray(length)), - ); - } } abstract final class jboolean extends JPrimitive { @@ -72,10 +61,7 @@ abstract final class jboolean extends JPrimitive { } final class jbooleanType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jbooleanType(); @@ -114,14 +100,6 @@ final class jbooleanType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, bool val) { return Jni.env.SetStaticBooleanField(clazz, fieldID, val ? 1 : 0); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewBooleanArray(length)), - ); - } } abstract final class jchar extends JPrimitive { @@ -129,10 +107,7 @@ abstract final class jchar extends JPrimitive { } final class jcharType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jcharType(); @@ -171,14 +146,6 @@ final class jcharType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, int val) { return Jni.env.SetStaticCharField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewCharArray(length)), - ); - } } abstract final class jshort extends JPrimitive { @@ -186,10 +153,7 @@ abstract final class jshort extends JPrimitive { } final class jshortType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jshortType(); @@ -228,14 +192,6 @@ final class jshortType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, int val) { return Jni.env.SetStaticShortField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewShortArray(length)), - ); - } } abstract final class jint extends JPrimitive { @@ -243,7 +199,7 @@ abstract final class jint extends JPrimitive { } final class jintType extends JType - with JCallable, JAccessible, JArrayElementType { + with JCallable, JAccessible { @internal const jintType(); @@ -281,14 +237,6 @@ final class jintType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, int val) { return Jni.env.SetStaticIntField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewIntArray(length)), - ); - } } abstract final class jlong extends JPrimitive { @@ -296,10 +244,7 @@ abstract final class jlong extends JPrimitive { } final class jlongType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jlongType(); @@ -337,14 +282,6 @@ final class jlongType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, int val) { return Jni.env.SetStaticLongField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewLongArray(length)), - ); - } } abstract final class jfloat extends JPrimitive { @@ -352,10 +289,7 @@ abstract final class jfloat extends JPrimitive { } final class jfloatType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jfloatType(); @@ -394,14 +328,6 @@ final class jfloatType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, double val) { return Jni.env.SetStaticFloatField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewFloatArray(length)), - ); - } } abstract final class jdouble extends JPrimitive { @@ -409,10 +335,7 @@ abstract final class jdouble extends JPrimitive { } final class jdoubleType extends JType - with - JCallable, - JAccessible, - JArrayElementType { + with JCallable, JAccessible { @internal const jdoubleType(); @@ -451,14 +374,6 @@ final class jdoubleType extends JType void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, double val) { return Jni.env.SetStaticDoubleField(clazz, fieldID, val); } - - @override - JArray _newArray(int length) { - return JArray.fromReference( - this, - JGlobalReference(Jni.env.NewDoubleArray(length)), - ); - } } abstract final class jvoid extends JPrimitive { diff --git a/pkgs/jni/lib/src/jreference.dart b/pkgs/jni/lib/src/jreference.dart index 411bf5bfe..9a5655f9f 100644 --- a/pkgs/jni/lib/src/jreference.dart +++ b/pkgs/jni/lib/src/jreference.dart @@ -17,12 +17,6 @@ extension ProtectedJReference on JReference { _setAsReleased(); } - void ensureNotNull() { - if (isNull) { - throw JNullError(); - } - } - /// Similar to [pointer]. /// /// Detaches the finalizer so the underlying pointer will not be deleted. diff --git a/pkgs/jni/lib/src/jvalues.dart b/pkgs/jni/lib/src/jvalues.dart index 0b95e5b22..950c6f515 100644 --- a/pkgs/jni/lib/src/jvalues.dart +++ b/pkgs/jni/lib/src/jvalues.dart @@ -5,12 +5,13 @@ import 'dart:ffi'; import '../_internal.dart'; - import 'jobject.dart'; import 'third_party/generated_bindings.dart'; void _fillJValue(Pointer pos, dynamic arg) { switch (arg) { + case null: + pos.ref.l = nullptr; case JObject(): pos.ref.l = arg.reference.pointer; case JReference(): diff --git a/pkgs/jni/lib/src/lang/jboolean.dart b/pkgs/jni/lib/src/lang/jboolean.dart index 0513ab745..db172bfbe 100644 --- a/pkgs/jni/lib/src/lang/jboolean.dart +++ b/pkgs/jni/lib/src/lang/jboolean.dart @@ -8,6 +8,41 @@ import '../jobject.dart'; import '../jreference.dart'; import '../types.dart'; +final class JBooleanNullableType extends JObjType { + @internal + const JBooleanNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Boolean;'; + + @internal + @override + JBoolean? fromReference(JReference reference) => + reference.isNull ? null : JBoolean.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JBooleanNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JBooleanNullableType && + other is JBooleanNullableType; + } +} + final class JBooleanType extends JObjType { @internal const JBooleanType(); @@ -25,6 +60,10 @@ final class JBooleanType extends JObjType { @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType get nullableType => const JBooleanNullableType(); + @internal @override final superCount = 2; @@ -51,6 +90,9 @@ class JBoolean extends JObject { /// The type which includes information such as the signature of this class. static const type = JBooleanType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JBooleanNullableType(); + static final _class = JClass.forName(r'java/lang/Boolean'); static final _ctorId = _class.constructorId(r'(Z)V'); @@ -61,7 +103,6 @@ class JBoolean extends JObject { _class.instanceMethodId(r'booleanValue', r'()Z'); bool booleanValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _booleanValueId(this, const jbooleanType(), []); if (releaseOriginal) { release(); diff --git a/pkgs/jni/lib/src/lang/jbyte.dart b/pkgs/jni/lib/src/lang/jbyte.dart index db4a39ca3..8435dee27 100644 --- a/pkgs/jni/lib/src/lang/jbyte.dart +++ b/pkgs/jni/lib/src/lang/jbyte.dart @@ -9,6 +9,40 @@ import '../jvalues.dart'; import '../types.dart'; import 'jnumber.dart'; +final class JByteNullableType extends JObjType { + @internal + const JByteNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Byte;'; + + @internal + @override + JByte? fromReference(JReference reference) => + reference.isNull ? null : JByte.fromReference(reference); + + @internal + @override + JObjType get superType => const JNumberNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JByteNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JByteNullableType && other is JByteNullableType; + } +} + final class JByteType extends JObjType { @internal const JByteType(); @@ -25,6 +59,10 @@ final class JByteType extends JObjType { @override JObjType get superType => const JNumberType(); + @internal + @override + JObjType get nullableType => const JByteNullableType(); + @internal @override final superCount = 2; @@ -51,6 +89,9 @@ class JByte extends JNumber { /// The type which includes information such as the signature of this class. static const type = JByteType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JByteNullableType(); + static final _class = JClass.forName(r'java/lang/Byte'); static final _ctorId = _class.constructorId(r'(B)V'); diff --git a/pkgs/jni/lib/src/lang/jcharacter.dart b/pkgs/jni/lib/src/lang/jcharacter.dart index 4730d73fa..1c49d5bba 100644 --- a/pkgs/jni/lib/src/lang/jcharacter.dart +++ b/pkgs/jni/lib/src/lang/jcharacter.dart @@ -9,6 +9,41 @@ import '../jreference.dart'; import '../jvalues.dart'; import '../types.dart'; +final class JCharacterNullableType extends JObjType { + @internal + const JCharacterNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Character;'; + + @internal + @override + JCharacter? fromReference(JReference reference) => + reference.isNull ? null : JCharacter.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => (JCharacterNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JCharacterNullableType && + other is JCharacterNullableType; + } +} + final class JCharacterType extends JObjType { @internal const JCharacterType(); @@ -26,6 +61,10 @@ final class JCharacterType extends JObjType { @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType get nullableType => const JCharacterNullableType(); + @internal @override final superCount = 1; @@ -52,6 +91,9 @@ class JCharacter extends JObject { /// The type which includes information such as the signature of this class. static const type = JCharacterType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JCharacterNullableType(); + static final _class = JClass.forName(r'java/lang/Character'); static final _ctorId = _class.constructorId(r'(C)V'); @@ -62,7 +104,6 @@ class JCharacter extends JObject { static final _charValueId = _class.instanceMethodId(r'charValue', r'()C'); int charValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _charValueId(this, const jcharType(), []); if (releaseOriginal) { release(); diff --git a/pkgs/jni/lib/src/lang/jdouble.dart b/pkgs/jni/lib/src/lang/jdouble.dart index 6bad5c65b..902fa2ab3 100644 --- a/pkgs/jni/lib/src/lang/jdouble.dart +++ b/pkgs/jni/lib/src/lang/jdouble.dart @@ -8,6 +8,41 @@ import '../jreference.dart'; import '../types.dart'; import 'jnumber.dart'; +final class JDoubleNullableType extends JObjType { + @internal + const JDoubleNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Double;'; + + @internal + @override + JDouble? fromReference(JReference reference) => + reference.isNull ? null : JDouble.fromReference(reference); + + @internal + @override + JObjType get superType => const JNumberNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JDoubleNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JDoubleNullableType && + other is JDoubleNullableType; + } +} + final class JDoubleType extends JObjType { @internal const JDoubleType(); @@ -25,6 +60,10 @@ final class JDoubleType extends JObjType { @override JObjType get superType => const JNumberType(); + @internal + @override + JObjType get nullableType => const JDoubleNullableType(); + @internal @override final superCount = 2; @@ -51,6 +90,9 @@ class JDouble extends JNumber { /// The type which includes information such as the signature of this class. static const type = JDoubleType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JDoubleNullableType(); + static final _class = JClass.forName(r'java/lang/Double'); static final _ctorId = _class.constructorId(r'(D)V'); diff --git a/pkgs/jni/lib/src/lang/jfloat.dart b/pkgs/jni/lib/src/lang/jfloat.dart index 744a91528..672d6095b 100644 --- a/pkgs/jni/lib/src/lang/jfloat.dart +++ b/pkgs/jni/lib/src/lang/jfloat.dart @@ -9,6 +9,41 @@ import '../jvalues.dart'; import '../types.dart'; import 'jnumber.dart'; +final class JFloatNullableType extends JObjType { + @internal + const JFloatNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Float;'; + + @internal + @override + JFloat? fromReference(JReference reference) => + reference.isNull ? null : JFloat.fromReference(reference); + + @internal + @override + JObjType get superType => const JNumberNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JFloatNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JFloatNullableType && + other is JFloatNullableType; + } +} + final class JFloatType extends JObjType { @internal const JFloatType(); @@ -25,6 +60,10 @@ final class JFloatType extends JObjType { @override JObjType get superType => const JNumberType(); + @internal + @override + JObjType get nullableType => const JFloatNullableType(); + @internal @override final superCount = 2; @@ -51,6 +90,9 @@ class JFloat extends JNumber { /// The type which includes information such as the signature of this class. static const type = JFloatType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JFloatNullableType(); + static final _class = JClass.forName(r'java/lang/Float'); static final _ctorId = _class.constructorId(r'(F)V'); diff --git a/pkgs/jni/lib/src/lang/jinteger.dart b/pkgs/jni/lib/src/lang/jinteger.dart index a527cde11..2d0408dcb 100644 --- a/pkgs/jni/lib/src/lang/jinteger.dart +++ b/pkgs/jni/lib/src/lang/jinteger.dart @@ -9,6 +9,41 @@ import '../jvalues.dart'; import '../types.dart'; import 'jnumber.dart'; +final class JIntegerNullableType extends JObjType { + @internal + const JIntegerNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Integer;'; + + @internal + @override + JInteger? fromReference(JReference reference) => + reference.isNull ? null : JInteger.fromReference(reference); + + @internal + @override + JObjType get superType => const JNumberNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JIntegerNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JIntegerNullableType && + other is JIntegerNullableType; + } +} + final class JIntegerType extends JObjType { @internal const JIntegerType(); @@ -26,6 +61,10 @@ final class JIntegerType extends JObjType { @override JObjType get superType => const JNumberType(); + @internal + @override + JObjType get nullableType => const JIntegerNullableType(); + @internal @override final superCount = 2; @@ -52,6 +91,9 @@ class JInteger extends JNumber { /// The type which includes information such as the signature of this class. static const type = JIntegerType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JIntegerNullableType(); + static final _class = JClass.forName(r'java/lang/Integer'); static final _ctorId = _class.constructorId('(I)V'); diff --git a/pkgs/jni/lib/src/lang/jlong.dart b/pkgs/jni/lib/src/lang/jlong.dart index 5dc9c8530..0097b4953 100644 --- a/pkgs/jni/lib/src/lang/jlong.dart +++ b/pkgs/jni/lib/src/lang/jlong.dart @@ -8,6 +8,40 @@ import '../jreference.dart'; import '../types.dart'; import 'jnumber.dart'; +final class JLongNullableType extends JObjType { + @internal + const JLongNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Long;'; + + @internal + @override + JLong? fromReference(JReference reference) => + reference.isNull ? null : JLong.fromReference(reference); + + @internal + @override + JObjType get superType => const JNumberNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JLongNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JLongNullableType && other is JLongNullableType; + } +} + final class JLongType extends JObjType { @internal const JLongType(); @@ -24,6 +58,10 @@ final class JLongType extends JObjType { @override JObjType get superType => const JNumberType(); + @internal + @override + JObjType get nullableType => const JLongNullableType(); + @internal @override final superCount = 2; @@ -50,6 +88,9 @@ class JLong extends JNumber { /// The type which includes information such as the signature of this class. static const type = JLongType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JLongNullableType(); + static final _class = JClass.forName(r'java/lang/Long'); static final _ctorId = _class.constructorId(r'(J)V'); diff --git a/pkgs/jni/lib/src/lang/jnumber.dart b/pkgs/jni/lib/src/lang/jnumber.dart index e0295296a..bdad3b477 100644 --- a/pkgs/jni/lib/src/lang/jnumber.dart +++ b/pkgs/jni/lib/src/lang/jnumber.dart @@ -16,6 +16,41 @@ import 'jinteger.dart'; import 'jlong.dart'; import 'jshort.dart'; +final class JNumberNullableType extends JObjType { + @internal + const JNumberNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Number;'; + + @internal + @override + JNumber? fromReference(JReference reference) => + reference.isNull ? null : JNumber.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => (JNumberNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JNumberNullableType && + other is JNumberNullableType; + } +} + final class JNumberType extends JObjType { @internal const JNumberType(); @@ -33,6 +68,10 @@ final class JNumberType extends JObjType { @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType get nullableType => const JNumberNullableType(); + @internal @override final superCount = 1; @@ -60,6 +99,9 @@ class JNumber extends JObject { /// The type which includes information such as the signature of this class. static const type = JNumberType(); + + /// The type which includes information such as the signature of this class. + static const nullableType = JNumberNullableType(); static final _ctorId = _class.constructorId(r'()V'); JNumber() : super.fromReference(_ctorId(_class, referenceType, [])); @@ -67,7 +109,6 @@ class JNumber extends JObject { static final _intValueId = _class.instanceMethodId(r'intValue', r'()I'); int intValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _intValueId(this, const jintType(), []); if (releaseOriginal) { release(); @@ -78,7 +119,6 @@ class JNumber extends JObject { static final _longValueId = _class.instanceMethodId(r'longValue', r'()J'); int longValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _longValueId(this, const jlongType(), []); if (releaseOriginal) { release(); @@ -89,7 +129,6 @@ class JNumber extends JObject { static final _floatValueId = _class.instanceMethodId(r'floatValue', r'()F'); double floatValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _floatValueId(this, const jfloatType(), []); if (releaseOriginal) { release(); @@ -100,7 +139,6 @@ class JNumber extends JObject { static final _doubleValueId = _class.instanceMethodId(r'doubleValue', r'()D'); double doubleValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _doubleValueId(this, const jdoubleType(), []); if (releaseOriginal) { release(); @@ -111,7 +149,6 @@ class JNumber extends JObject { static final _byteValueId = _class.instanceMethodId(r'byteValue', r'()B'); int byteValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _byteValueId(this, const jbyteType(), []); if (releaseOriginal) { release(); @@ -122,7 +159,6 @@ class JNumber extends JObject { static final _shortValueId = _class.instanceMethodId(r'shortValue', r'()S'); int shortValue({bool releaseOriginal = false}) { - reference.ensureNotNull(); final ret = _shortValueId(this, const jshortType(), []); if (releaseOriginal) { release(); diff --git a/pkgs/jni/lib/src/lang/jshort.dart b/pkgs/jni/lib/src/lang/jshort.dart index 52715169c..e7970ef82 100644 --- a/pkgs/jni/lib/src/lang/jshort.dart +++ b/pkgs/jni/lib/src/lang/jshort.dart @@ -9,6 +9,41 @@ import '../jvalues.dart'; import '../types.dart'; import 'jnumber.dart'; +final class JShortNullableType extends JObjType { + @internal + const JShortNullableType(); + + @internal + @override + String get signature => r'Ljava/lang/Short;'; + + @internal + @override + JShort? fromReference(JReference reference) => + reference.isNull ? null : JShort.fromReference(reference); + + @internal + @override + JObjType get superType => const JNumberNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JShortNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JShortNullableType && + other is JShortNullableType; + } +} + final class JShortType extends JObjType { @internal const JShortType(); @@ -25,6 +60,10 @@ final class JShortType extends JObjType { @override JObjType get superType => const JNumberType(); + @internal + @override + JObjType get nullableType => const JShortNullableType(); + @internal @override final superCount = 2; @@ -51,6 +90,9 @@ class JShort extends JNumber { /// The type which includes information such as the signature of this class. static const type = JShortType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JShortNullableType(); + static final _class = JClass.forName(r'java/lang/Short'); static final _ctorId = _class.constructorId(r'(S)V'); diff --git a/pkgs/jni/lib/src/lang/jstring.dart b/pkgs/jni/lib/src/lang/jstring.dart index 9df267d4d..dfcfe5496 100644 --- a/pkgs/jni/lib/src/lang/jstring.dart +++ b/pkgs/jni/lib/src/lang/jstring.dart @@ -9,6 +9,41 @@ import '../jobject.dart'; import '../jreference.dart'; import '../types.dart'; +final class JStringNullableType extends JObjType { + @internal + const JStringNullableType(); + + @internal + @override + String get signature => 'Ljava/lang/String;'; + + @internal + @override + JString? fromReference(JReference reference) => + reference.isNull ? null : JString.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final int superCount = 1; + + @override + int get hashCode => (JStringNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JStringNullableType && + other is JStringNullableType; + } +} + final class JStringType extends JObjType { @internal const JStringType(); @@ -26,6 +61,10 @@ final class JStringType extends JObjType { @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType get nullableType => const JStringNullableType(); + @internal @override final int superCount = 1; @@ -48,6 +87,9 @@ class JString extends JObject { /// The type which includes information such as the signature of this class. static const JObjType type = JStringType(); + /// The type which includes information such as the signature of this class. + static const JObjType nullableType = JStringNullableType(); + /// Construct a new [JString] with [reference] as its underlying reference. JString.fromReference(super.reference) : super.fromReference(); @@ -63,7 +105,6 @@ class JString extends JObject { /// If [releaseOriginal] is true, the underlying reference is deleted /// after conversion and this object will be marked as released. String toDartString({bool releaseOriginal = false}) { - reference.ensureNotNull(); final result = Jni.env.toDartString(reference.pointer); if (releaseOriginal) { release(); diff --git a/pkgs/jni/lib/src/method_invocation.dart b/pkgs/jni/lib/src/method_invocation.dart index ee779b55f..8c1f47170 100644 --- a/pkgs/jni/lib/src/method_invocation.dart +++ b/pkgs/jni/lib/src/method_invocation.dart @@ -6,17 +6,17 @@ import 'dart:ffi'; import 'package:meta/meta.dart' show internal; +import 'jarray.dart'; import 'jobject.dart'; import 'jreference.dart'; import 'lang/jstring.dart'; import 'third_party/generated_bindings.dart'; -import 'types.dart'; @internal class MethodInvocation { final Pointer result; final JString methodDescriptor; - final JArray args; + final JArray? args; MethodInvocation._(this.result, this.methodDescriptor, this.args); @@ -29,10 +29,12 @@ class MethodInvocation { Pointer.fromAddress(resultAddress), JString.fromReference( JGlobalReference(Pointer.fromAddress(descriptorAddress))), - JArray.fromReference( - const JObjectType(), - JGlobalReference(Pointer.fromAddress(argsAddress)), - ), + argsAddress == 0 + ? null + : JArray.fromReference( + const JObjectNullableType(), + JGlobalReference(Pointer.fromAddress(argsAddress)), + ), ); } diff --git a/pkgs/jni/lib/src/nio/jbuffer.dart b/pkgs/jni/lib/src/nio/jbuffer.dart index f26f57955..8663654b4 100644 --- a/pkgs/jni/lib/src/nio/jbuffer.dart +++ b/pkgs/jni/lib/src/nio/jbuffer.dart @@ -10,6 +10,41 @@ import '../jvalues.dart'; import '../types.dart'; import 'jbyte_buffer.dart'; +final class JBufferNullableType extends JObjType { + @internal + const JBufferNullableType(); + + @internal + @override + String get signature => r'Ljava/nio/Buffer;'; + + @internal + @override + JBuffer? fromReference(JReference reference) => + reference.isNull ? null : JBuffer.fromReference(reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => (JBufferNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JBufferNullableType && + other is JBufferNullableType; + } +} + final class JBufferType extends JObjType { @internal const JBufferType(); @@ -27,6 +62,10 @@ final class JBufferType extends JObjType { @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType get nullableType => const JBufferNullableType(); + @internal @override final superCount = 1; @@ -66,6 +105,9 @@ class JBuffer extends JObject { /// The type which includes information such as the signature of this class. static const type = JBufferType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JBufferNullableType(); + static final _capacityId = _class.instanceMethodId(r'capacity', r'()I'); /// The number of elements this buffer contains. @@ -213,7 +255,7 @@ class JBuffer extends JObject { /// * `UnsupportedOperationException` - If this buffer is not backed by an /// accessible array JObject get array { - return _arrayId(this, const JObjectType(), []); + return _arrayId(this, const JObjectType(), [])!; } static final _arrayOffsetId = _class.instanceMethodId(r'arrayOffset', r'()I'); diff --git a/pkgs/jni/lib/src/nio/jbyte_buffer.dart b/pkgs/jni/lib/src/nio/jbyte_buffer.dart index 54e5bcaae..5251c5c6a 100644 --- a/pkgs/jni/lib/src/nio/jbyte_buffer.dart +++ b/pkgs/jni/lib/src/nio/jbyte_buffer.dart @@ -7,6 +7,7 @@ import 'dart:typed_data'; import 'package:meta/meta.dart' show internal; +import '../jarray.dart'; import '../jni.dart'; import '../jobject.dart'; import '../jreference.dart'; @@ -14,6 +15,41 @@ import '../jvalues.dart'; import '../types.dart'; import 'jbuffer.dart'; +final class JByteBufferNullableType extends JObjType { + @internal + const JByteBufferNullableType(); + + @internal + @override + String get signature => r'Ljava/nio/ByteBuffer;'; + + @internal + @override + JByteBuffer? fromReference(JReference reference) => + reference.isNull ? null : JByteBuffer.fromReference(reference); + + @internal + @override + JObjType get superType => const JByteBufferNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @internal + @override + final superCount = 2; + + @override + int get hashCode => (JByteBufferNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JByteBufferNullableType && + other is JByteBufferNullableType; + } +} + final class JByteBufferType extends JObjType { @internal const JByteBufferType(); @@ -31,6 +67,10 @@ final class JByteBufferType extends JObjType { @override JObjType get superType => const JBufferType(); + @internal + @override + JObjType get nullableType => const JByteBufferNullableType(); + @internal @override final superCount = 2; @@ -108,6 +148,9 @@ class JByteBuffer extends JBuffer { /// The type which includes information such as the signature of this class. static const type = JByteBufferType(); + /// The type which includes information such as the signature of this class. + static const nullableType = JByteBufferNullableType(); + static final _allocateDirectId = _class.staticMethodId(r'allocateDirect', r'(I)Ljava/nio/ByteBuffer;'); @@ -117,7 +160,7 @@ class JByteBuffer extends JBuffer { /// * `IllegalArgumentException` - If the capacity is a negative integer factory JByteBuffer.allocateDirect(int capacity) { return _allocateDirectId( - _class, const JByteBufferType(), [JValueInt(capacity)]); + _class, const JByteBufferType(), [JValueInt(capacity)])!; } static final _allocateId = @@ -128,7 +171,7 @@ class JByteBuffer extends JBuffer { /// Throws: /// * `IllegalArgumentException` - If the capacity is a negative integer factory JByteBuffer.allocate(int capacity) { - return _allocateId(_class, const JByteBufferType(), [JValueInt(capacity)]); + return _allocateId(_class, const JByteBufferType(), [JValueInt(capacity)])!; } static final _wrapWholeId = @@ -142,24 +185,25 @@ class JByteBuffer extends JBuffer { /// modifications to the buffer will cause the array to be modified /// and vice versa. static JByteBuffer wrap( - JArray array, [ + JByteArray array, [ int? offset, int? length, ]) { + final arrayRef = array.reference; if (offset == null && length == null) { return _wrapWholeId( _class, const JByteBufferType(), - [array.reference.pointer], - ); + [arrayRef.pointer], + )!; } offset ??= 0; length ??= array.length - offset; return _wrapId( _class, const JByteBufferType(), - [array.reference.pointer, JValueInt(offset), JValueInt(length)], - ); + [arrayRef.pointer, JValueInt(offset), JValueInt(length)], + )!; } /// Creates a [JByteBuffer] from the content of [list]. @@ -177,7 +221,7 @@ class JByteBuffer extends JBuffer { /// Creates a new byte buffer whose content is a shared subsequence of this /// buffer's content. JByteBuffer slice() { - return _sliceId(this, const JByteBufferType(), []); + return _sliceId(this, const JByteBufferType(), [])!; } static final _duplicateId = @@ -185,7 +229,7 @@ class JByteBuffer extends JBuffer { /// Creates a new byte buffer that shares this buffer's content. JByteBuffer duplicate() { - return _duplicateId(this, const JByteBufferType(), []); + return _duplicateId(this, const JByteBufferType(), [])!; } static final _asReadOnlyBufferId = @@ -193,7 +237,7 @@ class JByteBuffer extends JBuffer { /// Creates a new, read-only byte buffer that shares this buffer's content. JByteBuffer asReadOnlyBuffer() { - return _asReadOnlyBufferId(this, const JByteBufferType(), []); + return _asReadOnlyBufferId(this, const JByteBufferType(), [])!; } static final _getId = _class.instanceMethodId(r'get', r'()B'); @@ -225,8 +269,8 @@ class JByteBuffer extends JBuffer { static final _arrayId = _class.instanceMethodId(r'array', r'()[B'); @override - JArray get array { - return _arrayId(this, const JArrayType(jbyteType()), []); + JByteArray get array { + return _arrayId(this, JByteArray.type, [])!; } void _ensureIsDirect() { diff --git a/pkgs/jni/lib/src/types.dart b/pkgs/jni/lib/src/types.dart index 50ce5e817..466e825b8 100644 --- a/pkgs/jni/lib/src/types.dart +++ b/pkgs/jni/lib/src/types.dart @@ -2,9 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:ffi'; -import 'dart:typed_data'; - import 'package:ffi/ffi.dart'; import '../_internal.dart'; @@ -13,7 +10,6 @@ import 'jobject.dart'; import 'jvalues.dart'; import 'third_party/generated_bindings.dart'; -part 'jarray.dart'; part 'jclass.dart'; part 'jprimitives.dart'; @@ -49,12 +45,6 @@ mixin JAccessible on JType { void _instanceSet(JObjectPtr obj, JFieldIDPtr fieldID, DartT val); } -/// Able to be the type of array elements. -@internal -mixin JArrayElementType on JType { - JArray _newArray(int length); -} - /// Only used for jnigen. /// /// Makes constructing objects easier inside the generated bindings by allowing @@ -79,17 +69,17 @@ final class _ReferenceType extends JType } @internal -abstract class JObjType extends JType - with - JCallable, - JConstructable, - JAccessible, - JArrayElementType { +abstract class JObjType extends JType + with JCallable, JConstructable, JAccessible { /// Number of super types. Distance to the root type. int get superCount; JObjType get superType; + JObjType get nullableType; + + bool get isNullable => this == nullableType; + const JObjType(); /// Creates an object from this type using the reference. @@ -104,8 +94,8 @@ abstract class JObjType extends JType @override T _staticCall(JClassPtr clazz, JMethodIDPtr methodID, Pointer args) { - return fromReference(JGlobalReference( - Jni.env.CallStaticObjectMethodA(clazz, methodID, args))); + final result = Jni.env.CallStaticObjectMethodA(clazz, methodID, args); + return fromReference(JGlobalReference(result)); } @override @@ -127,8 +117,9 @@ abstract class JObjType extends JType } @override - void _instanceSet(JObjectPtr obj, JFieldIDPtr fieldID, T val) { - Jni.env.SetObjectField(obj, fieldID, val.reference.pointer); + void _instanceSet(JObjectPtr obj, JFieldIDPtr fieldID, T? val) { + final valRef = val?.reference ?? jNullReference; + Jni.env.SetObjectField(obj, fieldID, valRef.pointer); } @override @@ -138,29 +129,21 @@ abstract class JObjType extends JType } @override - void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, T val) { - Jni.env.SetStaticObjectField(clazz, fieldID, val.reference.pointer); - } - - @override - JArray _newArray(int length, [T? fill]) { - final clazz = jClass; - final array = JArray.fromReference( - this, - JGlobalReference(Jni.env.NewObjectArray( - length, - clazz.reference.pointer, - fill == null ? nullptr : fill.reference.pointer, - )), - ); - clazz.release(); - return array; + void _staticSet(JClassPtr clazz, JFieldIDPtr fieldID, T? val) { + final valRef = val?.reference ?? jNullReference; + Jni.env.SetStaticObjectField(clazz, fieldID, valRef.pointer); } } /// Lowest common ancestor of two types in the inheritance tree. JObjType _lowestCommonAncestor( JObjType a, JObjType b) { + if (a is! JObjType || b is! JObjType) { + // If one of the types are nullable, the common super type should also be + // nullable. + a = a.nullableType; + b = b.nullableType; + } while (a.superCount > b.superCount) { a = a.superType; } diff --git a/pkgs/jni/lib/src/util/jiterator.dart b/pkgs/jni/lib/src/util/jiterator.dart index d3bb4421e..d644506e8 100644 --- a/pkgs/jni/lib/src/util/jiterator.dart +++ b/pkgs/jni/lib/src/util/jiterator.dart @@ -8,7 +8,49 @@ import '../jobject.dart'; import '../jreference.dart'; import '../types.dart'; -final class JIteratorType<$E extends JObject> extends JObjType> { +final class JIteratorNullableType<$E extends JObject?> + extends JObjType?> { + @internal + final JObjType<$E> E; + + @internal + const JIteratorNullableType( + this.E, + ); + + @internal + @override + String get signature => r'Ljava/util/Iterator;'; + + @internal + @override + JIterator<$E>? fromReference(JReference reference) => + reference.isNull ? null : JIterator<$E>.fromReference(E, reference); + + @internal + @override + JObjType get superType => const JObjectNullableType(); + + @internal + @override + JObjType?> get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => Object.hash(JIteratorNullableType, E); + + @override + bool operator ==(Object other) { + return other.runtimeType == (JIteratorNullableType<$E>) && + other is JIteratorNullableType<$E> && + E == other.E; + } +} + +final class JIteratorType<$E extends JObject?> extends JObjType> { @internal final JObjType<$E> E; @@ -24,12 +66,16 @@ final class JIteratorType<$E extends JObject> extends JObjType> { @internal @override JIterator<$E> fromReference(JReference reference) => - JIterator.fromReference(E, reference); + JIterator<$E>.fromReference(E, reference); @internal @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType?> get nullableType => JIteratorNullableType<$E>(E); + @internal @override final superCount = 1; @@ -45,7 +91,7 @@ final class JIteratorType<$E extends JObject> extends JObjType> { } } -class JIterator<$E extends JObject> extends JObject implements Iterator<$E> { +class JIterator<$E extends JObject?> extends JObject implements Iterator<$E> { @internal @override // ignore: overridden_fields @@ -57,18 +103,23 @@ class JIterator<$E extends JObject> extends JObject implements Iterator<$E> { JIterator.fromReference( this.E, JReference reference, - ) : $type = type(E), + ) : $type = type<$E>(E), super.fromReference(reference); static final _class = JClass.forName(r'java/util/Iterator'); /// The type which includes information such as the signature of this class. - static JIteratorType<$E> type<$E extends JObject>( + static JIteratorType<$E> type<$E extends JObject?>( + JObjType<$E> E, + ) { + return JIteratorType<$E>(E); + } + + /// The type which includes information such as the signature of this class. + static JIteratorNullableType<$E> nullableType<$E extends JObject?>( JObjType<$E> E, ) { - return JIteratorType( - E, - ); + return JIteratorNullableType<$E>(E); } $E? _current; @@ -78,13 +129,13 @@ class JIterator<$E extends JObject> extends JObject implements Iterator<$E> { static final _hasNextId = _class.instanceMethodId(r'hasNext', r'()Z'); bool _hasNext() { - return _hasNextId(this, const jbooleanType(), []); + return _hasNextId(this, const jbooleanType(), [])!; } static final _nextId = _class.instanceMethodId(r'next', r'()Ljava/lang/Object;'); $E _next() { - return _nextId(this, E, []); + return _nextId(this, E, [])!; } @override diff --git a/pkgs/jni/lib/src/util/jlist.dart b/pkgs/jni/lib/src/util/jlist.dart index 368bc55e8..8648ff4b0 100644 --- a/pkgs/jni/lib/src/util/jlist.dart +++ b/pkgs/jni/lib/src/util/jlist.dart @@ -14,7 +14,49 @@ import '../types.dart'; import 'jiterator.dart'; import 'jset.dart'; -final class JListType<$E extends JObject> extends JObjType> { +final class JListNullableType<$E extends JObject?> + extends JObjType?> { + @internal + final JObjType<$E> E; + + @internal + const JListNullableType( + this.E, + ); + + @internal + @override + String get signature => r'Ljava/util/List;'; + + @internal + @override + JList<$E>? fromReference(JReference reference) => + reference.isNull ? null : JList<$E>.fromReference(E, reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType?> get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => Object.hash(JListNullableType, E); + + @override + bool operator ==(Object other) { + return other.runtimeType == (JListNullableType<$E>) && + other is JListNullableType<$E> && + E == other.E; + } +} + +final class JListType<$E extends JObject?> extends JObjType> { @internal final JObjType<$E> E; @@ -30,12 +72,16 @@ final class JListType<$E extends JObject> extends JObjType> { @internal @override JList<$E> fromReference(JReference reference) => - JList.fromReference(E, reference); + JList<$E>.fromReference(E, reference); @internal @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType?> get nullableType => JListNullableType<$E>(E); + @internal @override final superCount = 1; @@ -51,7 +97,7 @@ final class JListType<$E extends JObject> extends JObjType> { } } -class JList<$E extends JObject> extends JObject with ListMixin<$E> { +class JList<$E extends JObject?> extends JObject with ListMixin<$E> { @internal @override // ignore: overridden_fields @@ -63,35 +109,39 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { JList.fromReference( this.E, JReference reference, - ) : $type = type(E), + ) : $type = type<$E>(E), super.fromReference(reference); static final _class = JClass.forName(r'java/util/List'); /// The type which includes information such as the signature of this class. - static JListType<$E> type<$E extends JObject>( + static JListType<$E> type<$E extends JObject?>( JObjType<$E> E, ) { - return JListType( - E, - ); + return JListType<$E>(E); + } + + /// The type which includes information such as the signature of this class. + static JListNullableType<$E> nullableType<$E extends JObject?>( + JObjType<$E> E) { + return JListNullableType<$E>(E); } static final _arrayListClassRef = JClass.forName(r'java/util/ArrayList'); static final _ctorId = _arrayListClassRef.constructorId(r'()V'); JList.array(this.E) - : $type = type(E), + : $type = type<$E>(E), super.fromReference(_ctorId(_arrayListClassRef, referenceType, [])); static final _sizeId = _class.instanceMethodId(r'size', r'()I'); @override - int get length => _sizeId(this, const jintType(), []); + int get length => _sizeId(this, const jintType(), [])!; @override set length(int newLength) { RangeError.checkNotNegative(newLength); while (length < newLength) { - add(E.fromReference(jNullReference)); + add(null as $E); } while (newLength < length) { removeAt(length - 1); @@ -126,11 +176,13 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { _class.instanceMethodId(r'addAll', r'(Ljava/util/Collection;)Z'); @override void addAll(Iterable<$E> iterable) { - if (iterable is JObject && - Jni.env.IsInstanceOf((iterable as JObject).reference.pointer, - _collectionClass.reference.pointer)) { - _addAllId(this, const jbooleanType(), [(iterable as JObject)]); - return; + if (iterable is JObject) { + final iterableRef = (iterable as JObject).reference; + if (Jni.env.IsInstanceOf( + iterableRef.pointer, _collectionClass.reference.pointer)) { + _addAllId(this, const jbooleanType(), [iterableRef.pointer]); + return; + } } return super.addAll(iterable); } @@ -146,7 +198,8 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { @override bool contains(Object? element) { if (element is! JObject) return false; - return _containsId(this, const jbooleanType(), [element.reference.pointer]); + final elementRef = element.reference; + return _containsId(this, const jbooleanType(), [elementRef.pointer])!; } static final _getRangeId = @@ -154,7 +207,8 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { @override JList<$E> getRange(int start, int end) { RangeError.checkValidRange(start, end, this.length); - return _getRangeId(this, JListType(E), [JValueInt(start), JValueInt(end)]); + return _getRangeId( + this, JListType<$E>(E), [JValueInt(start), JValueInt(end)])!; } static final _indexOfId = @@ -163,14 +217,15 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { int indexOf(Object? element, [int start = 0]) { if (element is! JObject) return -1; if (start < 0) start = 0; + final elementRef = element.reference; if (start == 0) { - return _indexOfId(this, const jintType(), [element.reference.pointer]); + return _indexOfId(this, const jintType(), [elementRef.pointer])!; } return _indexOfId( getRange(start, length), const jintType(), - [element.reference.pointer], - ); + [elementRef.pointer], + )!; } static final _insertId = @@ -184,22 +239,24 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { _class.instanceMethodId(r'addAll', r'(ILjava/util/Collection;)Z'); @override void insertAll(int index, Iterable<$E> iterable) { - if (iterable is JObject && - Jni.env.IsInstanceOf((iterable as JObject).reference.pointer, - _collectionClass.reference.pointer)) { - _insertAllId( - this, - const jbooleanType(), - [JValueInt(index), iterable], - ); - return; + if (iterable is JObject) { + final iterableRef = (iterable as JObject).reference; + if (Jni.env.IsInstanceOf( + iterableRef.pointer, _collectionClass.reference.pointer)) { + _insertAllId( + this, + const jbooleanType(), + [JValueInt(index), iterableRef.pointer], + ); + return; + } } super.insertAll(index, iterable); } static final _isEmptyId = _class.instanceMethodId(r'isEmpty', r'()Z'); @override - bool get isEmpty => _isEmptyId(this, const jbooleanType(), []); + bool get isEmpty => _isEmptyId(this, const jbooleanType(), [])!; @override bool get isNotEmpty => !isEmpty; @@ -207,7 +264,7 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { static final _iteratorId = _class.instanceMethodId(r'iterator', r'()Ljava/util/Iterator;'); @override - JIterator<$E> get iterator => _iteratorId(this, JIteratorType(E), []); + JIterator<$E> get iterator => _iteratorId(this, JIteratorType<$E>(E), [])!; static final _lastIndexOfId = _class.instanceMethodId(r'lastIndexOf', r'(Ljava/lang/Object;)I'); @@ -215,15 +272,15 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { int lastIndexOf(Object? element, [int? start]) { if (element is! JObject) return -1; if (start == null || start >= this.length) start = this.length - 1; + final elementRef = element.reference; if (start == this.length - 1) { - return _lastIndexOfId( - this, const jintType(), [element.reference.pointer]); + return _lastIndexOfId(this, const jintType(), [elementRef.pointer]); } final range = getRange(start, length); final res = _lastIndexOfId( range, const jintType(), - [element], + [elementRef.pointer], ); range.release(); return res; @@ -234,14 +291,15 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { @override bool remove(Object? element) { if (element is! JObject) return false; - return _removeId(this, const jbooleanType(), [element.reference.pointer]); + final elementRef = element.reference; + return _removeId(this, const jbooleanType(), [elementRef.pointer]); } static final _removeAtId = _class.instanceMethodId(r'remove', r'(I)Ljava/lang/Object;'); @override $E removeAt(int index) { - return _removeAtId(this, E, [JValueInt(index)]); + return _removeAtId(this, E, [JValueInt(index)])!; } @override @@ -257,7 +315,7 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> { } } -extension ToJavaList on Iterable { +extension ToJavaList on Iterable { JList toJList(JObjType type) { final list = JList.array(type); list.addAll(this); diff --git a/pkgs/jni/lib/src/util/jmap.dart b/pkgs/jni/lib/src/util/jmap.dart index 59eed41d0..cc9071780 100644 --- a/pkgs/jni/lib/src/util/jmap.dart +++ b/pkgs/jni/lib/src/util/jmap.dart @@ -11,7 +11,54 @@ import '../jreference.dart'; import '../types.dart'; import 'jset.dart'; -final class JMapType<$K extends JObject, $V extends JObject> +final class JMapNullableType<$K extends JObject?, $V extends JObject?> + extends JObjType?> { + @internal + final JObjType<$K> K; + + @internal + final JObjType<$V> V; + + @internal + const JMapNullableType( + this.K, + this.V, + ); + + @internal + @override + String get signature => r'Ljava/util/Map;'; + + @internal + @override + JMap<$K, $V>? fromReference(JReference reference) => + reference.isNull ? null : JMap<$K, $V>.fromReference(K, V, reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType?> get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => Object.hash(JMapNullableType, K, V); + + @override + bool operator ==(Object other) { + return other.runtimeType == (JMapNullableType<$K, $V>) && + other is JMapNullableType<$K, $V> && + K == other.K && + V == other.V; + } +} + +final class JMapType<$K extends JObject?, $V extends JObject?> extends JObjType> { @internal final JObjType<$K> K; @@ -32,12 +79,16 @@ final class JMapType<$K extends JObject, $V extends JObject> @internal @override JMap<$K, $V> fromReference(JReference reference) => - JMap.fromReference(K, V, reference); + JMap<$K, $V>.fromReference(K, V, reference); @internal @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType?> get nullableType => JMapNullableType<$K, $V>(K, V); + @internal @override final superCount = 1; @@ -54,7 +105,7 @@ final class JMapType<$K extends JObject, $V extends JObject> } } -class JMap<$K extends JObject, $V extends JObject> extends JObject +class JMap<$K extends JObject?, $V extends JObject?> extends JObject with MapMixin<$K, $V> { @internal @override @@ -71,26 +122,32 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject this.K, this.V, JReference reference, - ) : $type = type(K, V), + ) : $type = type<$K, $V>(K, V), super.fromReference(reference); static final _class = JClass.forName(r'java/util/Map'); /// The type which includes information such as the signature of this class. - static JMapType<$K, $V> type<$K extends JObject, $V extends JObject>( + static JMapType<$K, $V> type<$K extends JObject?, $V extends JObject?>( + JObjType<$K> K, + JObjType<$V> V, + ) { + return JMapType<$K, $V>(K, V); + } + + /// The type which includes information such as the signature of this class. + static JMapNullableType<$K, $V> + nullableType<$K extends JObject?, $V extends JObject?>( JObjType<$K> K, JObjType<$V> V, ) { - return JMapType( - K, - V, - ); + return JMapNullableType<$K, $V>(K, V); } static final _hashMapClass = JClass.forName(r'java/util/HashMap'); static final _ctorId = _hashMapClass.constructorId(r'()V'); JMap.hash(this.K, this.V) - : $type = type(K, V), + : $type = type<$K, $V>(K, V), super.fromReference(_ctorId(_hashMapClass, referenceType, [])); static final _getId = _class.instanceMethodId( @@ -100,15 +157,18 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject if (key is! JObject) { return null; } - final value = _getId(this, V, [key.reference.pointer]); - return value.isNull ? null : value; + final keyRef = key.reference; + final value = _getId(this, V.nullableType, [keyRef.pointer]); + return value; } static final _putId = _class.instanceMethodId( r'put', r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;'); @override void operator []=($K key, $V value) { - _putId(this, V, [key.reference.pointer, value.reference.pointer]); + final keyRef = key?.reference ?? jNullReference; + final valueRef = value?.reference ?? jNullReference; + _putId(this, V.nullableType, [keyRef.pointer, valueRef.pointer]); } static final _addAllId = @@ -116,7 +176,8 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject @override void addAll(Map<$K, $V> other) { if (other is JMap<$K, $V>) { - _addAllId(this, const jvoidType(), [other.reference.pointer]); + final otherRef = other.reference; + _addAllId(this, const jvoidType(), [otherRef.pointer]); return; } super.addAll(other); @@ -135,7 +196,8 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject if (key is! JObject) { return false; } - return _containsKeyId(this, const jbooleanType(), [key.reference.pointer]); + final keyRef = key.reference; + return _containsKeyId(this, const jbooleanType(), [keyRef.pointer]); } static final _containsValueId = @@ -145,8 +207,8 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject if (value is! JObject) { return false; } - return _containsValueId( - this, const jbooleanType(), [value.reference.pointer]); + final valueRef = value.reference; + return _containsValueId(this, const jbooleanType(), [valueRef.pointer]); } static final isEmptyId = _class.instanceMethodId(r'isEmpty', r'()Z'); @@ -159,7 +221,7 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject static final _keysId = _class.instanceMethodId(r'keySet', r'()Ljava/util/Set;'); @override - JSet<$K> get keys => _keysId(this, JSetType(K), []); + JSet<$K> get keys => _keysId(this, JSetType<$K>(K), [])!; static final _sizeId = _class.instanceMethodId(r'size', r'()I'); @override @@ -172,12 +234,13 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject if (key is! JObject) { return null; } - final value = _removeId(this, V, [key.reference.pointer]); - return value.isNull ? null : value; + final keyRef = key.reference; + final value = _removeId(this, V.nullableType, [keyRef.pointer]); + return value; } } -extension ToJavaMap on Map { +extension ToJavaMap on Map { JMap toJMap(JObjType keyType, JObjType valueType) { final map = JMap.hash(keyType, valueType); map.addAll(this); diff --git a/pkgs/jni/lib/src/util/jset.dart b/pkgs/jni/lib/src/util/jset.dart index 44e6998cb..7f656471b 100644 --- a/pkgs/jni/lib/src/util/jset.dart +++ b/pkgs/jni/lib/src/util/jset.dart @@ -12,7 +12,48 @@ import '../jreference.dart'; import '../types.dart'; import 'jiterator.dart'; -final class JSetType<$E extends JObject> extends JObjType> { +final class JSetNullableType<$E extends JObject?> extends JObjType?> { + @internal + final JObjType<$E> E; + + @internal + const JSetNullableType( + this.E, + ); + + @internal + @override + String get signature => r'Ljava/util/Set;'; + + @internal + @override + JSet<$E>? fromReference(JReference reference) => + reference.isNull ? null : JSet<$E>.fromReference(E, reference); + + @internal + @override + JObjType get superType => const JObjectType(); + + @internal + @override + JObjType?> get nullableType => this; + + @internal + @override + final superCount = 1; + + @override + int get hashCode => Object.hash(JSetNullableType, E); + + @override + bool operator ==(Object other) { + return other.runtimeType == (JSetNullableType<$E>) && + other is JSetNullableType<$E> && + E == other.E; + } +} + +final class JSetType<$E extends JObject?> extends JObjType> { @internal final JObjType<$E> E; @@ -28,12 +69,16 @@ final class JSetType<$E extends JObject> extends JObjType> { @internal @override JSet<$E> fromReference(JReference reference) => - JSet.fromReference(E, reference); + JSet<$E>.fromReference(E, reference); @internal @override JObjType get superType => const JObjectType(); + @internal + @override + JObjType?> get nullableType => JSetNullableType<$E>(E); + @internal @override final superCount = 1; @@ -49,7 +94,7 @@ final class JSetType<$E extends JObject> extends JObjType> { } } -class JSet<$E extends JObject> extends JObject with SetMixin<$E> { +class JSet<$E extends JObject?> extends JObject with SetMixin<$E> { @internal @override // ignore: overridden_fields @@ -61,47 +106,56 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { JSet.fromReference( this.E, JReference reference, - ) : $type = type(E), + ) : $type = type<$E>(E), super.fromReference(reference); static final _class = JClass.forName(r'java/util/Set'); /// The type which includes information such as the signature of this class. - static JSetType<$E> type<$E extends JObject>( + static JSetType<$E> type<$E extends JObject?>( + JObjType<$E> E, + ) { + return JSetType<$E>(E); + } + + /// The type which includes information such as the signature of this class. + static JSetNullableType<$E> nullableType<$E extends JObject?>( JObjType<$E> E, ) { - return JSetType( - E, - ); + return JSetNullableType<$E>(E); } static final _hashSetClass = JClass.forName(r'java/util/HashSet'); static final _ctorId = _hashSetClass.constructorId(r'()V'); JSet.hash(this.E) - : $type = type(E), + : $type = type<$E>(E), super.fromReference(_ctorId(_hashSetClass, referenceType, [])); static final _addId = _class.instanceMethodId(r'add', r'(Ljava/lang/Object;)Z'); @override bool add($E value) { - return _addId(this, const jbooleanType(), [value.reference.pointer]); + final valueRef = value?.reference ?? jNullReference; + return _addId(this, const jbooleanType(), [valueRef.pointer]); } static final _addAllId = _class.instanceMethodId(r'addAll', r'(Ljava/util/Collection;)Z'); @override void addAll(Iterable<$E> elements) { - if (elements is JObject && - Jni.env.IsInstanceOf((elements as JObject).reference.pointer, - _collectionClass.reference.pointer)) { - _addAllId( - this, - const jbooleanType(), - [(elements as JObject).reference.pointer], - ); - return; + if (elements is JObject) { + final elementsRef = (elements as JObject).reference; + if (Jni.env.IsInstanceOf( + elementsRef.pointer, _collectionClass.reference.pointer)) { + _addAllId( + this, + const jbooleanType(), + [elementsRef.pointer], + ); + return; + } } + return super.addAll(elements); } @@ -119,7 +173,8 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { if (element is! JObject) { return false; } - return _containsId(this, const jbooleanType(), [element.reference.pointer]); + final elementRef = element.reference; + return _containsId(this, const jbooleanType(), [elementRef.pointer]); } static final _containsAllId = @@ -127,11 +182,12 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { static final _collectionClass = JClass.forName('java/util/Collection'); @override bool containsAll(Iterable other) { - if (other is JObject && - Jni.env.IsInstanceOf((other as JObject).reference.pointer, - _collectionClass.reference.pointer)) { - return _containsAllId( - this, const jbooleanType(), [(other as JObject).reference.pointer]); + if (other is JObject) { + final otherRef = (other as JObject).reference; + if (Jni.env + .IsInstanceOf(otherRef.pointer, _collectionClass.reference.pointer)) { + return _containsAllId(this, const jbooleanType(), [otherRef.pointer]); + } } return super.containsAll(other); } @@ -146,7 +202,7 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { static final _iteratorId = _class.instanceMethodId(r'iterator', r'()Ljava/util/Iterator;'); @override - JIterator<$E> get iterator => _iteratorId(this, JIteratorType(E), []); + JIterator<$E> get iterator => _iteratorId(this, JIteratorType<$E>(E), [])!; static final _sizeId = _class.instanceMethodId(r'size', r'()I'); @override @@ -159,19 +215,21 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { if (value is! $E) { return false; } - return _removeId(this, const jbooleanType(), [value.reference.pointer]); + final valueRef = value?.reference ?? jNullReference; + return _removeId(this, const jbooleanType(), [valueRef.pointer]); } static final _removeAllId = _class.instanceMethodId(r'removeAll', r'(Ljava/util/Collection;)Z'); @override void removeAll(Iterable elements) { - if (elements is JObject && - Jni.env.IsInstanceOf((elements as JObject).reference.pointer, - _collectionClass.reference.pointer)) { - _removeAllId(this, const jbooleanType(), - [(elements as JObject).reference.pointer]); - return; + if (elements is JObject) { + final elementsRef = (elements as JObject).reference; + if (Jni.env.IsInstanceOf( + elementsRef.pointer, _collectionClass.reference.pointer)) { + _removeAllId(this, const jbooleanType(), [elementsRef.pointer]); + return; + } } return super.removeAll(elements); } @@ -180,12 +238,13 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { _class.instanceMethodId(r'retainAll', r'(Ljava/util/Collection;)Z'); @override void retainAll(Iterable elements) { - if (elements is JObject && - Jni.env.IsInstanceOf((elements as JObject).reference.pointer, - _collectionClass.reference.pointer)) { - _retainAllId(this, const jbooleanType(), - [(elements as JObject).reference.pointer]); - return; + if (elements is JObject) { + final elementsRef = (elements as JObject).reference; + if (Jni.env.IsInstanceOf( + elementsRef.pointer, _collectionClass.reference.pointer)) { + _retainAllId(this, const jbooleanType(), [elementsRef.pointer]); + return; + } } return super.retainAll(elements); } @@ -202,7 +261,7 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> { } } -extension ToJavaSet on Iterable { +extension ToJavaSet on Iterable { JSet toJSet(JObjType type) { final set = JSet.hash(type); set.addAll(this); diff --git a/pkgs/jni/pubspec.yaml b/pkgs/jni/pubspec.yaml index e75140057..dfabbfd1d 100644 --- a/pkgs/jni/pubspec.yaml +++ b/pkgs/jni/pubspec.yaml @@ -4,8 +4,9 @@ name: jni description: A library to access JNI from Dart and Flutter that acts as a support library for package:jnigen. -version: 0.12.1-wip +version: 0.13.0 repository: https://github.com/dart-lang/native/tree/main/pkgs/jni +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ajni topics: - interop diff --git a/pkgs/jni/test/isolate_test.dart b/pkgs/jni/test/isolate_test.dart index 0230ad7d2..0f8501880 100644 --- a/pkgs/jni/test/isolate_test.dart +++ b/pkgs/jni/test/isolate_test.dart @@ -20,8 +20,7 @@ void main() { } void run({required TestRunnerCallback testRunner}) { - testRunner('Sharing JObject across isolates', - skip: 'Not yet available on Dart stable', () async { + testRunner('Sharing JObject across isolates', () async { final foo = 'foo'.toJString(); final port = ReceivePort(); await Isolate.spawn((sendPort) { diff --git a/pkgs/jni/test/jarray_test.dart b/pkgs/jni/test/jarray_test.dart index e22afdfe4..d64b7353a 100644 --- a/pkgs/jni/test/jarray_test.dart +++ b/pkgs/jni/test/jarray_test.dart @@ -22,7 +22,13 @@ void main() { void run({required TestRunnerCallback testRunner}) { testRunner('Java boolean array', () { using((arena) { - final array = JArray(jboolean.type, 3)..releasedBy(arena); + final array = JBooleanArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = true; array[1] = false; @@ -58,7 +64,13 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java char array', () { using((arena) { - final array = JArray(jchar.type, 3)..releasedBy(arena); + final array = JCharArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 1; array[1] = 2; @@ -94,7 +106,13 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java byte array', () { using((arena) { - final array = JArray(jbyte.type, 3)..releasedBy(arena); + final array = JByteArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 1; array[1] = 2; @@ -130,7 +148,13 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java short array', () { using((arena) { - final array = JArray(jshort.type, 3)..releasedBy(arena); + final array = JShortArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 1; array[1] = 2; @@ -166,7 +190,13 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java int array', () { using((arena) { - final array = JArray(jint.type, 3)..releasedBy(arena); + final array = JIntArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 1; array[1] = 2; @@ -202,7 +232,13 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java long array', () { using((arena) { - final array = JArray(jlong.type, 3)..releasedBy(arena); + final array = JLongArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 1; array[1] = 2; @@ -239,7 +275,13 @@ void run({required TestRunnerCallback testRunner}) { const epsilon = 1e-6; testRunner('Java float array', () { using((arena) { - final array = JArray(jfloat.type, 3)..releasedBy(arena); + final array = JFloatArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 0.5; array[1] = 2; @@ -275,7 +317,13 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java double array', () { using((arena) { - final array = JArray(jdouble.type, 3)..releasedBy(arena); + final array = JDoubleArray(3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 0.5; array[1] = 2; @@ -311,14 +359,20 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java string array', () { using((arena) { - final array = JArray(JString.type, 3)..releasedBy(arena); + final array = JArray(JString.nullableType, 3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); array[0] = 'حس'.toJString()..releasedBy(arena); array[1] = '\$'.toJString()..releasedBy(arena); array[2] = '33'.toJString()..releasedBy(arena); - expect(array[0].toDartString(releaseOriginal: true), 'حس'); - expect(array[1].toDartString(releaseOriginal: true), '\$'); - expect(array[2].toDartString(releaseOriginal: true), '33'); + expect(array[0]!.toDartString(releaseOriginal: true), 'حس'); + expect(array[1]!.toDartString(releaseOriginal: true), '\$'); + expect(array[2]!.toDartString(releaseOriginal: true), '33'); array.setRange( 0, 3, @@ -330,9 +384,9 @@ void run({required TestRunnerCallback testRunner}) { ], 1, ); - expect(array[0].toDartString(releaseOriginal: true), '55'); - expect(array[1].toDartString(releaseOriginal: true), '66'); - expect(array[2].toDartString(releaseOriginal: true), '77'); + expect(array[0]!.toDartString(releaseOriginal: true), '55'); + expect(array[1]!.toDartString(releaseOriginal: true), '66'); + expect(array[2]!.toDartString(releaseOriginal: true), '77'); expect(() { final _ = array[-1]; }, throwsRangeError); @@ -346,31 +400,37 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('Java object array', () { using((arena) { - final array = JArray(JObject.type, 3)..releasedBy(arena); + final array = JArray(JObject.nullableType, 3)..releasedBy(arena); + var counter = 0; + for (final element in array) { + expect(element, array[counter]); + ++counter; + } + expect(counter, array.length); expect(array.length, 3); - expect(array[0].reference.pointer, nullptr); - expect(array[1].reference.pointer, nullptr); - expect(array[2].reference.pointer, nullptr); + expect(array[0], isNull); + expect(array[1], isNull); + expect(array[2], isNull); }); }); testRunner('Java 2d array', () { using((arena) { - final array = JArray(jint.type, 3)..releasedBy(arena); + final array = JIntArray(3)..releasedBy(arena); array[0] = 1; array[1] = 2; array[2] = 3; - final twoDimArray = JArray(JArray.type(jint.type), 3)..releasedBy(arena); + final twoDimArray = JArray(JIntArray.nullableType, 3)..releasedBy(arena); expect(twoDimArray.length, 3); twoDimArray[0] = array; twoDimArray[1] = array; twoDimArray[2] = array; for (var i = 0; i < 3; ++i) { - expect(twoDimArray[i][0], 1); - expect(twoDimArray[i][1], 2); - expect(twoDimArray[i][2], 3); + expect(twoDimArray[i]![0], 1); + expect(twoDimArray[i]![1], 2); + expect(twoDimArray[i]![2], 3); } - twoDimArray[2][2] = 4; - expect(twoDimArray[2][2], 4); + twoDimArray[2]![2] = 4; + expect(twoDimArray[2]![2], 4); }); }); testRunner('JArray.filled', () { @@ -378,7 +438,7 @@ void run({required TestRunnerCallback testRunner}) { final string = 'abc'.toJString()..releasedBy(arena); final array = JArray.filled(3, string)..releasedBy(arena); expect( - () => JArray.filled(-3, JString.fromReference(jNullReference)), + () => JArray.filled(-3, 'abc'.toJString()..releasedBy(arena)), throwsA(isA()), ); expect(array.length, 3); @@ -389,75 +449,77 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('JArray of JByte', () { using((arena) { - final arr = JArray(JByte.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JByte.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JShort', () { using((arena) { - final arr = JArray(JShort.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JShort.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JInteger', () { using((arena) { - final arr = JArray(JInteger.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JInteger.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JCharacter', () { using((arena) { - final arr = JArray(JCharacter.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JCharacter.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JLong', () { using((arena) { - final arr = JArray(JLong.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JLong.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JFloat', () { using((arena) { - final arr = JArray(JFloat.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JFloat.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JDouble', () { using((arena) { - final arr = JArray(JDouble.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JDouble.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JBoolean', () { using((arena) { - final arr = JArray(JBoolean.type, 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JBoolean.nullableType, 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JSet', () { using((arena) { - final arr = JArray(JSet.type(JString.type), 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JSet.nullableType(JString.type), 1)..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JList', () { using((arena) { - final arr = JArray(JList.type(JString.type), 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JList.nullableType(JString.type), 1) + ..releasedBy(arena); + expect(arr[0], isNull); }); }); testRunner('JArray of JMap', () { using((arena) { - final arr = JArray(JMap.type(JString.type, JString.type), 1) + final arr = JArray(JMap.nullableType(JString.type, JString.type), 1) ..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + expect(arr[0], isNull); }); }); testRunner('JArray of JIterator', () { using((arena) { - final arr = JArray(JIterator.type(JString.type), 1)..releasedBy(arena); - expect((arr[0]..releasedBy(arena)).isNull, true); + final arr = JArray(JIterator.nullableType(JString.type), 1) + ..releasedBy(arena); + expect(arr[0], isNull); }); }); } diff --git a/pkgs/jni/test/jbyte_buffer_test.dart b/pkgs/jni/test/jbyte_buffer_test.dart index fae8a6d5b..666479dcb 100644 --- a/pkgs/jni/test/jbyte_buffer_test.dart +++ b/pkgs/jni/test/jbyte_buffer_test.dart @@ -32,7 +32,7 @@ void run({required TestRunnerCallback testRunner}) { testRunner('wrap whole array', () { using((arena) { - final array = JArray(jbyte.type, 3)..releasedBy(arena); + final array = JByteArray(3)..releasedBy(arena); array[0] = 1; array[1] = 2; array[2] = 3; @@ -43,7 +43,7 @@ void run({required TestRunnerCallback testRunner}) { testRunner('wrap partial array', () { using((arena) { - final array = JArray(jbyte.type, 3)..releasedBy(arena); + final array = JByteArray(3)..releasedBy(arena); array[0] = 1; array[1] = 2; array[2] = 3; @@ -201,8 +201,8 @@ void run({required TestRunnerCallback testRunner}) { final b = testDataBuffer(arena); expect(a.$type, b.$type); expect(a.$type.hashCode, b.$type.hashCode); - final c = JBuffer.fromReference(jNullReference); - final d = JBuffer.fromReference(jNullReference); + final c = JBuffer.fromReference(a.reference); + final d = JBuffer.fromReference(b.reference); expect(c.$type, d.$type); expect(c.$type.hashCode, d.$type.hashCode); diff --git a/pkgs/jni/test/jlist_test.dart b/pkgs/jni/test/jlist_test.dart index 30d062511..a967950cf 100644 --- a/pkgs/jni/test/jlist_test.dart +++ b/pkgs/jni/test/jlist_test.dart @@ -36,12 +36,17 @@ void run({required TestRunnerCallback testRunner}) { }); testRunner('length set', () { using((arena) { - final list = testDataList(arena); + final list = [ + '1'.toJString()..releasedBy(arena), + '2'.toJString()..releasedBy(arena), + '3'.toJString()..releasedBy(arena), + ].toJList(JString.nullableType) + ..releasedBy(arena); list.length = 2; expect(list.length, 2); list.length = 3; expect(list.length, 3); - expect(list.last.isNull, true); + expect(list.last, isNull); }); }); testRunner('[]', () { diff --git a/pkgs/jni/test/jobject_test.dart b/pkgs/jni/test/jobject_test.dart index a3ffd2d85..414f3df43 100644 --- a/pkgs/jni/test/jobject_test.dart +++ b/pkgs/jni/test/jobject_test.dart @@ -296,4 +296,11 @@ void run({required TestRunnerCallback testRunner}) { throwsA(isA()), ); }); + + testRunner('Disallow construction of null JObject', () { + expect( + () => JObject.fromReference(jNullReference), + throwsA(isA()), + ); + }); } diff --git a/pkgs/jni/test/type_test.dart b/pkgs/jni/test/type_test.dart index c42e3ddd2..2182281ac 100644 --- a/pkgs/jni/test/type_test.dart +++ b/pkgs/jni/test/type_test.dart @@ -2,11 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:io'; - import 'package:jni/_internal.dart'; import 'package:jni/jni.dart'; -import 'package:jni/src/types.dart'; import 'package:test/test.dart'; import 'test_util/test_util.dart'; @@ -26,6 +23,38 @@ class A extends JObject { JObjType get $type => $AType(); } +final class $ANullableType extends JObjType { + @internal + @override + A? fromReference(JReference reference) { + return reference.isNull ? null : A.fromReference(reference); + } + + @internal + @override + String get signature => 'A'; + + @internal + @override + int get superCount => superType.superCount + 1; + + @internal + @override + JObjType get superType => JObject.nullableType; + + @internal + @override + JObjType get nullableType => this; + + @override + int get hashCode => ($ANullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $ANullableType && other is $ANullableType; + } +} + final class $AType extends JObjType { @internal @override @@ -45,6 +74,10 @@ final class $AType extends JObjType { @override JObjType get superType => JObject.type; + @internal + @override + JObjType get nullableType => $ANullableType(); + @override int get hashCode => ($AType).hashCode; @@ -60,6 +93,38 @@ class B extends JObject { JObjType get $type => $BType(); } +final class $BNullableType extends JObjType { + @internal + @override + B? fromReference(JReference reference) { + return reference.isNull ? null : B.fromReference(reference); + } + + @internal + @override + String get signature => 'B'; + + @internal + @override + int get superCount => superType.superCount + 1; + + @internal + @override + JObjType get superType => JObject.nullableType; + + @internal + @override + JObjType get nullableType => this; + + @override + int get hashCode => ($BNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $BNullableType && other is $BNullableType; + } +} + final class $BType extends JObjType { @internal @override @@ -79,6 +144,10 @@ final class $BType extends JObjType { @override JObjType get superType => JObject.type; + @internal + @override + JObjType get nullableType => $BNullableType(); + @override int get hashCode => ($BType).hashCode; @@ -95,6 +164,38 @@ class C extends A { JObjType get $type => $CType(); } +final class $CNullableType extends JObjType { + @internal + @override + C? fromReference(JReference reference) { + return reference.isNull ? null : C.fromReference(reference); + } + + @internal + @override + String get signature => 'C'; + + @internal + @override + int get superCount => superType.superCount + 1; + + @internal + @override + JObjType get superType => $ANullableType(); + + @internal + @override + JObjType get nullableType => this; + + @override + int get hashCode => ($CNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $CNullableType && other is $CNullableType; + } +} + final class $CType extends JObjType { @internal @override @@ -114,6 +215,10 @@ final class $CType extends JObjType { @override JObjType get superType => $AType(); + @internal + @override + JObjType get nullableType => $CNullableType(); + @override int get hashCode => ($CType).hashCode; @@ -130,6 +235,38 @@ class D extends A { JObjType get $type => $DType(); } +final class $DNullableType extends JObjType { + @internal + @override + D? fromReference(JReference reference) { + return reference.isNull ? null : D.fromReference(reference); + } + + @internal + @override + String get signature => 'D'; + + @internal + @override + int get superCount => superType.superCount + 1; + + @internal + @override + JObjType get superType => $ANullableType(); + + @internal + @override + JObjType get nullableType => this; + + @override + int get hashCode => ($DNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $DNullableType && other is $DNullableType; + } +} + final class $DType extends JObjType { @internal @override @@ -149,6 +286,10 @@ final class $DType extends JObjType { @override JObjType get superType => $AType(); + @internal + @override + JObjType get nullableType => $DNullableType(); + @override int get hashCode => ($DType).hashCode; @@ -165,6 +306,38 @@ class E extends B { JObjType get $type => $EType(); } +final class $ENullableType extends JObjType { + @internal + @override + E? fromReference(JReference reference) { + return reference.isNull ? null : E.fromReference(reference); + } + + @internal + @override + String get signature => 'E'; + + @internal + @override + int get superCount => superType.superCount + 1; + + @internal + @override + JObjType get superType => $BNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @override + int get hashCode => ($ENullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $ENullableType && other is $ENullableType; + } +} + final class $EType extends JObjType { @internal @override @@ -184,6 +357,10 @@ final class $EType extends JObjType { @override JObjType get superType => $BType(); + @internal + @override + JObjType get nullableType => $ENullableType(); + @override int get hashCode => ($EType).hashCode; @@ -200,6 +377,38 @@ class F extends C { JObjType get $type => $FType(); } +final class $FNullableType extends JObjType { + @internal + @override + F? fromReference(JReference reference) { + return reference.isNull ? null : F.fromReference(reference); + } + + @internal + @override + String get signature => 'F'; + + @internal + @override + int get superCount => superType.superCount + 1; + + @internal + @override + JObjType get superType => $CNullableType(); + + @internal + @override + JObjType get nullableType => this; + + @override + int get hashCode => ($FNullableType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $FNullableType && other is $FNullableType; + } +} + final class $FType extends JObjType { @internal @override @@ -219,6 +428,10 @@ final class $FType extends JObjType { @override JObjType get superType => $CType(); + @internal + @override + JObjType get nullableType => $FNullableType(); + @override int get hashCode => ($FType).hashCode; @@ -229,10 +442,6 @@ final class $FType extends JObjType { } void main() { - if (!Platform.isAndroid) { - checkDylibIsUpToDate(); - spawnJvm(); - } run(testRunner: test); } @@ -242,7 +451,7 @@ void run({required TestRunnerCallback testRunner}) { expect(lowestCommonSuperType([JString.type]), JString.type); expect(lowestCommonSuperType([JObject.type, JObject.type]), JObject.type); expect(lowestCommonSuperType([JString.type, JString.type]), JString.type); - expect(lowestCommonSuperType([JString.type, JArray.type(jlong.type)]), + expect(lowestCommonSuperType([JString.type, JArray.type(JString.type)]), JObject.type); }); @@ -261,14 +470,29 @@ void run({required TestRunnerCallback testRunner}) { expect(lowestCommonSuperType([JByte.type, JBoolean.type]), JObject.type); }); + testRunner('Nullable boxed types', () { + expect( + lowestCommonSuperType([ + JByte.type, + JInteger.type, + JLong.type, + JShort.nullableType, // A single nullable type, + JDouble.type, + JFloat.type, + ]), + JNumber.nullableType, // Makes the common super class nullable. + ); + expect(lowestCommonSuperType([JByte.type, JBoolean.type]), JObject.type); + }); + testRunner('array types', () { using((arena) { expect( lowestCommonSuperType([ - JArray.type(jint.type), - JArray.type(jint.type), + JIntArray.type, + JIntArray.type, ]), - JArray.type(jint.type), + JIntArray.type, ); expect( lowestCommonSuperType([ @@ -280,7 +504,7 @@ void run({required TestRunnerCallback testRunner}) { expect( lowestCommonSuperType([ JArray.type(JObject.type), - JArray.type(jint.type), + JIntArray.type, ]), JObject.type, ); @@ -348,4 +572,37 @@ void run({required TestRunnerCallback testRunner}) { expect(lowestCommonSuperType([$EType(), $BType()]), $BType()); expect(lowestCommonSuperType([$BType(), $BType()]), $BType()); }); + + testRunner('Mocked nullable type tree', () { + // As a reminder, this is how the type tree looks like: + // JObject + // | \ + // A B + // / \ \ + // C D E + // / + // F + expect(lowestCommonSuperType([$AType(), $BNullableType()]), + JObject.nullableType); + expect(lowestCommonSuperType([$CNullableType(), $BType()]), + JObject.nullableType); + expect(lowestCommonSuperType([$FNullableType(), $BNullableType()]), + JObject.nullableType); + expect(lowestCommonSuperType([$ENullableType(), $CType(), $FType()]), + JObject.nullableType); + + expect( + lowestCommonSuperType([$CType(), $DNullableType()]), $ANullableType()); + expect( + lowestCommonSuperType([$FNullableType(), $DType()]), $ANullableType()); + expect(lowestCommonSuperType([$FType(), $CNullableType(), $DType()]), + $ANullableType()); + + expect( + lowestCommonSuperType([$ENullableType(), $BType()]), $BNullableType()); + expect( + lowestCommonSuperType([$BNullableType(), $BType()]), $BNullableType()); + expect(lowestCommonSuperType([$BNullableType(), $BNullableType()]), + $BNullableType()); + }); } diff --git a/pkgs/jnigen/CHANGELOG.md b/pkgs/jnigen/CHANGELOG.md index 2cedb99b5..e187a40d3 100644 --- a/pkgs/jnigen/CHANGELOG.md +++ b/pkgs/jnigen/CHANGELOG.md @@ -1,9 +1,20 @@ -## 0.12.2-wip +## 0.13.0 + +- **Breaking Change**([#1516](https://github.com/dart-lang/native/issues/1516)): + Inner classes are now generated as `OuterClass$InnerClass`. +- **Breaking Change**([#1644](https://github.com/dart-lang/native/issues/1644)): + Generate null-safe Dart bindings for Java and Kotlin. +- Fixed a potential name collision when generating in multi-file mode. +- Added the ability to add user-defined visitors to config. Currently only + capable of excluding classes, methods, and fields. + +## 0.12.2 - Now excludes invalid identifiers by default. - Fixed a bug where if multiple jars have classes within the same package, only one of them gets generated. - Fixed a bug where it would be possible for a type class inference to fail. +- Improve the diagnostics when gradle fails when `bin/jnigen` is run. ## 0.12.1 diff --git a/pkgs/jnigen/README.md b/pkgs/jnigen/README.md index 87debcbb3..a300c2772 100644 --- a/pkgs/jnigen/README.md +++ b/pkgs/jnigen/README.md @@ -214,6 +214,8 @@ A `*` denotes required configuration. | `output:` >> `dart:` | (Subsection) | This subsection specifies Dart output configuration. | | `output:` >> `dart:` >> `structure` | `package_structure` / `single_file` | Whether to map resulting dart bindings to file-per-class source layout, or write all bindings to single file. | `output:` >> `dart:` >> `path` * | Directory path or File path | Path to write Dart bindings. Should end in `.dart` for `single_file` configurations, and end in `/` for `package_structure` (default) configuration. | +| `non_null_annotations:` | List of annotation fully qualified names | List of custom annotations that specify if the annotation type is non-nullable. | +| `nullable_annotations:` | List of annotation fully qualified names | List of custom annotations that specify if the annotation type is nullable. | | `maven_downloads:` | (Subsection) | This subsection will contain configuration for automatically downloading Java dependencies (source and JAR) through maven. | | `maven_downloads:` >> `source_deps` | List of maven package coordinates | Source packages to download and unpack using maven. The names should be valid maven artifact coordinates. (Eg: `org.apache.pdfbox:pdfbox:2.0.26`). The downloads do not include transitive dependencies. | | `maven_downloads:` >> `source_dir` | Path | Directory in which maven sources are extracted. Defaults to `mvn_java`. It's not required to list this explicitly in source_path. | diff --git a/pkgs/jnigen/doc/java_differences.md b/pkgs/jnigen/doc/java_differences.md index 18528c88f..2afd6f0d0 100644 --- a/pkgs/jnigen/doc/java_differences.md +++ b/pkgs/jnigen/doc/java_differences.md @@ -213,3 +213,27 @@ class $_Example extends JObject { void $_printMessage() { /* ... */ } } ``` + +### Inner classes + +Java has the concept of inner classes, while Dart does not. Therefore, inner +classes are generated as separate classes named using the name of their +outer-class followed by a dollar sign (`$`) followed by their original name. + +For example: + +```java +// Java +public class Outer { + public class Inner {} +} +``` + +will be turned into: + +```dart +// Dart Bindings - Boilerplate omitted for clarity. +class Outer extends JObject {} + +class Outer$Inner extends JObject {} +``` diff --git a/pkgs/jnigen/doc/threading.md b/pkgs/jnigen/doc/threading.md new file mode 100644 index 000000000..01fbb8a63 --- /dev/null +++ b/pkgs/jnigen/doc/threading.md @@ -0,0 +1,67 @@ +## Threading considerations + +Unlike method channels, JNIgen uses FFI calls. This means that the calls happen +on the calling thread. + +Dart callbacks are executed on the isolate where they were created. This means +the Dart isolate remains active until the associated Java objects are garbage +collected by the JVM. + +Java calls Dart callbacks directly when both are on the same thread. If they are +on different threads, Java sends a message to the Dart isolate and waits for a +response. However, you can +[configure void-returning callbacks to avoid waiting](<(../interface_implementation.md#implement-as-a-listener)>), +as they don't produce a return value. + +### Deadlocks + +When implementing Java/Kotlin interfaces in Dart, it is possible to create +deadlocks. Suppose we have created an object that implements `Runnable` in Dart +in the main isolate. This means that the code will always be run on the platform +thread. + +```dart +// Dart +final runnableFromDart = Runnable.implement( + $Runnable(run: () => print('hello')) +); +``` + +If Java creates a second thread from the platform thread and calls +`runnableFromDart.run()` from that thread and then attempts to join or +synchronize with the main thread, it will cause a deadlock. + +This is because the body of the `runnableFromDart` needs to be run on the +platform thread, so JNIgen waits until platform thread is available. However in +this setting the platform thread will not be available until +`runnableFromDart.run` is executed. + +If the callback does not need to be blocking, +[making it a listener](../interface_implementation.md#implement-as-a-listener) +solves this issue: + +```dart +// Dart +final runnableFromDart = Runnable.implement($Runnable( + run: () => print('hello'), + run$async: true, +)); +``` + +Of course, only void-returning methods can be non-blocking. + +### Calling thread restricted APIs + +When developing for Flutter Android, certain APIs can be thread-restricted to +the platform thread which is currently different than the Flutter's UI thread. + +These two threads will be merged in +[the near future](https://github.com/flutter/flutter/issues/150525). + +Until then you can wrap your calls with `runOnPlatformThread` which is available +in `dart:ui`. + +### Dart-standalone + +On Dart-standalone, call `Jni.setDylibsDir` in each new isolate, since each +isolate loads the dynamic libararies separately. diff --git a/pkgs/jnigen/example/in_app_java/lib/android_utils.dart b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart index 8c03e0107..da495471b 100644 --- a/pkgs/jnigen/example/in_app_java/lib/android_utils.dart +++ b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart @@ -20,6 +20,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -29,28 +30,29 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `com.example.in_app_java.R$drawable` -class R_drawable extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - R_drawable.fromReference( - _$jni.JReference reference, +class R$drawable extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + R$drawable.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/example/in_app_java/R$drawable'); + jni$_.JClass.forName(r'com/example/in_app_java/R$drawable'); /// The type which includes information such as the signature of this class. - static const type = $R_drawable$Type(); + static const nullableType = $R$drawable$NullableType(); + static const type = $R$drawable$Type(); static final _id_launch_background = _class.staticFieldId( r'launch_background', r'I', @@ -58,60 +60,104 @@ class R_drawable extends _$jni.JObject { /// from: `static public int launch_background` static int get launch_background => - _id_launch_background.get(_class, const _$jni.jintType()); + _id_launch_background.get(_class, const jni$_.jintType()); /// from: `static public int launch_background` static set launch_background(int value) => - _id_launch_background.set(_class, const _$jni.jintType(), value); + _id_launch_background.set(_class, const jni$_.jintType(), value); } -final class $R_drawable$Type extends _$jni.JObjType { - @_$jni.internal - const $R_drawable$Type(); +final class $R$drawable$NullableType extends jni$_.JObjType { + @jni$_.internal + const $R$drawable$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/example/in_app_java/R$drawable;'; - @_$jni.internal - @_$core.override - R_drawable fromReference(_$jni.JReference reference) => - R_drawable.fromReference(reference); + @jni$_.internal + @core$_.override + R$drawable? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : R$drawable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($R$drawable$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($R$drawable$NullableType) && + other is $R$drawable$NullableType; + } +} + +final class $R$drawable$Type extends jni$_.JObjType { + @jni$_.internal + const $R$drawable$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/example/in_app_java/R$drawable;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + R$drawable fromReference(jni$_.JReference reference) => + R$drawable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $R$drawable$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($R_drawable$Type).hashCode; + @core$_.override + int get hashCode => ($R$drawable$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($R_drawable$Type) && other is $R_drawable$Type; + return other.runtimeType == ($R$drawable$Type) && other is $R$drawable$Type; } } /// from: `com.example.in_app_java.R$mipmap` -class R_mipmap extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - R_mipmap.fromReference( - _$jni.JReference reference, +class R$mipmap extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + R$mipmap.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/example/in_app_java/R$mipmap'); + jni$_.JClass.forName(r'com/example/in_app_java/R$mipmap'); /// The type which includes information such as the signature of this class. - static const type = $R_mipmap$Type(); + static const nullableType = $R$mipmap$NullableType(); + static const type = $R$mipmap$Type(); static final _id_ic_launcher = _class.staticFieldId( r'ic_launcher', r'I', @@ -119,60 +165,102 @@ class R_mipmap extends _$jni.JObject { /// from: `static public int ic_launcher` static int get ic_launcher => - _id_ic_launcher.get(_class, const _$jni.jintType()); + _id_ic_launcher.get(_class, const jni$_.jintType()); /// from: `static public int ic_launcher` static set ic_launcher(int value) => - _id_ic_launcher.set(_class, const _$jni.jintType(), value); + _id_ic_launcher.set(_class, const jni$_.jintType(), value); } -final class $R_mipmap$Type extends _$jni.JObjType { - @_$jni.internal - const $R_mipmap$Type(); +final class $R$mipmap$NullableType extends jni$_.JObjType { + @jni$_.internal + const $R$mipmap$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/example/in_app_java/R$mipmap;'; - @_$jni.internal - @_$core.override - R_mipmap fromReference(_$jni.JReference reference) => - R_mipmap.fromReference(reference); + @jni$_.internal + @core$_.override + R$mipmap? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : R$mipmap.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($R$mipmap$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($R$mipmap$NullableType) && + other is $R$mipmap$NullableType; + } +} + +final class $R$mipmap$Type extends jni$_.JObjType { + @jni$_.internal + const $R$mipmap$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/example/in_app_java/R$mipmap;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + R$mipmap fromReference(jni$_.JReference reference) => R$mipmap.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $R$mipmap$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($R_mipmap$Type).hashCode; + @core$_.override + int get hashCode => ($R$mipmap$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($R_mipmap$Type) && other is $R_mipmap$Type; + return other.runtimeType == ($R$mipmap$Type) && other is $R$mipmap$Type; } } /// from: `com.example.in_app_java.R$style` -class R_style extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - R_style.fromReference( - _$jni.JReference reference, +class R$style extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + R$style.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/example/in_app_java/R$style'); + jni$_.JClass.forName(r'com/example/in_app_java/R$style'); /// The type which includes information such as the signature of this class. - static const type = $R_style$Type(); + static const nullableType = $R$style$NullableType(); + static const type = $R$style$Type(); static final _id_LaunchTheme = _class.staticFieldId( r'LaunchTheme', r'I', @@ -180,11 +268,11 @@ class R_style extends _$jni.JObject { /// from: `static public int LaunchTheme` static int get LaunchTheme => - _id_LaunchTheme.get(_class, const _$jni.jintType()); + _id_LaunchTheme.get(_class, const jni$_.jintType()); /// from: `static public int LaunchTheme` static set LaunchTheme(int value) => - _id_LaunchTheme.set(_class, const _$jni.jintType(), value); + _id_LaunchTheme.set(_class, const jni$_.jintType(), value); static final _id_NormalTheme = _class.staticFieldId( r'NormalTheme', @@ -193,119 +281,204 @@ class R_style extends _$jni.JObject { /// from: `static public int NormalTheme` static int get NormalTheme => - _id_NormalTheme.get(_class, const _$jni.jintType()); + _id_NormalTheme.get(_class, const jni$_.jintType()); /// from: `static public int NormalTheme` static set NormalTheme(int value) => - _id_NormalTheme.set(_class, const _$jni.jintType(), value); + _id_NormalTheme.set(_class, const jni$_.jintType(), value); } -final class $R_style$Type extends _$jni.JObjType { - @_$jni.internal - const $R_style$Type(); +final class $R$style$NullableType extends jni$_.JObjType { + @jni$_.internal + const $R$style$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/example/in_app_java/R$style;'; - @_$jni.internal - @_$core.override - R_style fromReference(_$jni.JReference reference) => - R_style.fromReference(reference); + @jni$_.internal + @core$_.override + R$style? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : R$style.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($R$style$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($R$style$NullableType) && + other is $R$style$NullableType; + } +} + +final class $R$style$Type extends jni$_.JObjType { + @jni$_.internal + const $R$style$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/example/in_app_java/R$style;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + R$style fromReference(jni$_.JReference reference) => R$style.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $R$style$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($R_style$Type).hashCode; + @core$_.override + int get hashCode => ($R$style$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($R_style$Type) && other is $R_style$Type; + return other.runtimeType == ($R$style$Type) && other is $R$style$Type; } } /// from: `com.example.in_app_java.R` -class R extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class R extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal R.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'com/example/in_app_java/R'); + static final _class = jni$_.JClass.forName(r'com/example/in_app_java/R'); /// The type which includes information such as the signature of this class. + static const nullableType = $R$NullableType(); static const type = $R$Type(); } -final class $R$Type extends _$jni.JObjType { - @_$jni.internal - const $R$Type(); +final class $R$NullableType extends jni$_.JObjType { + @jni$_.internal + const $R$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/example/in_app_java/R;'; - @_$jni.internal - @_$core.override - R fromReference(_$jni.JReference reference) => R.fromReference(reference); + @jni$_.internal + @core$_.override + R? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : R.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override + int get hashCode => ($R$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($R$NullableType) && other is $R$NullableType; + } +} + +final class $R$Type extends jni$_.JObjType { + @jni$_.internal + const $R$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/example/in_app_java/R;'; + + @jni$_.internal + @core$_.override + R fromReference(jni$_.JReference reference) => R.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $R$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override int get hashCode => ($R$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($R$Type) && other is $R$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$CodepointSequenceMatchResult` -class EmojiCompat_CodepointSequenceMatchResult extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_CodepointSequenceMatchResult.fromReference( - _$jni.JReference reference, +class EmojiCompat$CodepointSequenceMatchResult extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$CodepointSequenceMatchResult.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/EmojiCompat$CodepointSequenceMatchResult'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_CodepointSequenceMatchResult$Type(); + static const nullableType = + $EmojiCompat$CodepointSequenceMatchResult$NullableType(); + static const type = $EmojiCompat$CodepointSequenceMatchResult$Type(); /// Maps a specific port to the implemented interface. - static final _$core.Map + static final core$_.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -313,39 +486,39 @@ class EmojiCompat_CodepointSequenceMatchResult extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, - $EmojiCompat_CodepointSequenceMatchResult $impl, + jni$_.JImplementer implementer, + $EmojiCompat$CodepointSequenceMatchResult $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'androidx.emoji2.text.EmojiCompat$CodepointSequenceMatchResult', @@ -357,105 +530,157 @@ class EmojiCompat_CodepointSequenceMatchResult extends _$jni.JObject { _$impls[$a] = $impl; } - factory EmojiCompat_CodepointSequenceMatchResult.implement( - $EmojiCompat_CodepointSequenceMatchResult $impl, + factory EmojiCompat$CodepointSequenceMatchResult.implement( + $EmojiCompat$CodepointSequenceMatchResult $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return EmojiCompat_CodepointSequenceMatchResult.fromReference( + return EmojiCompat$CodepointSequenceMatchResult.fromReference( $i.implementReference(), ); } } -abstract base mixin class $EmojiCompat_CodepointSequenceMatchResult { - factory $EmojiCompat_CodepointSequenceMatchResult() = - _$EmojiCompat_CodepointSequenceMatchResult; +abstract base mixin class $EmojiCompat$CodepointSequenceMatchResult { + factory $EmojiCompat$CodepointSequenceMatchResult() = + _$EmojiCompat$CodepointSequenceMatchResult; } -final class _$EmojiCompat_CodepointSequenceMatchResult - with $EmojiCompat_CodepointSequenceMatchResult { - _$EmojiCompat_CodepointSequenceMatchResult(); +final class _$EmojiCompat$CodepointSequenceMatchResult + with $EmojiCompat$CodepointSequenceMatchResult { + _$EmojiCompat$CodepointSequenceMatchResult(); } -final class $EmojiCompat_CodepointSequenceMatchResult$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_CodepointSequenceMatchResult$Type(); +final class $EmojiCompat$CodepointSequenceMatchResult$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$CodepointSequenceMatchResult$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$CodepointSequenceMatchResult;'; - @_$jni.internal - @_$core.override - EmojiCompat_CodepointSequenceMatchResult fromReference( - _$jni.JReference reference) => - EmojiCompat_CodepointSequenceMatchResult.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$CodepointSequenceMatchResult? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$CodepointSequenceMatchResult.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => + ($EmojiCompat$CodepointSequenceMatchResult$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($EmojiCompat$CodepointSequenceMatchResult$NullableType) && + other is $EmojiCompat$CodepointSequenceMatchResult$NullableType; + } +} + +final class $EmojiCompat$CodepointSequenceMatchResult$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$CodepointSequenceMatchResult$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/EmojiCompat$CodepointSequenceMatchResult;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + EmojiCompat$CodepointSequenceMatchResult fromReference( + jni$_.JReference reference) => + EmojiCompat$CodepointSequenceMatchResult.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$CodepointSequenceMatchResult$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_CodepointSequenceMatchResult$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$CodepointSequenceMatchResult$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($EmojiCompat_CodepointSequenceMatchResult$Type) && - other is $EmojiCompat_CodepointSequenceMatchResult$Type; + ($EmojiCompat$CodepointSequenceMatchResult$Type) && + other is $EmojiCompat$CodepointSequenceMatchResult$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$Config` -class EmojiCompat_Config extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_Config.fromReference( - _$jni.JReference reference, +class EmojiCompat$Config extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$Config.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat$Config'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat$Config'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_Config$Type(); + static const nullableType = $EmojiCompat$Config$NullableType(); + static const type = $EmojiCompat$Config$Type(); static final _id_registerInitCallback = _class.instanceMethodId( r'registerInitCallback', r'(Landroidx/emoji2/text/EmojiCompat$InitCallback;)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _registerInitCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _registerInitCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config registerInitCallback(androidx.emoji2.text.EmojiCompat$InitCallback initCallback)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config registerInitCallback( - EmojiCompat_InitCallback initCallback, + EmojiCompat$Config? registerInitCallback( + EmojiCompat$InitCallback? initCallback, ) { + final _$initCallback = initCallback?.reference ?? jni$_.jNullReference; return _registerInitCallback( reference.pointer, - _id_registerInitCallback as _$jni.JMethodIDPtr, - initCallback.reference.pointer) - .object(const $EmojiCompat_Config$Type()); + _id_registerInitCallback as jni$_.JMethodIDPtr, + _$initCallback.pointer) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_unregisterInitCallback = _class.instanceMethodId( @@ -463,27 +688,28 @@ class EmojiCompat_Config extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$InitCallback;)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _unregisterInitCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _unregisterInitCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config unregisterInitCallback(androidx.emoji2.text.EmojiCompat$InitCallback initCallback)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config unregisterInitCallback( - EmojiCompat_InitCallback initCallback, + EmojiCompat$Config? unregisterInitCallback( + EmojiCompat$InitCallback? initCallback, ) { + final _$initCallback = initCallback?.reference ?? jni$_.jNullReference; return _unregisterInitCallback( reference.pointer, - _id_unregisterInitCallback as _$jni.JMethodIDPtr, - initCallback.reference.pointer) - .object(const $EmojiCompat_Config$Type()); + _id_unregisterInitCallback as jni$_.JMethodIDPtr, + _$initCallback.pointer) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setReplaceAll = _class.instanceMethodId( @@ -491,24 +717,24 @@ class EmojiCompat_Config extends _$jni.JObject { r'(Z)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _setReplaceAll = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + static final _setReplaceAll = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setReplaceAll(boolean z)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setReplaceAll( + EmojiCompat$Config? setReplaceAll( bool z, ) { return _setReplaceAll(reference.pointer, - _id_setReplaceAll as _$jni.JMethodIDPtr, z ? 1 : 0) - .object(const $EmojiCompat_Config$Type()); + _id_setReplaceAll as jni$_.JMethodIDPtr, z ? 1 : 0) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setUseEmojiAsDefaultStyle = _class.instanceMethodId( @@ -516,24 +742,24 @@ class EmojiCompat_Config extends _$jni.JObject { r'(Z)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _setUseEmojiAsDefaultStyle = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + static final _setUseEmojiAsDefaultStyle = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setUseEmojiAsDefaultStyle(boolean z)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setUseEmojiAsDefaultStyle( + EmojiCompat$Config? setUseEmojiAsDefaultStyle( bool z, ) { return _setUseEmojiAsDefaultStyle(reference.pointer, - _id_setUseEmojiAsDefaultStyle as _$jni.JMethodIDPtr, z ? 1 : 0) - .object(const $EmojiCompat_Config$Type()); + _id_setUseEmojiAsDefaultStyle as jni$_.JMethodIDPtr, z ? 1 : 0) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setUseEmojiAsDefaultStyle$1 = _class.instanceMethodId( @@ -542,32 +768,33 @@ class EmojiCompat_Config extends _$jni.JObject { ); static final _setUseEmojiAsDefaultStyle$1 = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Pointer<_$jni.Void> + jni$_.Int32, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setUseEmojiAsDefaultStyle(boolean z, java.util.List list)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setUseEmojiAsDefaultStyle$1( + EmojiCompat$Config? setUseEmojiAsDefaultStyle$1( bool z, - _$jni.JList<_$jni.JInteger> list, + jni$_.JList? list, ) { + final _$list = list?.reference ?? jni$_.jNullReference; return _setUseEmojiAsDefaultStyle$1( reference.pointer, - _id_setUseEmojiAsDefaultStyle$1 as _$jni.JMethodIDPtr, + _id_setUseEmojiAsDefaultStyle$1 as jni$_.JMethodIDPtr, z ? 1 : 0, - list.reference.pointer) - .object(const $EmojiCompat_Config$Type()); + _$list.pointer) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setEmojiSpanIndicatorEnabled = _class.instanceMethodId( @@ -576,23 +803,23 @@ class EmojiCompat_Config extends _$jni.JObject { ); static final _setEmojiSpanIndicatorEnabled = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setEmojiSpanIndicatorEnabled(boolean z)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setEmojiSpanIndicatorEnabled( + EmojiCompat$Config? setEmojiSpanIndicatorEnabled( bool z, ) { return _setEmojiSpanIndicatorEnabled(reference.pointer, - _id_setEmojiSpanIndicatorEnabled as _$jni.JMethodIDPtr, z ? 1 : 0) - .object(const $EmojiCompat_Config$Type()); + _id_setEmojiSpanIndicatorEnabled as jni$_.JMethodIDPtr, z ? 1 : 0) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setEmojiSpanIndicatorColor = _class.instanceMethodId( @@ -601,23 +828,23 @@ class EmojiCompat_Config extends _$jni.JObject { ); static final _setEmojiSpanIndicatorColor = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setEmojiSpanIndicatorColor(int i)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setEmojiSpanIndicatorColor( + EmojiCompat$Config? setEmojiSpanIndicatorColor( int i, ) { return _setEmojiSpanIndicatorColor(reference.pointer, - _id_setEmojiSpanIndicatorColor as _$jni.JMethodIDPtr, i) - .object(const $EmojiCompat_Config$Type()); + _id_setEmojiSpanIndicatorColor as jni$_.JMethodIDPtr, i) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setMetadataLoadStrategy = _class.instanceMethodId( @@ -625,24 +852,24 @@ class EmojiCompat_Config extends _$jni.JObject { r'(I)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _setMetadataLoadStrategy = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + static final _setMetadataLoadStrategy = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setMetadataLoadStrategy(int i)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setMetadataLoadStrategy( + EmojiCompat$Config? setMetadataLoadStrategy( int i, ) { return _setMetadataLoadStrategy(reference.pointer, - _id_setMetadataLoadStrategy as _$jni.JMethodIDPtr, i) - .object(const $EmojiCompat_Config$Type()); + _id_setMetadataLoadStrategy as jni$_.JMethodIDPtr, i) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setSpanFactory = _class.instanceMethodId( @@ -650,27 +877,26 @@ class EmojiCompat_Config extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$SpanFactory;)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _setSpanFactory = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setSpanFactory = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setSpanFactory(androidx.emoji2.text.EmojiCompat$SpanFactory spanFactory)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setSpanFactory( - EmojiCompat_SpanFactory spanFactory, + EmojiCompat$Config? setSpanFactory( + EmojiCompat$SpanFactory? spanFactory, ) { - return _setSpanFactory( - reference.pointer, - _id_setSpanFactory as _$jni.JMethodIDPtr, - spanFactory.reference.pointer) - .object(const $EmojiCompat_Config$Type()); + final _$spanFactory = spanFactory?.reference ?? jni$_.jNullReference; + return _setSpanFactory(reference.pointer, + _id_setSpanFactory as jni$_.JMethodIDPtr, _$spanFactory.pointer) + .object(const $EmojiCompat$Config$NullableType()); } static final _id_setGlyphChecker = _class.instanceMethodId( @@ -678,100 +904,145 @@ class EmojiCompat_Config extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$GlyphChecker;)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _setGlyphChecker = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setGlyphChecker = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config setGlyphChecker(androidx.emoji2.text.EmojiCompat$GlyphChecker glyphChecker)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config setGlyphChecker( - EmojiCompat_GlyphChecker glyphChecker, + EmojiCompat$Config? setGlyphChecker( + EmojiCompat$GlyphChecker? glyphChecker, ) { - return _setGlyphChecker( - reference.pointer, - _id_setGlyphChecker as _$jni.JMethodIDPtr, - glyphChecker.reference.pointer) - .object(const $EmojiCompat_Config$Type()); + final _$glyphChecker = glyphChecker?.reference ?? jni$_.jNullReference; + return _setGlyphChecker(reference.pointer, + _id_setGlyphChecker as jni$_.JMethodIDPtr, _$glyphChecker.pointer) + .object(const $EmojiCompat$Config$NullableType()); } } -final class $EmojiCompat_Config$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_Config$Type(); +final class $EmojiCompat$Config$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$Config$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$Config;'; - @_$jni.internal - @_$core.override - EmojiCompat_Config fromReference(_$jni.JReference reference) => - EmojiCompat_Config.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$Config? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$Config.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => ($EmojiCompat$Config$NullableType).hashCode; - @_$jni.internal - @_$core.override + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$Config$NullableType) && + other is $EmojiCompat$Config$NullableType; + } +} + +final class $EmojiCompat$Config$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$Config$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat$Config;'; + + @jni$_.internal + @core$_.override + EmojiCompat$Config fromReference(jni$_.JReference reference) => + EmojiCompat$Config.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$Config$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_Config$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$Config$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_Config$Type) && - other is $EmojiCompat_Config$Type; + return other.runtimeType == ($EmojiCompat$Config$Type) && + other is $EmojiCompat$Config$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$DefaultSpanFactory` -class EmojiCompat_DefaultSpanFactory extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_DefaultSpanFactory.fromReference( - _$jni.JReference reference, +class EmojiCompat$DefaultSpanFactory extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$DefaultSpanFactory.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/EmojiCompat$DefaultSpanFactory'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_DefaultSpanFactory$Type(); + static const nullableType = $EmojiCompat$DefaultSpanFactory$NullableType(); + static const type = $EmojiCompat$DefaultSpanFactory$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory EmojiCompat_DefaultSpanFactory() { - return EmojiCompat_DefaultSpanFactory.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + factory EmojiCompat$DefaultSpanFactory() { + return EmojiCompat$DefaultSpanFactory.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -780,121 +1051,172 @@ class EmojiCompat_DefaultSpanFactory extends _$jni.JObject { r'(Landroidx/emoji2/text/TypefaceEmojiRasterizer;)Landroidx/emoji2/text/EmojiSpan;', ); - static final _createSpan = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createSpan = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiSpan createSpan(androidx.emoji2.text.TypefaceEmojiRasterizer typefaceEmojiRasterizer)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject createSpan( - _$jni.JObject typefaceEmojiRasterizer, + jni$_.JObject? createSpan( + jni$_.JObject? typefaceEmojiRasterizer, ) { - return _createSpan(reference.pointer, _id_createSpan as _$jni.JMethodIDPtr, - typefaceEmojiRasterizer.reference.pointer) - .object(const _$jni.JObjectType()); + final _$typefaceEmojiRasterizer = + typefaceEmojiRasterizer?.reference ?? jni$_.jNullReference; + return _createSpan(reference.pointer, _id_createSpan as jni$_.JMethodIDPtr, + _$typefaceEmojiRasterizer.pointer) + .object(const jni$_.JObjectNullableType()); } } -final class $EmojiCompat_DefaultSpanFactory$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_DefaultSpanFactory$Type(); +final class $EmojiCompat$DefaultSpanFactory$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$DefaultSpanFactory$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$DefaultSpanFactory;'; - @_$jni.internal - @_$core.override - EmojiCompat_DefaultSpanFactory fromReference(_$jni.JReference reference) => - EmojiCompat_DefaultSpanFactory.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$DefaultSpanFactory? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$DefaultSpanFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => ($EmojiCompat$DefaultSpanFactory$NullableType).hashCode; - @_$jni.internal - @_$core.override + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($EmojiCompat$DefaultSpanFactory$NullableType) && + other is $EmojiCompat$DefaultSpanFactory$NullableType; + } +} + +final class $EmojiCompat$DefaultSpanFactory$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$DefaultSpanFactory$Type(); + + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/EmojiCompat$DefaultSpanFactory;'; + + @jni$_.internal + @core$_.override + EmojiCompat$DefaultSpanFactory fromReference(jni$_.JReference reference) => + EmojiCompat$DefaultSpanFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$DefaultSpanFactory$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_DefaultSpanFactory$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$DefaultSpanFactory$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_DefaultSpanFactory$Type) && - other is $EmojiCompat_DefaultSpanFactory$Type; + return other.runtimeType == ($EmojiCompat$DefaultSpanFactory$Type) && + other is $EmojiCompat$DefaultSpanFactory$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$GlyphChecker` -class EmojiCompat_GlyphChecker extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_GlyphChecker.fromReference( - _$jni.JReference reference, +class EmojiCompat$GlyphChecker extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$GlyphChecker.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat$GlyphChecker'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat$GlyphChecker'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_GlyphChecker$Type(); + static const nullableType = $EmojiCompat$GlyphChecker$NullableType(); + static const type = $EmojiCompat$GlyphChecker$Type(); static final _id_hasGlyph = _class.instanceMethodId( r'hasGlyph', r'(Ljava/lang/CharSequence;III)Z', ); - static final _hasGlyph = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _hasGlyph = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int, int)>(); /// from: `public abstract boolean hasGlyph(java.lang.CharSequence charSequence, int i, int i1, int i2)` bool hasGlyph( - _$jni.JObject charSequence, + jni$_.JObject? charSequence, int i, int i1, int i2, ) { - return _hasGlyph(reference.pointer, _id_hasGlyph as _$jni.JMethodIDPtr, - charSequence.reference.pointer, i, i1, i2) + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _hasGlyph(reference.pointer, _id_hasGlyph as jni$_.JMethodIDPtr, + _$charSequence.pointer, i, i1, i2) .boolean; } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -902,54 +1224,54 @@ class EmojiCompat_GlyphChecker extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'hasGlyph(Ljava/lang/CharSequence;III)Z') { final $r = _$impls[$p]!.hasGlyph( - $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), - $a[1] - .as(const _$jni.JIntegerType(), releaseOriginal: true) + $a![0]?.as(const jni$_.JObjectType(), releaseOriginal: true), + $a![1]! + .as(const jni$_.JIntegerType(), releaseOriginal: true) .intValue(releaseOriginal: true), - $a[2] - .as(const _$jni.JIntegerType(), releaseOriginal: true) + $a![2]! + .as(const jni$_.JIntegerType(), releaseOriginal: true) .intValue(releaseOriginal: true), - $a[3] - .as(const _$jni.JIntegerType(), releaseOriginal: true) + $a![3]! + .as(const jni$_.JIntegerType(), releaseOriginal: true) .intValue(releaseOriginal: true), ); - return _$jni.JBoolean($r).reference.toPointer(); + return jni$_.JBoolean($r).reference.toPointer(); } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, - $EmojiCompat_GlyphChecker $impl, + jni$_.JImplementer implementer, + $EmojiCompat$GlyphChecker $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'androidx.emoji2.text.EmojiCompat$GlyphChecker', @@ -961,109 +1283,155 @@ class EmojiCompat_GlyphChecker extends _$jni.JObject { _$impls[$a] = $impl; } - factory EmojiCompat_GlyphChecker.implement( - $EmojiCompat_GlyphChecker $impl, + factory EmojiCompat$GlyphChecker.implement( + $EmojiCompat$GlyphChecker $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return EmojiCompat_GlyphChecker.fromReference( + return EmojiCompat$GlyphChecker.fromReference( $i.implementReference(), ); } } -abstract base mixin class $EmojiCompat_GlyphChecker { - factory $EmojiCompat_GlyphChecker({ - required bool Function(_$jni.JObject charSequence, int i, int i1, int i2) +abstract base mixin class $EmojiCompat$GlyphChecker { + factory $EmojiCompat$GlyphChecker({ + required bool Function(jni$_.JObject? charSequence, int i, int i1, int i2) hasGlyph, - }) = _$EmojiCompat_GlyphChecker; + }) = _$EmojiCompat$GlyphChecker; - bool hasGlyph(_$jni.JObject charSequence, int i, int i1, int i2); + bool hasGlyph(jni$_.JObject? charSequence, int i, int i1, int i2); } -final class _$EmojiCompat_GlyphChecker with $EmojiCompat_GlyphChecker { - _$EmojiCompat_GlyphChecker({ - required bool Function(_$jni.JObject charSequence, int i, int i1, int i2) +final class _$EmojiCompat$GlyphChecker with $EmojiCompat$GlyphChecker { + _$EmojiCompat$GlyphChecker({ + required bool Function(jni$_.JObject? charSequence, int i, int i1, int i2) hasGlyph, }) : _hasGlyph = hasGlyph; - final bool Function(_$jni.JObject charSequence, int i, int i1, int i2) + final bool Function(jni$_.JObject? charSequence, int i, int i1, int i2) _hasGlyph; - bool hasGlyph(_$jni.JObject charSequence, int i, int i1, int i2) { + bool hasGlyph(jni$_.JObject? charSequence, int i, int i1, int i2) { return _hasGlyph(charSequence, i, i1, i2); } } -final class $EmojiCompat_GlyphChecker$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_GlyphChecker$Type(); +final class $EmojiCompat$GlyphChecker$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$GlyphChecker$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$GlyphChecker;'; - @_$jni.internal - @_$core.override - EmojiCompat_GlyphChecker fromReference(_$jni.JReference reference) => - EmojiCompat_GlyphChecker.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$GlyphChecker? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$GlyphChecker.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => ($EmojiCompat$GlyphChecker$NullableType).hashCode; - @_$jni.internal - @_$core.override + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$GlyphChecker$NullableType) && + other is $EmojiCompat$GlyphChecker$NullableType; + } +} + +final class $EmojiCompat$GlyphChecker$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$GlyphChecker$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat$GlyphChecker;'; + + @jni$_.internal + @core$_.override + EmojiCompat$GlyphChecker fromReference(jni$_.JReference reference) => + EmojiCompat$GlyphChecker.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$GlyphChecker$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_GlyphChecker$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$GlyphChecker$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_GlyphChecker$Type) && - other is $EmojiCompat_GlyphChecker$Type; + return other.runtimeType == ($EmojiCompat$GlyphChecker$Type) && + other is $EmojiCompat$GlyphChecker$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$InitCallback` -class EmojiCompat_InitCallback extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_InitCallback.fromReference( - _$jni.JReference reference, +class EmojiCompat$InitCallback extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$InitCallback.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat$InitCallback'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat$InitCallback'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_InitCallback$Type(); + static const nullableType = $EmojiCompat$InitCallback$NullableType(); + static const type = $EmojiCompat$InitCallback$Type(); static final _id_onInitialized = _class.instanceMethodId( r'onInitialized', r'()V', ); - static final _onInitialized = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _onInitialized = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void onInitialized()` void onInitialized() { - _onInitialized(reference.pointer, _id_onInitialized as _$jni.JMethodIDPtr) + _onInitialized(reference.pointer, _id_onInitialized as jni$_.JMethodIDPtr) .check(); } @@ -1072,87 +1440,134 @@ class EmojiCompat_InitCallback extends _$jni.JObject { r'(Ljava/lang/Throwable;)V', ); - static final _onFailed = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _onFailed = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void onFailed(java.lang.Throwable throwable)` void onFailed( - _$jni.JObject throwable, + jni$_.JObject? throwable, ) { - _onFailed(reference.pointer, _id_onFailed as _$jni.JMethodIDPtr, - throwable.reference.pointer) + final _$throwable = throwable?.reference ?? jni$_.jNullReference; + _onFailed(reference.pointer, _id_onFailed as jni$_.JMethodIDPtr, + _$throwable.pointer) .check(); } } -final class $EmojiCompat_InitCallback$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_InitCallback$Type(); +final class $EmojiCompat$InitCallback$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$InitCallback$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$InitCallback;'; - @_$jni.internal - @_$core.override - EmojiCompat_InitCallback fromReference(_$jni.JReference reference) => - EmojiCompat_InitCallback.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$InitCallback? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$InitCallback.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($EmojiCompat$InitCallback$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$InitCallback$NullableType) && + other is $EmojiCompat$InitCallback$NullableType; + } +} + +final class $EmojiCompat$InitCallback$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$InitCallback$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat$InitCallback;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + EmojiCompat$InitCallback fromReference(jni$_.JReference reference) => + EmojiCompat$InitCallback.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$InitCallback$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_InitCallback$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$InitCallback$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_InitCallback$Type) && - other is $EmojiCompat_InitCallback$Type; + return other.runtimeType == ($EmojiCompat$InitCallback$Type) && + other is $EmojiCompat$InitCallback$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$LoadStrategy` -class EmojiCompat_LoadStrategy extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_LoadStrategy.fromReference( - _$jni.JReference reference, +class EmojiCompat$LoadStrategy extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$LoadStrategy.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat$LoadStrategy'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat$LoadStrategy'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_LoadStrategy$Type(); + static const nullableType = $EmojiCompat$LoadStrategy$NullableType(); + static const type = $EmojiCompat$LoadStrategy$Type(); /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -1160,39 +1575,39 @@ class EmojiCompat_LoadStrategy extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, - $EmojiCompat_LoadStrategy $impl, + jni$_.JImplementer implementer, + $EmojiCompat$LoadStrategy $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'androidx.emoji2.text.EmojiCompat$LoadStrategy', @@ -1204,109 +1619,157 @@ class EmojiCompat_LoadStrategy extends _$jni.JObject { _$impls[$a] = $impl; } - factory EmojiCompat_LoadStrategy.implement( - $EmojiCompat_LoadStrategy $impl, + factory EmojiCompat$LoadStrategy.implement( + $EmojiCompat$LoadStrategy $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return EmojiCompat_LoadStrategy.fromReference( + return EmojiCompat$LoadStrategy.fromReference( $i.implementReference(), ); } } -abstract base mixin class $EmojiCompat_LoadStrategy { - factory $EmojiCompat_LoadStrategy() = _$EmojiCompat_LoadStrategy; +abstract base mixin class $EmojiCompat$LoadStrategy { + factory $EmojiCompat$LoadStrategy() = _$EmojiCompat$LoadStrategy; } -final class _$EmojiCompat_LoadStrategy with $EmojiCompat_LoadStrategy { - _$EmojiCompat_LoadStrategy(); +final class _$EmojiCompat$LoadStrategy with $EmojiCompat$LoadStrategy { + _$EmojiCompat$LoadStrategy(); } -final class $EmojiCompat_LoadStrategy$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_LoadStrategy$Type(); +final class $EmojiCompat$LoadStrategy$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$LoadStrategy$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$LoadStrategy;'; - @_$jni.internal - @_$core.override - EmojiCompat_LoadStrategy fromReference(_$jni.JReference reference) => - EmojiCompat_LoadStrategy.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$LoadStrategy? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$LoadStrategy.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($EmojiCompat$LoadStrategy$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$LoadStrategy$NullableType) && + other is $EmojiCompat$LoadStrategy$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $EmojiCompat$LoadStrategy$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$LoadStrategy$Type(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat$LoadStrategy;'; + + @jni$_.internal + @core$_.override + EmojiCompat$LoadStrategy fromReference(jni$_.JReference reference) => + EmojiCompat$LoadStrategy.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$LoadStrategy$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_LoadStrategy$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$LoadStrategy$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_LoadStrategy$Type) && - other is $EmojiCompat_LoadStrategy$Type; + return other.runtimeType == ($EmojiCompat$LoadStrategy$Type) && + other is $EmojiCompat$LoadStrategy$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$MetadataRepoLoader` -class EmojiCompat_MetadataRepoLoader extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_MetadataRepoLoader.fromReference( - _$jni.JReference reference, +class EmojiCompat$MetadataRepoLoader extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$MetadataRepoLoader.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/EmojiCompat$MetadataRepoLoader'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_MetadataRepoLoader$Type(); + static const nullableType = $EmojiCompat$MetadataRepoLoader$NullableType(); + static const type = $EmojiCompat$MetadataRepoLoader$Type(); static final _id_load = _class.instanceMethodId( r'load', r'(Landroidx/emoji2/text/EmojiCompat$MetadataRepoLoaderCallback;)V', ); - static final _load = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _load = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract void load(androidx.emoji2.text.EmojiCompat$MetadataRepoLoaderCallback metadataRepoLoaderCallback)` void load( - EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback, + EmojiCompat$MetadataRepoLoaderCallback? metadataRepoLoaderCallback, ) { - _load(reference.pointer, _id_load as _$jni.JMethodIDPtr, - metadataRepoLoaderCallback.reference.pointer) + final _$metadataRepoLoaderCallback = + metadataRepoLoaderCallback?.reference ?? jni$_.jNullReference; + _load(reference.pointer, _id_load as jni$_.JMethodIDPtr, + _$metadataRepoLoaderCallback.pointer) .check(); } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -1314,15 +1777,15 @@ class EmojiCompat_MetadataRepoLoader extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); @@ -1330,31 +1793,31 @@ class EmojiCompat_MetadataRepoLoader extends _$jni.JObject { if ($d == r'load(Landroidx/emoji2/text/EmojiCompat$MetadataRepoLoaderCallback;)V') { _$impls[$p]!.load( - $a[0].as(const $EmojiCompat_MetadataRepoLoaderCallback$Type(), + $a![0]?.as(const $EmojiCompat$MetadataRepoLoaderCallback$Type(), releaseOriginal: true), ); - return _$jni.nullptr; + return jni$_.nullptr; } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, - $EmojiCompat_MetadataRepoLoader $impl, + jni$_.JImplementer implementer, + $EmojiCompat$MetadataRepoLoader $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'androidx.emoji2.text.EmojiCompat$MetadataRepoLoader', @@ -1369,119 +1832,170 @@ class EmojiCompat_MetadataRepoLoader extends _$jni.JObject { _$impls[$a] = $impl; } - factory EmojiCompat_MetadataRepoLoader.implement( - $EmojiCompat_MetadataRepoLoader $impl, + factory EmojiCompat$MetadataRepoLoader.implement( + $EmojiCompat$MetadataRepoLoader $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return EmojiCompat_MetadataRepoLoader.fromReference( + return EmojiCompat$MetadataRepoLoader.fromReference( $i.implementReference(), ); } } -abstract base mixin class $EmojiCompat_MetadataRepoLoader { - factory $EmojiCompat_MetadataRepoLoader({ +abstract base mixin class $EmojiCompat$MetadataRepoLoader { + factory $EmojiCompat$MetadataRepoLoader({ required void Function( - EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback) + EmojiCompat$MetadataRepoLoaderCallback? metadataRepoLoaderCallback) load, bool load$async, - }) = _$EmojiCompat_MetadataRepoLoader; + }) = _$EmojiCompat$MetadataRepoLoader; - void load(EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback); + void load(EmojiCompat$MetadataRepoLoaderCallback? metadataRepoLoaderCallback); bool get load$async => false; } -final class _$EmojiCompat_MetadataRepoLoader - with $EmojiCompat_MetadataRepoLoader { - _$EmojiCompat_MetadataRepoLoader({ +final class _$EmojiCompat$MetadataRepoLoader + with $EmojiCompat$MetadataRepoLoader { + _$EmojiCompat$MetadataRepoLoader({ required void Function( - EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback) + EmojiCompat$MetadataRepoLoaderCallback? metadataRepoLoaderCallback) load, this.load$async = false, }) : _load = load; final void Function( - EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback) _load; + EmojiCompat$MetadataRepoLoaderCallback? metadataRepoLoaderCallback) _load; final bool load$async; - void load(EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback) { + void load( + EmojiCompat$MetadataRepoLoaderCallback? metadataRepoLoaderCallback) { return _load(metadataRepoLoaderCallback); } } -final class $EmojiCompat_MetadataRepoLoader$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_MetadataRepoLoader$Type(); +final class $EmojiCompat$MetadataRepoLoader$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$MetadataRepoLoader$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$MetadataRepoLoader;'; - @_$jni.internal - @_$core.override - EmojiCompat_MetadataRepoLoader fromReference(_$jni.JReference reference) => - EmojiCompat_MetadataRepoLoader.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$MetadataRepoLoader? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$MetadataRepoLoader.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($EmojiCompat$MetadataRepoLoader$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($EmojiCompat$MetadataRepoLoader$NullableType) && + other is $EmojiCompat$MetadataRepoLoader$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $EmojiCompat$MetadataRepoLoader$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$MetadataRepoLoader$Type(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/EmojiCompat$MetadataRepoLoader;'; + + @jni$_.internal + @core$_.override + EmojiCompat$MetadataRepoLoader fromReference(jni$_.JReference reference) => + EmojiCompat$MetadataRepoLoader.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$MetadataRepoLoader$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_MetadataRepoLoader$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$MetadataRepoLoader$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_MetadataRepoLoader$Type) && - other is $EmojiCompat_MetadataRepoLoader$Type; + return other.runtimeType == ($EmojiCompat$MetadataRepoLoader$Type) && + other is $EmojiCompat$MetadataRepoLoader$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$MetadataRepoLoaderCallback` -class EmojiCompat_MetadataRepoLoaderCallback extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_MetadataRepoLoaderCallback.fromReference( - _$jni.JReference reference, +class EmojiCompat$MetadataRepoLoaderCallback extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$MetadataRepoLoaderCallback.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/EmojiCompat$MetadataRepoLoaderCallback'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_MetadataRepoLoaderCallback$Type(); + static const nullableType = + $EmojiCompat$MetadataRepoLoaderCallback$NullableType(); + static const type = $EmojiCompat$MetadataRepoLoaderCallback$Type(); static final _id_onLoaded = _class.instanceMethodId( r'onLoaded', r'(Landroidx/emoji2/text/MetadataRepo;)V', ); - static final _onLoaded = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _onLoaded = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract void onLoaded(androidx.emoji2.text.MetadataRepo metadataRepo)` void onLoaded( - _$jni.JObject metadataRepo, + jni$_.JObject? metadataRepo, ) { - _onLoaded(reference.pointer, _id_onLoaded as _$jni.JMethodIDPtr, - metadataRepo.reference.pointer) + final _$metadataRepo = metadataRepo?.reference ?? jni$_.jNullReference; + _onLoaded(reference.pointer, _id_onLoaded as jni$_.JMethodIDPtr, + _$metadataRepo.pointer) .check(); } @@ -1490,90 +2004,142 @@ class EmojiCompat_MetadataRepoLoaderCallback extends _$jni.JObject { r'(Ljava/lang/Throwable;)V', ); - static final _onFailed = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _onFailed = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract void onFailed(java.lang.Throwable throwable)` void onFailed( - _$jni.JObject throwable, + jni$_.JObject? throwable, ) { - _onFailed(reference.pointer, _id_onFailed as _$jni.JMethodIDPtr, - throwable.reference.pointer) + final _$throwable = throwable?.reference ?? jni$_.jNullReference; + _onFailed(reference.pointer, _id_onFailed as jni$_.JMethodIDPtr, + _$throwable.pointer) .check(); } } -final class $EmojiCompat_MetadataRepoLoaderCallback$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_MetadataRepoLoaderCallback$Type(); +final class $EmojiCompat$MetadataRepoLoaderCallback$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$MetadataRepoLoaderCallback$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$MetadataRepoLoaderCallback;'; - @_$jni.internal - @_$core.override - EmojiCompat_MetadataRepoLoaderCallback fromReference( - _$jni.JReference reference) => - EmojiCompat_MetadataRepoLoaderCallback.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$MetadataRepoLoaderCallback? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$MetadataRepoLoaderCallback.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => + ($EmojiCompat$MetadataRepoLoaderCallback$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($EmojiCompat$MetadataRepoLoaderCallback$NullableType) && + other is $EmojiCompat$MetadataRepoLoaderCallback$NullableType; + } +} + +final class $EmojiCompat$MetadataRepoLoaderCallback$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$MetadataRepoLoaderCallback$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/EmojiCompat$MetadataRepoLoaderCallback;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + EmojiCompat$MetadataRepoLoaderCallback fromReference( + jni$_.JReference reference) => + EmojiCompat$MetadataRepoLoaderCallback.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$MetadataRepoLoaderCallback$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_MetadataRepoLoaderCallback$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$MetadataRepoLoaderCallback$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($EmojiCompat_MetadataRepoLoaderCallback$Type) && - other is $EmojiCompat_MetadataRepoLoaderCallback$Type; + ($EmojiCompat$MetadataRepoLoaderCallback$Type) && + other is $EmojiCompat$MetadataRepoLoaderCallback$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$ReplaceStrategy` -class EmojiCompat_ReplaceStrategy extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_ReplaceStrategy.fromReference( - _$jni.JReference reference, +class EmojiCompat$ReplaceStrategy extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$ReplaceStrategy.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat$ReplaceStrategy'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat$ReplaceStrategy'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_ReplaceStrategy$Type(); + static const nullableType = $EmojiCompat$ReplaceStrategy$NullableType(); + static const type = $EmojiCompat$ReplaceStrategy$Type(); /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -1581,39 +2147,39 @@ class EmojiCompat_ReplaceStrategy extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, - $EmojiCompat_ReplaceStrategy $impl, + jni$_.JImplementer implementer, + $EmojiCompat$ReplaceStrategy $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'androidx.emoji2.text.EmojiCompat$ReplaceStrategy', @@ -1625,110 +2191,158 @@ class EmojiCompat_ReplaceStrategy extends _$jni.JObject { _$impls[$a] = $impl; } - factory EmojiCompat_ReplaceStrategy.implement( - $EmojiCompat_ReplaceStrategy $impl, + factory EmojiCompat$ReplaceStrategy.implement( + $EmojiCompat$ReplaceStrategy $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return EmojiCompat_ReplaceStrategy.fromReference( + return EmojiCompat$ReplaceStrategy.fromReference( $i.implementReference(), ); } } -abstract base mixin class $EmojiCompat_ReplaceStrategy { - factory $EmojiCompat_ReplaceStrategy() = _$EmojiCompat_ReplaceStrategy; +abstract base mixin class $EmojiCompat$ReplaceStrategy { + factory $EmojiCompat$ReplaceStrategy() = _$EmojiCompat$ReplaceStrategy; } -final class _$EmojiCompat_ReplaceStrategy with $EmojiCompat_ReplaceStrategy { - _$EmojiCompat_ReplaceStrategy(); +final class _$EmojiCompat$ReplaceStrategy with $EmojiCompat$ReplaceStrategy { + _$EmojiCompat$ReplaceStrategy(); } -final class $EmojiCompat_ReplaceStrategy$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_ReplaceStrategy$Type(); +final class $EmojiCompat$ReplaceStrategy$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$ReplaceStrategy$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$ReplaceStrategy;'; - @_$jni.internal - @_$core.override - EmojiCompat_ReplaceStrategy fromReference(_$jni.JReference reference) => - EmojiCompat_ReplaceStrategy.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$ReplaceStrategy? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$ReplaceStrategy.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($EmojiCompat$ReplaceStrategy$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$ReplaceStrategy$NullableType) && + other is $EmojiCompat$ReplaceStrategy$NullableType; + } +} + +final class $EmojiCompat$ReplaceStrategy$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$ReplaceStrategy$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat$ReplaceStrategy;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + EmojiCompat$ReplaceStrategy fromReference(jni$_.JReference reference) => + EmojiCompat$ReplaceStrategy.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$ReplaceStrategy$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_ReplaceStrategy$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$ReplaceStrategy$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_ReplaceStrategy$Type) && - other is $EmojiCompat_ReplaceStrategy$Type; + return other.runtimeType == ($EmojiCompat$ReplaceStrategy$Type) && + other is $EmojiCompat$ReplaceStrategy$Type; } } /// from: `androidx.emoji2.text.EmojiCompat$SpanFactory` -class EmojiCompat_SpanFactory extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - EmojiCompat_SpanFactory.fromReference( - _$jni.JReference reference, +class EmojiCompat$SpanFactory extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + EmojiCompat$SpanFactory.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat$SpanFactory'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat$SpanFactory'); /// The type which includes information such as the signature of this class. - static const type = $EmojiCompat_SpanFactory$Type(); + static const nullableType = $EmojiCompat$SpanFactory$NullableType(); + static const type = $EmojiCompat$SpanFactory$Type(); static final _id_createSpan = _class.instanceMethodId( r'createSpan', r'(Landroidx/emoji2/text/TypefaceEmojiRasterizer;)Landroidx/emoji2/text/EmojiSpan;', ); - static final _createSpan = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createSpan = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract androidx.emoji2.text.EmojiSpan createSpan(androidx.emoji2.text.TypefaceEmojiRasterizer typefaceEmojiRasterizer)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject createSpan( - _$jni.JObject typefaceEmojiRasterizer, + jni$_.JObject? createSpan( + jni$_.JObject? typefaceEmojiRasterizer, ) { - return _createSpan(reference.pointer, _id_createSpan as _$jni.JMethodIDPtr, - typefaceEmojiRasterizer.reference.pointer) - .object(const _$jni.JObjectType()); + final _$typefaceEmojiRasterizer = + typefaceEmojiRasterizer?.reference ?? jni$_.jNullReference; + return _createSpan(reference.pointer, _id_createSpan as jni$_.JMethodIDPtr, + _$typefaceEmojiRasterizer.pointer) + .object(const jni$_.JObjectNullableType()); } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -1736,15 +2350,15 @@ class EmojiCompat_SpanFactory extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); @@ -1752,33 +2366,34 @@ class EmojiCompat_SpanFactory extends _$jni.JObject { if ($d == r'createSpan(Landroidx/emoji2/text/TypefaceEmojiRasterizer;)Landroidx/emoji2/text/EmojiSpan;') { final $r = _$impls[$p]!.createSpan( - $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + $a![0]?.as(const jni$_.JObjectType(), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, - $EmojiCompat_SpanFactory $impl, + jni$_.JImplementer implementer, + $EmojiCompat$SpanFactory $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'androidx.emoji2.text.EmojiCompat$SpanFactory', @@ -1790,88 +2405,134 @@ class EmojiCompat_SpanFactory extends _$jni.JObject { _$impls[$a] = $impl; } - factory EmojiCompat_SpanFactory.implement( - $EmojiCompat_SpanFactory $impl, + factory EmojiCompat$SpanFactory.implement( + $EmojiCompat$SpanFactory $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return EmojiCompat_SpanFactory.fromReference( + return EmojiCompat$SpanFactory.fromReference( $i.implementReference(), ); } } -abstract base mixin class $EmojiCompat_SpanFactory { - factory $EmojiCompat_SpanFactory({ - required _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer) +abstract base mixin class $EmojiCompat$SpanFactory { + factory $EmojiCompat$SpanFactory({ + required jni$_.JObject? Function(jni$_.JObject? typefaceEmojiRasterizer) createSpan, - }) = _$EmojiCompat_SpanFactory; + }) = _$EmojiCompat$SpanFactory; - _$jni.JObject createSpan(_$jni.JObject typefaceEmojiRasterizer); + jni$_.JObject? createSpan(jni$_.JObject? typefaceEmojiRasterizer); } -final class _$EmojiCompat_SpanFactory with $EmojiCompat_SpanFactory { - _$EmojiCompat_SpanFactory({ - required _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer) +final class _$EmojiCompat$SpanFactory with $EmojiCompat$SpanFactory { + _$EmojiCompat$SpanFactory({ + required jni$_.JObject? Function(jni$_.JObject? typefaceEmojiRasterizer) createSpan, }) : _createSpan = createSpan; - final _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer) + final jni$_.JObject? Function(jni$_.JObject? typefaceEmojiRasterizer) _createSpan; - _$jni.JObject createSpan(_$jni.JObject typefaceEmojiRasterizer) { + jni$_.JObject? createSpan(jni$_.JObject? typefaceEmojiRasterizer) { return _createSpan(typefaceEmojiRasterizer); } } -final class $EmojiCompat_SpanFactory$Type - extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat_SpanFactory$Type(); +final class $EmojiCompat$SpanFactory$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$SpanFactory$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat$SpanFactory;'; - @_$jni.internal - @_$core.override - EmojiCompat_SpanFactory fromReference(_$jni.JReference reference) => - EmojiCompat_SpanFactory.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat$SpanFactory? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : EmojiCompat$SpanFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($EmojiCompat$SpanFactory$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$SpanFactory$NullableType) && + other is $EmojiCompat$SpanFactory$NullableType; + } +} - @_$jni.internal - @_$core.override +final class $EmojiCompat$SpanFactory$Type + extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$SpanFactory$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat$SpanFactory;'; + + @jni$_.internal + @core$_.override + EmojiCompat$SpanFactory fromReference(jni$_.JReference reference) => + EmojiCompat$SpanFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$SpanFactory$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($EmojiCompat_SpanFactory$Type).hashCode; + @core$_.override + int get hashCode => ($EmojiCompat$SpanFactory$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($EmojiCompat_SpanFactory$Type) && - other is $EmojiCompat_SpanFactory$Type; + return other.runtimeType == ($EmojiCompat$SpanFactory$Type) && + other is $EmojiCompat$SpanFactory$Type; } } /// from: `androidx.emoji2.text.EmojiCompat` -class EmojiCompat extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class EmojiCompat extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal EmojiCompat.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/EmojiCompat'); + jni$_.JClass.forName(r'androidx/emoji2/text/EmojiCompat'); /// The type which includes information such as the signature of this class. + static const nullableType = $EmojiCompat$NullableType(); static const type = $EmojiCompat$Type(); static final _id_EDITOR_INFO_METAVERSION_KEY = _class.staticFieldId( r'EDITOR_INFO_METAVERSION_KEY', @@ -1880,8 +2541,9 @@ class EmojiCompat extends _$jni.JObject { /// from: `static public final java.lang.String EDITOR_INFO_METAVERSION_KEY` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get EDITOR_INFO_METAVERSION_KEY => - _id_EDITOR_INFO_METAVERSION_KEY.get(_class, const _$jni.JStringType()); + static jni$_.JString? get EDITOR_INFO_METAVERSION_KEY => + _id_EDITOR_INFO_METAVERSION_KEY.get( + _class, const jni$_.JStringNullableType()); static final _id_EDITOR_INFO_REPLACE_ALL_KEY = _class.staticFieldId( r'EDITOR_INFO_REPLACE_ALL_KEY', @@ -1890,8 +2552,9 @@ class EmojiCompat extends _$jni.JObject { /// from: `static public final java.lang.String EDITOR_INFO_REPLACE_ALL_KEY` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get EDITOR_INFO_REPLACE_ALL_KEY => - _id_EDITOR_INFO_REPLACE_ALL_KEY.get(_class, const _$jni.JStringType()); + static jni$_.JString? get EDITOR_INFO_REPLACE_ALL_KEY => + _id_EDITOR_INFO_REPLACE_ALL_KEY.get( + _class, const jni$_.JStringNullableType()); /// from: `static public final int LOAD_STATE_DEFAULT` static const LOAD_STATE_DEFAULT = 3; @@ -1933,25 +2596,26 @@ class EmojiCompat extends _$jni.JObject { r'(Landroid/content/Context;)Landroidx/emoji2/text/EmojiCompat;', ); - static final _init = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _init = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public androidx.emoji2.text.EmojiCompat init(android.content.Context context)` /// The returned object must be released after use, by calling the [release] method. - static EmojiCompat init( - _$jni.JObject context, + static EmojiCompat? init( + jni$_.JObject? context, ) { - return _init(_class.reference.pointer, _id_init as _$jni.JMethodIDPtr, - context.reference.pointer) - .object(const $EmojiCompat$Type()); + final _$context = context?.reference ?? jni$_.jNullReference; + return _init(_class.reference.pointer, _id_init as jni$_.JMethodIDPtr, + _$context.pointer) + .object(const $EmojiCompat$NullableType()); } static final _id_init$1 = _class.staticMethodId( @@ -1959,36 +2623,36 @@ class EmojiCompat extends _$jni.JObject { r'(Landroid/content/Context;Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory;)Landroidx/emoji2/text/EmojiCompat;', ); - static final _init$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _init$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public androidx.emoji2.text.EmojiCompat init(android.content.Context context, androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory defaultEmojiCompatConfigFactory)` /// The returned object must be released after use, by calling the [release] method. - static EmojiCompat init$1( - _$jni.JObject context, - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory + static EmojiCompat? init$1( + jni$_.JObject? context, + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory? defaultEmojiCompatConfigFactory, ) { - return _init$1( - _class.reference.pointer, - _id_init$1 as _$jni.JMethodIDPtr, - context.reference.pointer, - defaultEmojiCompatConfigFactory.reference.pointer) - .object(const $EmojiCompat$Type()); + final _$context = context?.reference ?? jni$_.jNullReference; + final _$defaultEmojiCompatConfigFactory = + defaultEmojiCompatConfigFactory?.reference ?? jni$_.jNullReference; + return _init$1(_class.reference.pointer, _id_init$1 as jni$_.JMethodIDPtr, + _$context.pointer, _$defaultEmojiCompatConfigFactory.pointer) + .object(const $EmojiCompat$NullableType()); } static final _id_init$2 = _class.staticMethodId( @@ -1996,25 +2660,26 @@ class EmojiCompat extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$Config;)Landroidx/emoji2/text/EmojiCompat;', ); - static final _init$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _init$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public androidx.emoji2.text.EmojiCompat init(androidx.emoji2.text.EmojiCompat$Config config)` /// The returned object must be released after use, by calling the [release] method. - static EmojiCompat init$2( - EmojiCompat_Config config, + static EmojiCompat? init$2( + EmojiCompat$Config? config, ) { - return _init$2(_class.reference.pointer, _id_init$2 as _$jni.JMethodIDPtr, - config.reference.pointer) - .object(const $EmojiCompat$Type()); + final _$config = config?.reference ?? jni$_.jNullReference; + return _init$2(_class.reference.pointer, _id_init$2 as jni$_.JMethodIDPtr, + _$config.pointer) + .object(const $EmojiCompat$NullableType()); } static final _id_isConfigured = _class.staticMethodId( @@ -2022,22 +2687,22 @@ class EmojiCompat extends _$jni.JObject { r'()Z', ); - static final _isConfigured = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isConfigured = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public boolean isConfigured()` static bool isConfigured() { return _isConfigured( - _class.reference.pointer, _id_isConfigured as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_isConfigured as jni$_.JMethodIDPtr) .boolean; } @@ -2046,25 +2711,26 @@ class EmojiCompat extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$Config;)Landroidx/emoji2/text/EmojiCompat;', ); - static final _reset = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _reset = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public androidx.emoji2.text.EmojiCompat reset(androidx.emoji2.text.EmojiCompat$Config config)` /// The returned object must be released after use, by calling the [release] method. - static EmojiCompat reset( - EmojiCompat_Config config, + static EmojiCompat? reset( + EmojiCompat$Config? config, ) { - return _reset(_class.reference.pointer, _id_reset as _$jni.JMethodIDPtr, - config.reference.pointer) - .object(const $EmojiCompat$Type()); + final _$config = config?.reference ?? jni$_.jNullReference; + return _reset(_class.reference.pointer, _id_reset as jni$_.JMethodIDPtr, + _$config.pointer) + .object(const $EmojiCompat$NullableType()); } static final _id_reset$1 = _class.staticMethodId( @@ -2072,25 +2738,26 @@ class EmojiCompat extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat;)Landroidx/emoji2/text/EmojiCompat;', ); - static final _reset$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _reset$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public androidx.emoji2.text.EmojiCompat reset(androidx.emoji2.text.EmojiCompat emojiCompat)` /// The returned object must be released after use, by calling the [release] method. - static EmojiCompat reset$1( - EmojiCompat emojiCompat, + static EmojiCompat? reset$1( + EmojiCompat? emojiCompat, ) { - return _reset$1(_class.reference.pointer, _id_reset$1 as _$jni.JMethodIDPtr, - emojiCompat.reference.pointer) - .object(const $EmojiCompat$Type()); + final _$emojiCompat = emojiCompat?.reference ?? jni$_.jNullReference; + return _reset$1(_class.reference.pointer, _id_reset$1 as jni$_.JMethodIDPtr, + _$emojiCompat.pointer) + .object(const $EmojiCompat$NullableType()); } static final _id_skipDefaultConfigurationLookup = _class.staticMethodId( @@ -2099,21 +2766,21 @@ class EmojiCompat extends _$jni.JObject { ); static final _skipDefaultConfigurationLookup = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `static public void skipDefaultConfigurationLookup(boolean z)` static void skipDefaultConfigurationLookup( bool z, ) { _skipDefaultConfigurationLookup(_class.reference.pointer, - _id_skipDefaultConfigurationLookup as _$jni.JMethodIDPtr, z ? 1 : 0) + _id_skipDefaultConfigurationLookup as jni$_.JMethodIDPtr, z ? 1 : 0) .check(); } @@ -2122,23 +2789,23 @@ class EmojiCompat extends _$jni.JObject { r'()Landroidx/emoji2/text/EmojiCompat;', ); - static final _get = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _get = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public androidx.emoji2.text.EmojiCompat get()` /// The returned object must be released after use, by calling the [release] method. - static EmojiCompat get() { - return _get(_class.reference.pointer, _id_get as _$jni.JMethodIDPtr) - .object(const $EmojiCompat$Type()); + static EmojiCompat? get() { + return _get(_class.reference.pointer, _id_get as jni$_.JMethodIDPtr) + .object(const $EmojiCompat$NullableType()); } static final _id_load = _class.instanceMethodId( @@ -2146,21 +2813,21 @@ class EmojiCompat extends _$jni.JObject { r'()V', ); - static final _load = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _load = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void load()` void load() { - _load(reference.pointer, _id_load as _$jni.JMethodIDPtr).check(); + _load(reference.pointer, _id_load as jni$_.JMethodIDPtr).check(); } static final _id_registerInitCallback = _class.instanceMethodId( @@ -2168,25 +2835,26 @@ class EmojiCompat extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$InitCallback;)V', ); - static final _registerInitCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _registerInitCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void registerInitCallback(androidx.emoji2.text.EmojiCompat$InitCallback initCallback)` void registerInitCallback( - EmojiCompat_InitCallback initCallback, + EmojiCompat$InitCallback? initCallback, ) { + final _$initCallback = initCallback?.reference ?? jni$_.jNullReference; _registerInitCallback( reference.pointer, - _id_registerInitCallback as _$jni.JMethodIDPtr, - initCallback.reference.pointer) + _id_registerInitCallback as jni$_.JMethodIDPtr, + _$initCallback.pointer) .check(); } @@ -2195,25 +2863,26 @@ class EmojiCompat extends _$jni.JObject { r'(Landroidx/emoji2/text/EmojiCompat$InitCallback;)V', ); - static final _unregisterInitCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _unregisterInitCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void unregisterInitCallback(androidx.emoji2.text.EmojiCompat$InitCallback initCallback)` void unregisterInitCallback( - EmojiCompat_InitCallback initCallback, + EmojiCompat$InitCallback? initCallback, ) { + final _$initCallback = initCallback?.reference ?? jni$_.jNullReference; _unregisterInitCallback( reference.pointer, - _id_unregisterInitCallback as _$jni.JMethodIDPtr, - initCallback.reference.pointer) + _id_unregisterInitCallback as jni$_.JMethodIDPtr, + _$initCallback.pointer) .check(); } @@ -2222,22 +2891,22 @@ class EmojiCompat extends _$jni.JObject { r'()I', ); - static final _getLoadState = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getLoadState = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getLoadState()` int getLoadState() { return _getLoadState( - reference.pointer, _id_getLoadState as _$jni.JMethodIDPtr) + reference.pointer, _id_getLoadState as jni$_.JMethodIDPtr) .integer; } @@ -2247,22 +2916,22 @@ class EmojiCompat extends _$jni.JObject { ); static final _isEmojiSpanIndicatorEnabled = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isEmojiSpanIndicatorEnabled()` bool isEmojiSpanIndicatorEnabled() { return _isEmojiSpanIndicatorEnabled(reference.pointer, - _id_isEmojiSpanIndicatorEnabled as _$jni.JMethodIDPtr) + _id_isEmojiSpanIndicatorEnabled as jni$_.JMethodIDPtr) .boolean; } @@ -2272,22 +2941,22 @@ class EmojiCompat extends _$jni.JObject { ); static final _getEmojiSpanIndicatorColor = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getEmojiSpanIndicatorColor()` int getEmojiSpanIndicatorColor() { return _getEmojiSpanIndicatorColor(reference.pointer, - _id_getEmojiSpanIndicatorColor as _$jni.JMethodIDPtr) + _id_getEmojiSpanIndicatorColor as jni$_.JMethodIDPtr) .integer; } @@ -2296,28 +2965,26 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;I)I', ); - static final _getEmojiStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _getEmojiStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public int getEmojiStart(java.lang.CharSequence charSequence, int i)` int getEmojiStart( - _$jni.JObject charSequence, + jni$_.JObject? charSequence, int i, ) { - return _getEmojiStart( - reference.pointer, - _id_getEmojiStart as _$jni.JMethodIDPtr, - charSequence.reference.pointer, - i) + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _getEmojiStart(reference.pointer, + _id_getEmojiStart as jni$_.JMethodIDPtr, _$charSequence.pointer, i) .integer; } @@ -2326,28 +2993,26 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;I)I', ); - static final _getEmojiEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _getEmojiEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public int getEmojiEnd(java.lang.CharSequence charSequence, int i)` int getEmojiEnd( - _$jni.JObject charSequence, + jni$_.JObject? charSequence, int i, ) { - return _getEmojiEnd( - reference.pointer, - _id_getEmojiEnd as _$jni.JMethodIDPtr, - charSequence.reference.pointer, - i) + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _getEmojiEnd(reference.pointer, + _id_getEmojiEnd as jni$_.JMethodIDPtr, _$charSequence.pointer, i) .integer; } @@ -2356,37 +3021,39 @@ class EmojiCompat extends _$jni.JObject { r'(Landroid/text/Editable;ILandroid/view/KeyEvent;)Z', ); - static final _handleOnKeyDown = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _handleOnKeyDown = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer )>)>>('globalEnv_CallStaticBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, int, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.Pointer)>(); /// from: `static public boolean handleOnKeyDown(android.text.Editable editable, int i, android.view.KeyEvent keyEvent)` static bool handleOnKeyDown( - _$jni.JObject editable, + jni$_.JObject? editable, int i, - _$jni.JObject keyEvent, + jni$_.JObject? keyEvent, ) { + final _$editable = editable?.reference ?? jni$_.jNullReference; + final _$keyEvent = keyEvent?.reference ?? jni$_.jNullReference; return _handleOnKeyDown( _class.reference.pointer, - _id_handleOnKeyDown as _$jni.JMethodIDPtr, - editable.reference.pointer, + _id_handleOnKeyDown as jni$_.JMethodIDPtr, + _$editable.pointer, i, - keyEvent.reference.pointer) + _$keyEvent.pointer) .boolean; } @@ -2396,42 +3063,45 @@ class EmojiCompat extends _$jni.JObject { ); static final _handleDeleteSurroundingText = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallStaticBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, int, int, int)>(); /// from: `static public boolean handleDeleteSurroundingText(android.view.inputmethod.InputConnection inputConnection, android.text.Editable editable, int i, int i1, boolean z)` static bool handleDeleteSurroundingText( - _$jni.JObject inputConnection, - _$jni.JObject editable, + jni$_.JObject? inputConnection, + jni$_.JObject? editable, int i, int i1, bool z, ) { + final _$inputConnection = + inputConnection?.reference ?? jni$_.jNullReference; + final _$editable = editable?.reference ?? jni$_.jNullReference; return _handleDeleteSurroundingText( _class.reference.pointer, - _id_handleDeleteSurroundingText as _$jni.JMethodIDPtr, - inputConnection.reference.pointer, - editable.reference.pointer, + _id_handleDeleteSurroundingText as jni$_.JMethodIDPtr, + _$inputConnection.pointer, + _$editable.pointer, i, i1, z ? 1 : 0) @@ -2443,25 +3113,24 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;)Z', ); - static final _hasEmojiGlyph = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _hasEmojiGlyph = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean hasEmojiGlyph(java.lang.CharSequence charSequence)` bool hasEmojiGlyph( - _$jni.JObject charSequence, + jni$_.JObject? charSequence, ) { - return _hasEmojiGlyph( - reference.pointer, - _id_hasEmojiGlyph as _$jni.JMethodIDPtr, - charSequence.reference.pointer) + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _hasEmojiGlyph(reference.pointer, + _id_hasEmojiGlyph as jni$_.JMethodIDPtr, _$charSequence.pointer) .boolean; } @@ -2470,27 +3139,28 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;I)Z', ); - static final _hasEmojiGlyph$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _hasEmojiGlyph$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public boolean hasEmojiGlyph(java.lang.CharSequence charSequence, int i)` bool hasEmojiGlyph$1( - _$jni.JObject charSequence, + jni$_.JObject? charSequence, int i, ) { + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; return _hasEmojiGlyph$1( reference.pointer, - _id_hasEmojiGlyph$1 as _$jni.JMethodIDPtr, - charSequence.reference.pointer, + _id_hasEmojiGlyph$1 as jni$_.JMethodIDPtr, + _$charSequence.pointer, i) .boolean; } @@ -2500,28 +3170,26 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;I)I', ); - static final _getEmojiMatch = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _getEmojiMatch = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public int getEmojiMatch(java.lang.CharSequence charSequence, int i)` int getEmojiMatch( - _$jni.JObject charSequence, + jni$_.JObject? charSequence, int i, ) { - return _getEmojiMatch( - reference.pointer, - _id_getEmojiMatch as _$jni.JMethodIDPtr, - charSequence.reference.pointer, - i) + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _getEmojiMatch(reference.pointer, + _id_getEmojiMatch as jni$_.JMethodIDPtr, _$charSequence.pointer, i) .integer; } @@ -2530,25 +3198,26 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;', ); - static final _process = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _process = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.lang.CharSequence process(java.lang.CharSequence charSequence)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject process( - _$jni.JObject charSequence, + jni$_.JObject? process( + jni$_.JObject? charSequence, ) { - return _process(reference.pointer, _id_process as _$jni.JMethodIDPtr, - charSequence.reference.pointer) - .object(const _$jni.JObjectType()); + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _process(reference.pointer, _id_process as jni$_.JMethodIDPtr, + _$charSequence.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_process$1 = _class.instanceMethodId( @@ -2556,31 +3225,32 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;II)Ljava/lang/CharSequence;', ); - static final _process$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _process$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int)>(); /// from: `public java.lang.CharSequence process(java.lang.CharSequence charSequence, int i, int i1)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject process$1( - _$jni.JObject charSequence, + jni$_.JObject? process$1( + jni$_.JObject? charSequence, int i, int i1, ) { - return _process$1(reference.pointer, _id_process$1 as _$jni.JMethodIDPtr, - charSequence.reference.pointer, i, i1) - .object(const _$jni.JObjectType()); + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _process$1(reference.pointer, _id_process$1 as jni$_.JMethodIDPtr, + _$charSequence.pointer, i, i1) + .object(const jni$_.JObjectNullableType()); } static final _id_process$2 = _class.instanceMethodId( @@ -2588,33 +3258,34 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;III)Ljava/lang/CharSequence;', ); - static final _process$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _process$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int, int)>(); /// from: `public java.lang.CharSequence process(java.lang.CharSequence charSequence, int i, int i1, int i2)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject process$2( - _$jni.JObject charSequence, + jni$_.JObject? process$2( + jni$_.JObject? charSequence, int i, int i1, int i2, ) { - return _process$2(reference.pointer, _id_process$2 as _$jni.JMethodIDPtr, - charSequence.reference.pointer, i, i1, i2) - .object(const _$jni.JObjectType()); + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _process$2(reference.pointer, _id_process$2 as jni$_.JMethodIDPtr, + _$charSequence.pointer, i, i1, i2) + .object(const jni$_.JObjectNullableType()); } static final _id_process$3 = _class.instanceMethodId( @@ -2622,24 +3293,24 @@ class EmojiCompat extends _$jni.JObject { r'(Ljava/lang/CharSequence;IIII)Ljava/lang/CharSequence;', ); - static final _process$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _process$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, int, int, int, @@ -2647,16 +3318,17 @@ class EmojiCompat extends _$jni.JObject { /// from: `public java.lang.CharSequence process(java.lang.CharSequence charSequence, int i, int i1, int i2, int i3)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject process$3( - _$jni.JObject charSequence, + jni$_.JObject? process$3( + jni$_.JObject? charSequence, int i, int i1, int i2, int i3, ) { - return _process$3(reference.pointer, _id_process$3 as _$jni.JMethodIDPtr, - charSequence.reference.pointer, i, i1, i2, i3) - .object(const _$jni.JObjectType()); + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + return _process$3(reference.pointer, _id_process$3 as jni$_.JMethodIDPtr, + _$charSequence.pointer, i, i1, i2, i3) + .object(const jni$_.JObjectNullableType()); } static final _id_getAssetSignature = _class.instanceMethodId( @@ -2664,24 +3336,24 @@ class EmojiCompat extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getAssetSignature = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getAssetSignature = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getAssetSignature()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getAssetSignature() { + jni$_.JString? getAssetSignature() { return _getAssetSignature( - reference.pointer, _id_getAssetSignature as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getAssetSignature as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_updateEditorInfo = _class.instanceMethodId( @@ -2689,54 +3361,96 @@ class EmojiCompat extends _$jni.JObject { r'(Landroid/view/inputmethod/EditorInfo;)V', ); - static final _updateEditorInfo = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _updateEditorInfo = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void updateEditorInfo(android.view.inputmethod.EditorInfo editorInfo)` void updateEditorInfo( - _$jni.JObject editorInfo, + jni$_.JObject? editorInfo, ) { - _updateEditorInfo( - reference.pointer, - _id_updateEditorInfo as _$jni.JMethodIDPtr, - editorInfo.reference.pointer) + final _$editorInfo = editorInfo?.reference ?? jni$_.jNullReference; + _updateEditorInfo(reference.pointer, + _id_updateEditorInfo as jni$_.JMethodIDPtr, _$editorInfo.pointer) .check(); } } -final class $EmojiCompat$Type extends _$jni.JObjType { - @_$jni.internal - const $EmojiCompat$Type(); +final class $EmojiCompat$NullableType extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/EmojiCompat;'; - @_$jni.internal - @_$core.override - EmojiCompat fromReference(_$jni.JReference reference) => - EmojiCompat.fromReference(reference); + @jni$_.internal + @core$_.override + EmojiCompat? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : EmojiCompat.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override + int get hashCode => ($EmojiCompat$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($EmojiCompat$NullableType) && + other is $EmojiCompat$NullableType; + } +} + +final class $EmojiCompat$Type extends jni$_.JObjType { + @jni$_.internal + const $EmojiCompat$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/EmojiCompat;'; + + @jni$_.internal + @core$_.override + EmojiCompat fromReference(jni$_.JReference reference) => + EmojiCompat.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $EmojiCompat$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override int get hashCode => ($EmojiCompat$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($EmojiCompat$Type) && other is $EmojiCompat$Type; @@ -2744,51 +3458,55 @@ final class $EmojiCompat$Type extends _$jni.JObjType { } /// from: `androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory` -class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType +class DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory.fromReference( - _$jni.JReference reference, + @jni$_.internal + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory'); /// The type which includes information such as the signature of this class. + static const nullableType = + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType(); static const type = - $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory$Type(); + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$Type(); static final _id_new$ = _class.constructorId( r'(Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper defaultEmojiCompatConfigHelper)` /// The returned object must be released after use, by calling the [release] method. - factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory( - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper + factory DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory( + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper? defaultEmojiCompatConfigHelper, ) { - return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory + final _$defaultEmojiCompatConfigHelper = + defaultEmojiCompatConfigHelper?.reference ?? jni$_.jNullReference; + return DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory .fromReference(_new$( _class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, - defaultEmojiCompatConfigHelper.reference.pointer) + _id_new$ as jni$_.JMethodIDPtr, + _$defaultEmojiCompatConfigHelper.pointer) .reference); } @@ -2797,108 +3515,165 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory r'(Landroid/content/Context;)Landroidx/emoji2/text/EmojiCompat$Config;', ); - static final _create = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _create = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public androidx.emoji2.text.EmojiCompat$Config create(android.content.Context context)` /// The returned object must be released after use, by calling the [release] method. - EmojiCompat_Config create( - _$jni.JObject context, + EmojiCompat$Config? create( + jni$_.JObject? context, ) { - return _create(reference.pointer, _id_create as _$jni.JMethodIDPtr, - context.reference.pointer) - .object(const $EmojiCompat_Config$Type()); + final _$context = context?.reference ?? jni$_.jNullReference; + return _create(reference.pointer, _id_create as jni$_.JMethodIDPtr, + _$context.pointer) + .object(const $EmojiCompat$Config$NullableType()); } } -final class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory$Type - extends _$jni - .JObjType { - @_$jni.internal - const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory$Type(); +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory;'; - @_$jni.internal - @_$core.override - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory fromReference( - _$jni.JReference reference) => - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory.fromReference( - reference); + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory + .fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType) + .hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType) && + other + is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType; + } +} + +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$Type + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory fromReference( + jni$_.JReference reference) => + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory$Type).hashCode; + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory$Type) && - other is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory$Type; + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$Type) && + other is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory$Type; } } /// from: `androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper` -class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType +class DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper.fromReference( - _$jni.JReference reference, + @jni$_.internal + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper'); /// The type which includes information such as the signature of this class. + static const nullableType = + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType(); static const type = - $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type(); + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper() { - return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper + factory DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper() { + return DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper .fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -2907,35 +3682,39 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper r'(Landroid/content/pm/PackageManager;Ljava/lang/String;)[Landroid/content/pm/Signature;', ); - static final _getSigningSignatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _getSigningSignatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public android.content.pm.Signature[] getSigningSignatures(android.content.pm.PackageManager packageManager, java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<_$jni.JObject> getSigningSignatures( - _$jni.JObject packageManager, - _$jni.JString string, + jni$_.JArray? getSigningSignatures( + jni$_.JObject? packageManager, + jni$_.JString? string, ) { + final _$packageManager = packageManager?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; return _getSigningSignatures( reference.pointer, - _id_getSigningSignatures as _$jni.JMethodIDPtr, - packageManager.reference.pointer, - string.reference.pointer) - .object(const _$jni.JArrayType(_$jni.JObjectType())); + _id_getSigningSignatures as jni$_.JMethodIDPtr, + _$packageManager.pointer, + _$string.pointer) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JObjectNullableType())); } static final _id_queryIntentContentProviders = _class.instanceMethodId( @@ -2944,39 +3723,43 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper ); static final _queryIntentContentProviders = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32 + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, int)>(); /// from: `public java.util.List queryIntentContentProviders(android.content.pm.PackageManager packageManager, android.content.Intent intent, int i)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JList<_$jni.JObject> queryIntentContentProviders( - _$jni.JObject packageManager, - _$jni.JObject intent, + jni$_.JList? queryIntentContentProviders( + jni$_.JObject? packageManager, + jni$_.JObject? intent, int i, ) { + final _$packageManager = packageManager?.reference ?? jni$_.jNullReference; + final _$intent = intent?.reference ?? jni$_.jNullReference; return _queryIntentContentProviders( reference.pointer, - _id_queryIntentContentProviders as _$jni.JMethodIDPtr, - packageManager.reference.pointer, - intent.reference.pointer, + _id_queryIntentContentProviders as jni$_.JMethodIDPtr, + _$packageManager.pointer, + _$intent.pointer, i) - .object(const _$jni.JListType(_$jni.JObjectType())); + .object?>( + const jni$_.JListNullableType( + jni$_.JObjectNullableType())); } static final _id_getProviderInfo = _class.instanceMethodId( @@ -2984,111 +3767,166 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper r'(Landroid/content/pm/ResolveInfo;)Landroid/content/pm/ProviderInfo;', ); - static final _getProviderInfo = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getProviderInfo = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public android.content.pm.ProviderInfo getProviderInfo(android.content.pm.ResolveInfo resolveInfo)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getProviderInfo( - _$jni.JObject resolveInfo, + jni$_.JObject? getProviderInfo( + jni$_.JObject? resolveInfo, ) { - return _getProviderInfo( - reference.pointer, - _id_getProviderInfo as _$jni.JMethodIDPtr, - resolveInfo.reference.pointer) - .object(const _$jni.JObjectType()); + final _$resolveInfo = resolveInfo?.reference ?? jni$_.jNullReference; + return _getProviderInfo(reference.pointer, + _id_getProviderInfo as jni$_.JMethodIDPtr, _$resolveInfo.pointer) + .object(const jni$_.JObjectNullableType()); } } -final class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type - extends _$jni - .JObjType { - @_$jni.internal - const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type(); +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper;'; - @_$jni.internal - @_$core.override - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper fromReference( - _$jni.JReference reference) => - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper.fromReference( - reference); + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper + .fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType) + .hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType) && + other + is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType; + } +} + +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$Type + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$Type(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper;'; + + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper fromReference( + jni$_.JReference reference) => + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type).hashCode; + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type) && - other is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type; + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$Type) && + other is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$Type; } } /// from: `androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19` -class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 - extends DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper { - @_$jni.internal - @_$core.override - final _$jni - .JObjType +class DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 + extends DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper { + @jni$_.internal + @core$_.override + final jni$_ + .JObjType $type; - @_$jni.internal - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19.fromReference( - _$jni.JReference reference, + @jni$_.internal + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19'); /// The type which includes information such as the signature of this class. + static const nullableType = + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType(); static const type = - $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type(); + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19() { - return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 + factory DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19() { + return DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 .fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -3098,39 +3936,43 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 ); static final _queryIntentContentProviders = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32 + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, int)>(); /// from: `public java.util.List queryIntentContentProviders(android.content.pm.PackageManager packageManager, android.content.Intent intent, int i)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JList<_$jni.JObject> queryIntentContentProviders( - _$jni.JObject packageManager, - _$jni.JObject intent, + jni$_.JList? queryIntentContentProviders( + jni$_.JObject? packageManager, + jni$_.JObject? intent, int i, ) { + final _$packageManager = packageManager?.reference ?? jni$_.jNullReference; + final _$intent = intent?.reference ?? jni$_.jNullReference; return _queryIntentContentProviders( reference.pointer, - _id_queryIntentContentProviders as _$jni.JMethodIDPtr, - packageManager.reference.pointer, - intent.reference.pointer, + _id_queryIntentContentProviders as jni$_.JMethodIDPtr, + _$packageManager.pointer, + _$intent.pointer, i) - .object(const _$jni.JListType(_$jni.JObjectType())); + .object?>( + const jni$_.JListNullableType( + jni$_.JObjectNullableType())); } static final _id_getProviderInfo = _class.instanceMethodId( @@ -3138,114 +3980,171 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 r'(Landroid/content/pm/ResolveInfo;)Landroid/content/pm/ProviderInfo;', ); - static final _getProviderInfo = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getProviderInfo = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public android.content.pm.ProviderInfo getProviderInfo(android.content.pm.ResolveInfo resolveInfo)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getProviderInfo( - _$jni.JObject resolveInfo, + jni$_.JObject? getProviderInfo( + jni$_.JObject? resolveInfo, ) { - return _getProviderInfo( - reference.pointer, - _id_getProviderInfo as _$jni.JMethodIDPtr, - resolveInfo.reference.pointer) - .object(const _$jni.JObjectType()); + final _$resolveInfo = resolveInfo?.reference ?? jni$_.jNullReference; + return _getProviderInfo(reference.pointer, + _id_getProviderInfo as jni$_.JMethodIDPtr, _$resolveInfo.pointer) + .object(const jni$_.JObjectNullableType()); } } -final class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type - extends _$jni - .JObjType { - @_$jni.internal - const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type(); +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19;'; - @_$jni.internal - @_$core.override - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 fromReference( - _$jni.JReference reference) => - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 - .fromReference(reference); + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 + .fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType) + .hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType) && + other + is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType; + } +} + +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$Type + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => - const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper$Type(); + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 fromReference( + jni$_.JReference reference) => + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 + .fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper$NullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type) + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$Type) .hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type) && + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$Type) && other - is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type; + is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$Type; } } /// from: `androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28` -class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 - extends DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 { - @_$jni.internal - @_$core.override - final _$jni - .JObjType +class DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 + extends DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 { + @jni$_.internal + @core$_.override + final jni$_ + .JObjType $type; - @_$jni.internal - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28.fromReference( - _$jni.JReference reference, + @jni$_.internal + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'androidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28'); /// The type which includes information such as the signature of this class. + static const nullableType = + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType(); static const type = - $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28$Type(); + $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28() { - return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 + factory DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28() { + return DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 .fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -3254,149 +4153,256 @@ class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 r'(Landroid/content/pm/PackageManager;Ljava/lang/String;)[Landroid/content/pm/Signature;', ); - static final _getSigningSignatures$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _getSigningSignatures$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public android.content.pm.Signature[] getSigningSignatures(android.content.pm.PackageManager packageManager, java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<_$jni.JObject> getSigningSignatures$1( - _$jni.JObject packageManager, - _$jni.JString string, + jni$_.JArray? getSigningSignatures$1( + jni$_.JObject? packageManager, + jni$_.JString? string, ) { + final _$packageManager = packageManager?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; return _getSigningSignatures$1( reference.pointer, - _id_getSigningSignatures$1 as _$jni.JMethodIDPtr, - packageManager.reference.pointer, - string.reference.pointer) - .object(const _$jni.JArrayType(_$jni.JObjectType())); + _id_getSigningSignatures$1 as jni$_.JMethodIDPtr, + _$packageManager.pointer, + _$string.pointer) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JObjectNullableType())); } } -final class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28$Type - extends _$jni - .JObjType { - @_$jni.internal - const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28$Type(); +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28;'; - @_$jni.internal - @_$core.override - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 fromReference( - _$jni.JReference reference) => - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 - .fromReference(reference); + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 + .fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 3; + + @core$_.override + int get hashCode => + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType) + .hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType) && + other + is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType; + } +} + +final class $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$Type + extends jni$_ + .JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => - const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19$Type(); + @jni$_.internal + @core$_.override + String get signature => + r'Landroidx/emoji2/text/DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 fromReference( + jni$_.JReference reference) => + DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 + .fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19$NullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType + get nullableType => + const $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 3; - @_$core.override + @core$_.override int get hashCode => - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28$Type) + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$Type) .hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28$Type) && + ($DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$Type) && other - is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28$Type; + is $DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28$Type; } } /// from: `androidx.emoji2.text.DefaultEmojiCompatConfig` -class DefaultEmojiCompatConfig extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class DefaultEmojiCompatConfig extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal DefaultEmojiCompatConfig.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'androidx/emoji2/text/DefaultEmojiCompatConfig'); + jni$_.JClass.forName(r'androidx/emoji2/text/DefaultEmojiCompatConfig'); /// The type which includes information such as the signature of this class. + static const nullableType = $DefaultEmojiCompatConfig$NullableType(); static const type = $DefaultEmojiCompatConfig$Type(); static final _id_create = _class.staticMethodId( r'create', r'(Landroid/content/Context;)Landroidx/emoji2/text/FontRequestEmojiCompatConfig;', ); - static final _create = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _create = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public androidx.emoji2.text.FontRequestEmojiCompatConfig create(android.content.Context context)` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JObject create( - _$jni.JObject context, + static jni$_.JObject? create( + jni$_.JObject? context, ) { - return _create(_class.reference.pointer, _id_create as _$jni.JMethodIDPtr, - context.reference.pointer) - .object(const _$jni.JObjectType()); + final _$context = context?.reference ?? jni$_.jNullReference; + return _create(_class.reference.pointer, _id_create as jni$_.JMethodIDPtr, + _$context.pointer) + .object(const jni$_.JObjectNullableType()); } } -final class $DefaultEmojiCompatConfig$Type - extends _$jni.JObjType { - @_$jni.internal - const $DefaultEmojiCompatConfig$Type(); +final class $DefaultEmojiCompatConfig$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroidx/emoji2/text/DefaultEmojiCompatConfig;'; - @_$jni.internal - @_$core.override - DefaultEmojiCompatConfig fromReference(_$jni.JReference reference) => - DefaultEmojiCompatConfig.fromReference(reference); + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : DefaultEmojiCompatConfig.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($DefaultEmojiCompatConfig$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($DefaultEmojiCompatConfig$NullableType) && + other is $DefaultEmojiCompatConfig$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $DefaultEmojiCompatConfig$Type + extends jni$_.JObjType { + @jni$_.internal + const $DefaultEmojiCompatConfig$Type(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => r'Landroidx/emoji2/text/DefaultEmojiCompatConfig;'; + + @jni$_.internal + @core$_.override + DefaultEmojiCompatConfig fromReference(jni$_.JReference reference) => + DefaultEmojiCompatConfig.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $DefaultEmojiCompatConfig$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($DefaultEmojiCompatConfig$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($DefaultEmojiCompatConfig$Type) && other is $DefaultEmojiCompatConfig$Type; @@ -3404,21 +4410,22 @@ final class $DefaultEmojiCompatConfig$Type } /// from: `android.os.Build$Partition` -class Build_Partition extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Build_Partition.fromReference( - _$jni.JReference reference, +class Build$Partition extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Build$Partition.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'android/os/Build$Partition'); + static final _class = jni$_.JClass.forName(r'android/os/Build$Partition'); /// The type which includes information such as the signature of this class. - static const type = $Build_Partition$Type(); + static const nullableType = $Build$Partition$NullableType(); + static const type = $Build$Partition$Type(); static final _id_PARTITION_NAME_SYSTEM = _class.staticFieldId( r'PARTITION_NAME_SYSTEM', r'Ljava/lang/String;', @@ -3426,31 +4433,31 @@ class Build_Partition extends _$jni.JObject { /// from: `static public final java.lang.String PARTITION_NAME_SYSTEM` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get PARTITION_NAME_SYSTEM => - _id_PARTITION_NAME_SYSTEM.get(_class, const _$jni.JStringType()); + static jni$_.JString? get PARTITION_NAME_SYSTEM => + _id_PARTITION_NAME_SYSTEM.get(_class, const jni$_.JStringNullableType()); static final _id_getName = _class.instanceMethodId( r'getName', r'()Ljava/lang/String;', ); - static final _getName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getName()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getName() { - return _getName(reference.pointer, _id_getName as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getName() { + return _getName(reference.pointer, _id_getName as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getFingerprint = _class.instanceMethodId( @@ -3458,24 +4465,24 @@ class Build_Partition extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getFingerprint = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFingerprint = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getFingerprint()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getFingerprint() { + jni$_.JString? getFingerprint() { return _getFingerprint( - reference.pointer, _id_getFingerprint as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getFingerprint as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getBuildTimeMillis = _class.instanceMethodId( @@ -3483,22 +4490,22 @@ class Build_Partition extends _$jni.JObject { r'()J', ); - static final _getBuildTimeMillis = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getBuildTimeMillis = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public long getBuildTimeMillis()` int getBuildTimeMillis() { return _getBuildTimeMillis( - reference.pointer, _id_getBuildTimeMillis as _$jni.JMethodIDPtr) + reference.pointer, _id_getBuildTimeMillis as jni$_.JMethodIDPtr) .long; } @@ -3507,23 +4514,24 @@ class Build_Partition extends _$jni.JObject { r'(Ljava/lang/Object;)Z', ); - static final _equals = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _equals = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean equals(java.lang.Object object)` bool equals( - _$jni.JObject object, + jni$_.JObject? object, ) { - return _equals(reference.pointer, _id_equals as _$jni.JMethodIDPtr, - object.reference.pointer) + final _$object = object?.reference ?? jni$_.jNullReference; + return _equals(reference.pointer, _id_equals as jni$_.JMethodIDPtr, + _$object.pointer) .boolean; } @@ -3532,72 +4540,117 @@ class Build_Partition extends _$jni.JObject { r'()I', ); - static final _hashCode$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _hashCode$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int hashCode()` int hashCode$1() { - return _hashCode$1(reference.pointer, _id_hashCode$1 as _$jni.JMethodIDPtr) + return _hashCode$1(reference.pointer, _id_hashCode$1 as jni$_.JMethodIDPtr) .integer; } } -final class $Build_Partition$Type extends _$jni.JObjType { - @_$jni.internal - const $Build_Partition$Type(); +final class $Build$Partition$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $Build$Partition$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroid/os/Build$Partition;'; - @_$jni.internal - @_$core.override - Build_Partition fromReference(_$jni.JReference reference) => - Build_Partition.fromReference(reference); + @jni$_.internal + @core$_.override + Build$Partition? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Build$Partition.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Build$Partition$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Build$Partition$NullableType) && + other is $Build$Partition$NullableType; + } +} + +final class $Build$Partition$Type extends jni$_.JObjType { + @jni$_.internal + const $Build$Partition$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Landroid/os/Build$Partition;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Build$Partition fromReference(jni$_.JReference reference) => + Build$Partition.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Build$Partition$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Build_Partition$Type).hashCode; + @core$_.override + int get hashCode => ($Build$Partition$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Build_Partition$Type) && - other is $Build_Partition$Type; + return other.runtimeType == ($Build$Partition$Type) && + other is $Build$Partition$Type; } } /// from: `android.os.Build$VERSION` -class Build_VERSION extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Build_VERSION.fromReference( - _$jni.JReference reference, +class Build$VERSION extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Build$VERSION.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'android/os/Build$VERSION'); + static final _class = jni$_.JClass.forName(r'android/os/Build$VERSION'); /// The type which includes information such as the signature of this class. - static const type = $Build_VERSION$Type(); + static const nullableType = $Build$VERSION$NullableType(); + static const type = $Build$VERSION$Type(); static final _id_BASE_OS = _class.staticFieldId( r'BASE_OS', r'Ljava/lang/String;', @@ -3605,8 +4658,8 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String BASE_OS` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get BASE_OS => - _id_BASE_OS.get(_class, const _$jni.JStringType()); + static jni$_.JString? get BASE_OS => + _id_BASE_OS.get(_class, const jni$_.JStringNullableType()); static final _id_CODENAME = _class.staticFieldId( r'CODENAME', @@ -3615,8 +4668,8 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String CODENAME` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get CODENAME => - _id_CODENAME.get(_class, const _$jni.JStringType()); + static jni$_.JString? get CODENAME => + _id_CODENAME.get(_class, const jni$_.JStringNullableType()); static final _id_INCREMENTAL = _class.staticFieldId( r'INCREMENTAL', @@ -3625,8 +4678,8 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String INCREMENTAL` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get INCREMENTAL => - _id_INCREMENTAL.get(_class, const _$jni.JStringType()); + static jni$_.JString? get INCREMENTAL => + _id_INCREMENTAL.get(_class, const jni$_.JStringNullableType()); static final _id_MEDIA_PERFORMANCE_CLASS = _class.staticFieldId( r'MEDIA_PERFORMANCE_CLASS', @@ -3635,7 +4688,7 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final int MEDIA_PERFORMANCE_CLASS` static int get MEDIA_PERFORMANCE_CLASS => - _id_MEDIA_PERFORMANCE_CLASS.get(_class, const _$jni.jintType()); + _id_MEDIA_PERFORMANCE_CLASS.get(_class, const jni$_.jintType()); static final _id_PREVIEW_SDK_INT = _class.staticFieldId( r'PREVIEW_SDK_INT', @@ -3644,7 +4697,7 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final int PREVIEW_SDK_INT` static int get PREVIEW_SDK_INT => - _id_PREVIEW_SDK_INT.get(_class, const _$jni.jintType()); + _id_PREVIEW_SDK_INT.get(_class, const jni$_.jintType()); static final _id_RELEASE = _class.staticFieldId( r'RELEASE', @@ -3653,8 +4706,8 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String RELEASE` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get RELEASE => - _id_RELEASE.get(_class, const _$jni.JStringType()); + static jni$_.JString? get RELEASE => + _id_RELEASE.get(_class, const jni$_.JStringNullableType()); static final _id_RELEASE_OR_CODENAME = _class.staticFieldId( r'RELEASE_OR_CODENAME', @@ -3663,8 +4716,8 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String RELEASE_OR_CODENAME` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get RELEASE_OR_CODENAME => - _id_RELEASE_OR_CODENAME.get(_class, const _$jni.JStringType()); + static jni$_.JString? get RELEASE_OR_CODENAME => + _id_RELEASE_OR_CODENAME.get(_class, const jni$_.JStringNullableType()); static final _id_RELEASE_OR_PREVIEW_DISPLAY = _class.staticFieldId( r'RELEASE_OR_PREVIEW_DISPLAY', @@ -3673,8 +4726,9 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String RELEASE_OR_PREVIEW_DISPLAY` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get RELEASE_OR_PREVIEW_DISPLAY => - _id_RELEASE_OR_PREVIEW_DISPLAY.get(_class, const _$jni.JStringType()); + static jni$_.JString? get RELEASE_OR_PREVIEW_DISPLAY => + _id_RELEASE_OR_PREVIEW_DISPLAY.get( + _class, const jni$_.JStringNullableType()); static final _id_SDK = _class.staticFieldId( r'SDK', @@ -3683,8 +4737,8 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String SDK` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SDK => - _id_SDK.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SDK => + _id_SDK.get(_class, const jni$_.JStringNullableType()); static final _id_SDK_INT = _class.staticFieldId( r'SDK_INT', @@ -3692,7 +4746,7 @@ class Build_VERSION extends _$jni.JObject { ); /// from: `static public final int SDK_INT` - static int get SDK_INT => _id_SDK_INT.get(_class, const _$jni.jintType()); + static int get SDK_INT => _id_SDK_INT.get(_class, const jni$_.jintType()); static final _id_SECURITY_PATCH = _class.staticFieldId( r'SECURITY_PATCH', @@ -3701,81 +4755,125 @@ class Build_VERSION extends _$jni.JObject { /// from: `static public final java.lang.String SECURITY_PATCH` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SECURITY_PATCH => - _id_SECURITY_PATCH.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SECURITY_PATCH => + _id_SECURITY_PATCH.get(_class, const jni$_.JStringNullableType()); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory Build_VERSION() { - return Build_VERSION.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + factory Build$VERSION() { + return Build$VERSION.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $Build_VERSION$Type extends _$jni.JObjType { - @_$jni.internal - const $Build_VERSION$Type(); +final class $Build$VERSION$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Build$VERSION$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroid/os/Build$VERSION;'; - @_$jni.internal - @_$core.override - Build_VERSION fromReference(_$jni.JReference reference) => - Build_VERSION.fromReference(reference); + @jni$_.internal + @core$_.override + Build$VERSION? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Build$VERSION.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Build$VERSION$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Build$VERSION$NullableType) && + other is $Build$VERSION$NullableType; + } +} + +final class $Build$VERSION$Type extends jni$_.JObjType { + @jni$_.internal + const $Build$VERSION$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Landroid/os/Build$VERSION;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Build$VERSION fromReference(jni$_.JReference reference) => + Build$VERSION.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Build$VERSION$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Build_VERSION$Type).hashCode; + @core$_.override + int get hashCode => ($Build$VERSION$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Build_VERSION$Type) && - other is $Build_VERSION$Type; + return other.runtimeType == ($Build$VERSION$Type) && + other is $Build$VERSION$Type; } } /// from: `android.os.Build$VERSION_CODES` -class Build_VERSION_CODES extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Build_VERSION_CODES.fromReference( - _$jni.JReference reference, +class Build$VERSION_CODES extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Build$VERSION_CODES.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'android/os/Build$VERSION_CODES'); + static final _class = jni$_.JClass.forName(r'android/os/Build$VERSION_CODES'); /// The type which includes information such as the signature of this class. - static const type = $Build_VERSION_CODES$Type(); + static const nullableType = $Build$VERSION_CODES$NullableType(); + static const type = $Build$VERSION_CODES$Type(); /// from: `static public final int BASE` static const BASE = 1; @@ -3888,74 +4986,120 @@ class Build_VERSION_CODES extends _$jni.JObject { r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory Build_VERSION_CODES() { - return Build_VERSION_CODES.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + factory Build$VERSION_CODES() { + return Build$VERSION_CODES.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $Build_VERSION_CODES$Type - extends _$jni.JObjType { - @_$jni.internal - const $Build_VERSION_CODES$Type(); +final class $Build$VERSION_CODES$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $Build$VERSION_CODES$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroid/os/Build$VERSION_CODES;'; - @_$jni.internal - @_$core.override - Build_VERSION_CODES fromReference(_$jni.JReference reference) => - Build_VERSION_CODES.fromReference(reference); + @jni$_.internal + @core$_.override + Build$VERSION_CODES? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Build$VERSION_CODES.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Build$VERSION_CODES$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Build$VERSION_CODES$NullableType) && + other is $Build$VERSION_CODES$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $Build$VERSION_CODES$Type + extends jni$_.JObjType { + @jni$_.internal + const $Build$VERSION_CODES$Type(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => r'Landroid/os/Build$VERSION_CODES;'; + + @jni$_.internal + @core$_.override + Build$VERSION_CODES fromReference(jni$_.JReference reference) => + Build$VERSION_CODES.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Build$VERSION_CODES$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Build_VERSION_CODES$Type).hashCode; + @core$_.override + int get hashCode => ($Build$VERSION_CODES$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Build_VERSION_CODES$Type) && - other is $Build_VERSION_CODES$Type; + return other.runtimeType == ($Build$VERSION_CODES$Type) && + other is $Build$VERSION_CODES$Type; } } /// from: `android.os.Build` -class Build extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Build extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Build.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'android/os/Build'); + static final _class = jni$_.JClass.forName(r'android/os/Build'); /// The type which includes information such as the signature of this class. + static const nullableType = $Build$NullableType(); static const type = $Build$Type(); static final _id_BOARD = _class.staticFieldId( r'BOARD', @@ -3964,8 +5108,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String BOARD` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get BOARD => - _id_BOARD.get(_class, const _$jni.JStringType()); + static jni$_.JString? get BOARD => + _id_BOARD.get(_class, const jni$_.JStringNullableType()); static final _id_BOOTLOADER = _class.staticFieldId( r'BOOTLOADER', @@ -3974,8 +5118,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String BOOTLOADER` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get BOOTLOADER => - _id_BOOTLOADER.get(_class, const _$jni.JStringType()); + static jni$_.JString? get BOOTLOADER => + _id_BOOTLOADER.get(_class, const jni$_.JStringNullableType()); static final _id_BRAND = _class.staticFieldId( r'BRAND', @@ -3984,8 +5128,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String BRAND` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get BRAND => - _id_BRAND.get(_class, const _$jni.JStringType()); + static jni$_.JString? get BRAND => + _id_BRAND.get(_class, const jni$_.JStringNullableType()); static final _id_CPU_ABI = _class.staticFieldId( r'CPU_ABI', @@ -3994,8 +5138,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String CPU_ABI` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get CPU_ABI => - _id_CPU_ABI.get(_class, const _$jni.JStringType()); + static jni$_.JString? get CPU_ABI => + _id_CPU_ABI.get(_class, const jni$_.JStringNullableType()); static final _id_CPU_ABI2 = _class.staticFieldId( r'CPU_ABI2', @@ -4004,8 +5148,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String CPU_ABI2` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get CPU_ABI2 => - _id_CPU_ABI2.get(_class, const _$jni.JStringType()); + static jni$_.JString? get CPU_ABI2 => + _id_CPU_ABI2.get(_class, const jni$_.JStringNullableType()); static final _id_DEVICE = _class.staticFieldId( r'DEVICE', @@ -4014,8 +5158,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String DEVICE` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get DEVICE => - _id_DEVICE.get(_class, const _$jni.JStringType()); + static jni$_.JString? get DEVICE => + _id_DEVICE.get(_class, const jni$_.JStringNullableType()); static final _id_DISPLAY = _class.staticFieldId( r'DISPLAY', @@ -4024,8 +5168,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String DISPLAY` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get DISPLAY => - _id_DISPLAY.get(_class, const _$jni.JStringType()); + static jni$_.JString? get DISPLAY => + _id_DISPLAY.get(_class, const jni$_.JStringNullableType()); static final _id_FINGERPRINT = _class.staticFieldId( r'FINGERPRINT', @@ -4034,8 +5178,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String FINGERPRINT` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get FINGERPRINT => - _id_FINGERPRINT.get(_class, const _$jni.JStringType()); + static jni$_.JString? get FINGERPRINT => + _id_FINGERPRINT.get(_class, const jni$_.JStringNullableType()); static final _id_HARDWARE = _class.staticFieldId( r'HARDWARE', @@ -4044,8 +5188,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String HARDWARE` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get HARDWARE => - _id_HARDWARE.get(_class, const _$jni.JStringType()); + static jni$_.JString? get HARDWARE => + _id_HARDWARE.get(_class, const jni$_.JStringNullableType()); static final _id_HOST = _class.staticFieldId( r'HOST', @@ -4054,8 +5198,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String HOST` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get HOST => - _id_HOST.get(_class, const _$jni.JStringType()); + static jni$_.JString? get HOST => + _id_HOST.get(_class, const jni$_.JStringNullableType()); static final _id_ID = _class.staticFieldId( r'ID', @@ -4064,7 +5208,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String ID` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get ID => _id_ID.get(_class, const _$jni.JStringType()); + static jni$_.JString? get ID => + _id_ID.get(_class, const jni$_.JStringNullableType()); static final _id_MANUFACTURER = _class.staticFieldId( r'MANUFACTURER', @@ -4073,8 +5218,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String MANUFACTURER` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get MANUFACTURER => - _id_MANUFACTURER.get(_class, const _$jni.JStringType()); + static jni$_.JString? get MANUFACTURER => + _id_MANUFACTURER.get(_class, const jni$_.JStringNullableType()); static final _id_MODEL = _class.staticFieldId( r'MODEL', @@ -4083,8 +5228,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String MODEL` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get MODEL => - _id_MODEL.get(_class, const _$jni.JStringType()); + static jni$_.JString? get MODEL => + _id_MODEL.get(_class, const jni$_.JStringNullableType()); static final _id_ODM_SKU = _class.staticFieldId( r'ODM_SKU', @@ -4093,8 +5238,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String ODM_SKU` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get ODM_SKU => - _id_ODM_SKU.get(_class, const _$jni.JStringType()); + static jni$_.JString? get ODM_SKU => + _id_ODM_SKU.get(_class, const jni$_.JStringNullableType()); static final _id_PRODUCT = _class.staticFieldId( r'PRODUCT', @@ -4103,8 +5248,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String PRODUCT` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get PRODUCT => - _id_PRODUCT.get(_class, const _$jni.JStringType()); + static jni$_.JString? get PRODUCT => + _id_PRODUCT.get(_class, const jni$_.JStringNullableType()); static final _id_RADIO = _class.staticFieldId( r'RADIO', @@ -4113,8 +5258,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String RADIO` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get RADIO => - _id_RADIO.get(_class, const _$jni.JStringType()); + static jni$_.JString? get RADIO => + _id_RADIO.get(_class, const jni$_.JStringNullableType()); static final _id_SERIAL = _class.staticFieldId( r'SERIAL', @@ -4123,8 +5268,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String SERIAL` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SERIAL => - _id_SERIAL.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SERIAL => + _id_SERIAL.get(_class, const jni$_.JStringNullableType()); static final _id_SKU = _class.staticFieldId( r'SKU', @@ -4133,8 +5278,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String SKU` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SKU => - _id_SKU.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SKU => + _id_SKU.get(_class, const jni$_.JStringNullableType()); static final _id_SOC_MANUFACTURER = _class.staticFieldId( r'SOC_MANUFACTURER', @@ -4143,8 +5288,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String SOC_MANUFACTURER` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SOC_MANUFACTURER => - _id_SOC_MANUFACTURER.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SOC_MANUFACTURER => + _id_SOC_MANUFACTURER.get(_class, const jni$_.JStringNullableType()); static final _id_SOC_MODEL = _class.staticFieldId( r'SOC_MODEL', @@ -4153,8 +5298,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String SOC_MODEL` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SOC_MODEL => - _id_SOC_MODEL.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SOC_MODEL => + _id_SOC_MODEL.get(_class, const jni$_.JStringNullableType()); static final _id_SUPPORTED_32_BIT_ABIS = _class.staticFieldId( r'SUPPORTED_32_BIT_ABIS', @@ -4163,9 +5308,11 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String[] SUPPORTED_32_BIT_ABIS` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray<_$jni.JString> get SUPPORTED_32_BIT_ABIS => + static jni$_.JArray? get SUPPORTED_32_BIT_ABIS => _id_SUPPORTED_32_BIT_ABIS.get( - _class, const _$jni.JArrayType(_$jni.JStringType())); + _class, + const jni$_.JArrayNullableType( + jni$_.JStringNullableType())); static final _id_SUPPORTED_64_BIT_ABIS = _class.staticFieldId( r'SUPPORTED_64_BIT_ABIS', @@ -4174,9 +5321,11 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String[] SUPPORTED_64_BIT_ABIS` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray<_$jni.JString> get SUPPORTED_64_BIT_ABIS => + static jni$_.JArray? get SUPPORTED_64_BIT_ABIS => _id_SUPPORTED_64_BIT_ABIS.get( - _class, const _$jni.JArrayType(_$jni.JStringType())); + _class, + const jni$_.JArrayNullableType( + jni$_.JStringNullableType())); static final _id_SUPPORTED_ABIS = _class.staticFieldId( r'SUPPORTED_ABIS', @@ -4185,8 +5334,11 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String[] SUPPORTED_ABIS` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray<_$jni.JString> get SUPPORTED_ABIS => _id_SUPPORTED_ABIS - .get(_class, const _$jni.JArrayType(_$jni.JStringType())); + static jni$_.JArray? get SUPPORTED_ABIS => _id_SUPPORTED_ABIS + .get( + _class, + const jni$_.JArrayNullableType( + jni$_.JStringNullableType())); static final _id_TAGS = _class.staticFieldId( r'TAGS', @@ -4195,8 +5347,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String TAGS` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get TAGS => - _id_TAGS.get(_class, const _$jni.JStringType()); + static jni$_.JString? get TAGS => + _id_TAGS.get(_class, const jni$_.JStringNullableType()); static final _id_TIME = _class.staticFieldId( r'TIME', @@ -4204,7 +5356,7 @@ class Build extends _$jni.JObject { ); /// from: `static public final long TIME` - static int get TIME => _id_TIME.get(_class, const _$jni.jlongType()); + static int get TIME => _id_TIME.get(_class, const jni$_.jlongType()); static final _id_TYPE = _class.staticFieldId( r'TYPE', @@ -4213,8 +5365,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String TYPE` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get TYPE => - _id_TYPE.get(_class, const _$jni.JStringType()); + static jni$_.JString? get TYPE => + _id_TYPE.get(_class, const jni$_.JStringNullableType()); static final _id_UNKNOWN = _class.staticFieldId( r'UNKNOWN', @@ -4223,8 +5375,8 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String UNKNOWN` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get UNKNOWN => - _id_UNKNOWN.get(_class, const _$jni.JStringType()); + static jni$_.JString? get UNKNOWN => + _id_UNKNOWN.get(_class, const jni$_.JStringNullableType()); static final _id_USER = _class.staticFieldId( r'USER', @@ -4233,30 +5385,30 @@ class Build extends _$jni.JObject { /// from: `static public final java.lang.String USER` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get USER => - _id_USER.get(_class, const _$jni.JStringType()); + static jni$_.JString? get USER => + _id_USER.get(_class, const jni$_.JStringNullableType()); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Build() { return Build.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -4265,24 +5417,24 @@ class Build extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getSerial = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSerial = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public java.lang.String getSerial()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString getSerial() { + static jni$_.JString? getSerial() { return _getSerial( - _class.reference.pointer, _id_getSerial as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + _class.reference.pointer, _id_getSerial as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getFingerprintedPartitions = _class.staticMethodId( @@ -4291,24 +5443,26 @@ class Build extends _$jni.JObject { ); static final _getFingerprintedPartitions = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public java.util.List getFingerprintedPartitions()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JList getFingerprintedPartitions() { + static jni$_.JList? getFingerprintedPartitions() { return _getFingerprintedPartitions(_class.reference.pointer, - _id_getFingerprintedPartitions as _$jni.JMethodIDPtr) - .object(const _$jni.JListType($Build_Partition$Type())); + _id_getFingerprintedPartitions as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JListNullableType( + $Build$Partition$NullableType())); } static final _id_getRadioVersion = _class.staticMethodId( @@ -4316,87 +5470,139 @@ class Build extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getRadioVersion = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getRadioVersion = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public java.lang.String getRadioVersion()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString getRadioVersion() { + static jni$_.JString? getRadioVersion() { return _getRadioVersion( - _class.reference.pointer, _id_getRadioVersion as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + _class.reference.pointer, _id_getRadioVersion as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } } -final class $Build$Type extends _$jni.JObjType { - @_$jni.internal - const $Build$Type(); +final class $Build$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Build$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Landroid/os/Build;'; - @_$jni.internal - @_$core.override - Build fromReference(_$jni.JReference reference) => - Build.fromReference(reference); + @jni$_.internal + @core$_.override + Build? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Build.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override + int get hashCode => ($Build$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Build$NullableType) && + other is $Build$NullableType; + } +} + +final class $Build$Type extends jni$_.JObjType { + @jni$_.internal + const $Build$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroid/os/Build;'; + + @jni$_.internal + @core$_.override + Build fromReference(jni$_.JReference reference) => Build.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Build$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override int get hashCode => ($Build$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Build$Type) && other is $Build$Type; } } /// from: `java.util.HashMap` -class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class HashMap<$K extends jni$_.JObject?, $V extends jni$_.JObject?> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$K> K; + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal + @jni$_.internal HashMap.fromReference( this.K, this.V, - _$jni.JReference reference, - ) : $type = type(K, V), + jni$_.JReference reference, + ) : $type = type<$K, $V>(K, V), super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'java/util/HashMap'); + static final _class = jni$_.JClass.forName(r'java/util/HashMap'); /// The type which includes information such as the signature of this class. + static $HashMap$NullableType<$K, $V> + nullableType<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + jni$_.JObjType<$V> V, + ) { + return $HashMap$NullableType<$K, $V>( + K, + V, + ); + } + static $HashMap$Type<$K, $V> - type<$K extends _$jni.JObject, $V extends _$jni.JObject>( - _$jni.JObjType<$K> K, - _$jni.JObjType<$V> V, + type<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + jni$_.JObjType<$V> V, ) { - return $HashMap$Type( + return $HashMap$Type<$K, $V>( K, V, ); @@ -4406,29 +5612,29 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(IF)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32, _$jni.Double)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Double)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, double)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, double)>(); /// from: `public void (int i, float f)` /// The returned object must be released after use, by calling the [release] method. factory HashMap( int i, double f, { - required _$jni.JObjType<$K> K, - required _$jni.JObjType<$V> V, + required jni$_.JObjType<$K> K, + required jni$_.JObjType<$V> V, }) { - return HashMap.fromReference( + return HashMap<$K, $V>.fromReference( K, V, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr, i, f) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, i, f) .reference); } @@ -4436,27 +5642,27 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(I)V', ); - static final _new$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_NewObject') + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void (int i)` /// The returned object must be released after use, by calling the [release] method. factory HashMap.new$1( int i, { - required _$jni.JObjType<$K> K, - required _$jni.JObjType<$V> V, + required jni$_.JObjType<$K> K, + required jni$_.JObjType<$V> V, }) { - return HashMap.fromReference( + return HashMap<$K, $V>.fromReference( K, V, - _new$1(_class.reference.pointer, _id_new$1 as _$jni.JMethodIDPtr, i) + _new$1(_class.reference.pointer, _id_new$1 as jni$_.JMethodIDPtr, i) .reference); } @@ -4464,28 +5670,28 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()V', ); - static final _new$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory HashMap.new$2({ - required _$jni.JObjType<$K> K, - required _$jni.JObjType<$V> V, + required jni$_.JObjType<$K> K, + required jni$_.JObjType<$V> V, }) { - return HashMap.fromReference( + return HashMap<$K, $V>.fromReference( K, V, - _new$2(_class.reference.pointer, _id_new$2 as _$jni.JMethodIDPtr) + _new$2(_class.reference.pointer, _id_new$2 as jni$_.JMethodIDPtr) .reference); } @@ -4493,35 +5699,30 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/util/Map;)V', ); - static final _new$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (java.util.Map map)` /// The returned object must be released after use, by calling the [release] method. factory HashMap.new$3( - _$jni.JMap<$K, $V> map, { - _$jni.JObjType<$K>? K, - _$jni.JObjType<$V>? V, + jni$_.JMap<$K?, $V?>? map, { + required jni$_.JObjType<$K> K, + required jni$_.JObjType<$V> V, }) { - K ??= _$jni.lowestCommonSuperType([ - (map.$type as _$jni.JMapType<_$core.dynamic, _$core.dynamic>).K, - ]) as _$jni.JObjType<$K>; - V ??= _$jni.lowestCommonSuperType([ - (map.$type as _$jni.JMapType<_$core.dynamic, _$core.dynamic>).V, - ]) as _$jni.JObjType<$V>; - return HashMap.fromReference( + final _$map = map?.reference ?? jni$_.jNullReference; + return HashMap<$K, $V>.fromReference( K, V, - _new$3(_class.reference.pointer, _id_new$3 as _$jni.JMethodIDPtr, - map.reference.pointer) + _new$3(_class.reference.pointer, _id_new$3 as jni$_.JMethodIDPtr, + _$map.pointer) .reference); } @@ -4530,21 +5731,21 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()I', ); - static final _size = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _size = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int size()` int size() { - return _size(reference.pointer, _id_size as _$jni.JMethodIDPtr).integer; + return _size(reference.pointer, _id_size as jni$_.JMethodIDPtr).integer; } static final _id_isEmpty = _class.instanceMethodId( @@ -4552,21 +5753,21 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()Z', ); - static final _isEmpty = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isEmpty = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isEmpty()` bool isEmpty() { - return _isEmpty(reference.pointer, _id_isEmpty as _$jni.JMethodIDPtr) + return _isEmpty(reference.pointer, _id_isEmpty as jni$_.JMethodIDPtr) .boolean; } @@ -4575,25 +5776,26 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _get = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _get = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public V get(java.lang.Object object)` /// The returned object must be released after use, by calling the [release] method. - $V get( - _$jni.JObject object, + $V? get( + jni$_.JObject? object, ) { - return _get(reference.pointer, _id_get as _$jni.JMethodIDPtr, - object.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + return _get( + reference.pointer, _id_get as jni$_.JMethodIDPtr, _$object.pointer) + .object<$V?>(V.nullableType); } static final _id_containsKey = _class.instanceMethodId( @@ -4601,23 +5803,24 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;)Z', ); - static final _containsKey = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _containsKey = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean containsKey(java.lang.Object object)` bool containsKey( - _$jni.JObject object, + jni$_.JObject? object, ) { + final _$object = object?.reference ?? jni$_.jNullReference; return _containsKey(reference.pointer, - _id_containsKey as _$jni.JMethodIDPtr, object.reference.pointer) + _id_containsKey as jni$_.JMethodIDPtr, _$object.pointer) .boolean; } @@ -4626,32 +5829,34 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _put = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _put = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V put(K object, V object1)` /// The returned object must be released after use, by calling the [release] method. - $V put( - $K object, - $V object1, + $V? put( + $K? object, + $V? object1, ) { - return _put(reference.pointer, _id_put as _$jni.JMethodIDPtr, - object.reference.pointer, object1.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return _put(reference.pointer, _id_put as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer) + .object<$V?>(V.nullableType); } static final _id_putAll = _class.instanceMethodId( @@ -4659,23 +5864,23 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/util/Map;)V', ); - static final _putAll = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _putAll = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void putAll(java.util.Map map)` void putAll( - _$jni.JMap<$K, $V> map, + jni$_.JMap<$K?, $V?>? map, ) { - _putAll(reference.pointer, _id_putAll as _$jni.JMethodIDPtr, - map.reference.pointer) + final _$map = map?.reference ?? jni$_.jNullReference; + _putAll(reference.pointer, _id_putAll as jni$_.JMethodIDPtr, _$map.pointer) .check(); } @@ -4684,25 +5889,26 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _remove = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _remove = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public V remove(java.lang.Object object)` /// The returned object must be released after use, by calling the [release] method. - $V remove( - _$jni.JObject object, + $V? remove( + jni$_.JObject? object, ) { - return _remove(reference.pointer, _id_remove as _$jni.JMethodIDPtr, - object.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + return _remove(reference.pointer, _id_remove as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$V?>(V.nullableType); } static final _id_clear = _class.instanceMethodId( @@ -4710,21 +5916,21 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()V', ); - static final _clear = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _clear = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void clear()` void clear() { - _clear(reference.pointer, _id_clear as _$jni.JMethodIDPtr).check(); + _clear(reference.pointer, _id_clear as jni$_.JMethodIDPtr).check(); } static final _id_containsValue = _class.instanceMethodId( @@ -4732,23 +5938,24 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;)Z', ); - static final _containsValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _containsValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean containsValue(java.lang.Object object)` bool containsValue( - _$jni.JObject object, + jni$_.JObject? object, ) { + final _$object = object?.reference ?? jni$_.jNullReference; return _containsValue(reference.pointer, - _id_containsValue as _$jni.JMethodIDPtr, object.reference.pointer) + _id_containsValue as jni$_.JMethodIDPtr, _$object.pointer) .boolean; } @@ -4757,23 +5964,23 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()Ljava/util/Set;', ); - static final _keySet = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _keySet = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Set keySet()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JSet<$K> keySet() { - return _keySet(reference.pointer, _id_keySet as _$jni.JMethodIDPtr) - .object(_$jni.JSetType(K)); + jni$_.JSet<$K?>? keySet() { + return _keySet(reference.pointer, _id_keySet as jni$_.JMethodIDPtr) + .object?>(jni$_.JSetNullableType<$K?>(K.nullableType)); } static final _id_values = _class.instanceMethodId( @@ -4781,23 +5988,23 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()Ljava/util/Collection;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Collection values()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject values() { - return _values(reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? values() { + return _values(reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_entrySet = _class.instanceMethodId( @@ -4805,23 +6012,25 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()Ljava/util/Set;', ); - static final _entrySet = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _entrySet = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Set entrySet()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JSet<_$jni.JObject> entrySet() { - return _entrySet(reference.pointer, _id_entrySet as _$jni.JMethodIDPtr) - .object(const _$jni.JSetType(_$jni.JObjectType())); + jni$_.JSet? entrySet() { + return _entrySet(reference.pointer, _id_entrySet as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JSetNullableType( + jni$_.JObjectNullableType())); } static final _id_getOrDefault = _class.instanceMethodId( @@ -4829,35 +6038,37 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _getOrDefault = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _getOrDefault = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V getOrDefault(java.lang.Object object, V object1)` /// The returned object must be released after use, by calling the [release] method. - $V getOrDefault( - _$jni.JObject object, - $V object1, + $V? getOrDefault( + jni$_.JObject? object, + $V? object1, ) { + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; return _getOrDefault( reference.pointer, - _id_getOrDefault as _$jni.JMethodIDPtr, - object.reference.pointer, - object1.reference.pointer) - .object(V); + _id_getOrDefault as jni$_.JMethodIDPtr, + _$object.pointer, + _$object1.pointer) + .object<$V?>(V.nullableType); } static final _id_putIfAbsent = _class.instanceMethodId( @@ -4865,35 +6076,37 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _putIfAbsent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _putIfAbsent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V putIfAbsent(K object, V object1)` /// The returned object must be released after use, by calling the [release] method. - $V putIfAbsent( - $K object, - $V object1, + $V? putIfAbsent( + $K? object, + $V? object1, ) { + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; return _putIfAbsent( reference.pointer, - _id_putIfAbsent as _$jni.JMethodIDPtr, - object.reference.pointer, - object1.reference.pointer) - .object(V); + _id_putIfAbsent as jni$_.JMethodIDPtr, + _$object.pointer, + _$object1.pointer) + .object<$V?>(V.nullableType); } static final _id_remove$1 = _class.instanceMethodId( @@ -4901,30 +6114,32 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;)Z', ); - static final _remove$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _remove$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public boolean remove(java.lang.Object object, java.lang.Object object1)` bool remove$1( - _$jni.JObject object, - _$jni.JObject object1, + jni$_.JObject? object, + jni$_.JObject? object1, ) { - return _remove$1(reference.pointer, _id_remove$1 as _$jni.JMethodIDPtr, - object.reference.pointer, object1.reference.pointer) + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return _remove$1(reference.pointer, _id_remove$1 as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer) .boolean; } @@ -4933,37 +6148,36 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z', ); - static final _replace = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _replace = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public boolean replace(K object, V object1, V object2)` bool replace( - $K object, - $V object1, - $V object2, + $K? object, + $V? object1, + $V? object2, ) { - return _replace( - reference.pointer, - _id_replace as _$jni.JMethodIDPtr, - object.reference.pointer, - object1.reference.pointer, - object2.reference.pointer) + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + final _$object2 = object2?.reference ?? jni$_.jNullReference; + return _replace(reference.pointer, _id_replace as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer, _$object2.pointer) .boolean; } @@ -4972,32 +6186,34 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _replace$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _replace$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V replace(K object, V object1)` /// The returned object must be released after use, by calling the [release] method. - $V replace$1( - $K object, - $V object1, + $V? replace$1( + $K? object, + $V? object1, ) { - return _replace$1(reference.pointer, _id_replace$1 as _$jni.JMethodIDPtr, - object.reference.pointer, object1.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return _replace$1(reference.pointer, _id_replace$1 as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer) + .object<$V?>(V.nullableType); } static final _id_computeIfAbsent = _class.instanceMethodId( @@ -5005,35 +6221,37 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;', ); - static final _computeIfAbsent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _computeIfAbsent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V computeIfAbsent(K object, java.util.function.Function function)` /// The returned object must be released after use, by calling the [release] method. - $V computeIfAbsent( - $K object, - _$jni.JObject function, + $V? computeIfAbsent( + $K? object, + jni$_.JObject? function, ) { + final _$object = object?.reference ?? jni$_.jNullReference; + final _$function = function?.reference ?? jni$_.jNullReference; return _computeIfAbsent( reference.pointer, - _id_computeIfAbsent as _$jni.JMethodIDPtr, - object.reference.pointer, - function.reference.pointer) - .object(V); + _id_computeIfAbsent as jni$_.JMethodIDPtr, + _$object.pointer, + _$function.pointer) + .object<$V?>(V.nullableType); } static final _id_computeIfPresent = _class.instanceMethodId( @@ -5041,35 +6259,37 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;', ); - static final _computeIfPresent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _computeIfPresent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V computeIfPresent(K object, java.util.function.BiFunction biFunction)` /// The returned object must be released after use, by calling the [release] method. - $V computeIfPresent( - $K object, - _$jni.JObject biFunction, + $V? computeIfPresent( + $K? object, + jni$_.JObject? biFunction, ) { + final _$object = object?.reference ?? jni$_.jNullReference; + final _$biFunction = biFunction?.reference ?? jni$_.jNullReference; return _computeIfPresent( reference.pointer, - _id_computeIfPresent as _$jni.JMethodIDPtr, - object.reference.pointer, - biFunction.reference.pointer) - .object(V); + _id_computeIfPresent as jni$_.JMethodIDPtr, + _$object.pointer, + _$biFunction.pointer) + .object<$V?>(V.nullableType); } static final _id_compute = _class.instanceMethodId( @@ -5077,32 +6297,34 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;', ); - static final _compute = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _compute = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V compute(K object, java.util.function.BiFunction biFunction)` /// The returned object must be released after use, by calling the [release] method. - $V compute( - $K object, - _$jni.JObject biFunction, + $V? compute( + $K? object, + jni$_.JObject? biFunction, ) { - return _compute(reference.pointer, _id_compute as _$jni.JMethodIDPtr, - object.reference.pointer, biFunction.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$biFunction = biFunction?.reference ?? jni$_.jNullReference; + return _compute(reference.pointer, _id_compute as jni$_.JMethodIDPtr, + _$object.pointer, _$biFunction.pointer) + .object<$V?>(V.nullableType); } static final _id_merge = _class.instanceMethodId( @@ -5110,39 +6332,38 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;', ); - static final _merge = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _merge = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public V merge(K object, V object1, java.util.function.BiFunction biFunction)` /// The returned object must be released after use, by calling the [release] method. - $V merge( - $K object, - $V object1, - _$jni.JObject biFunction, + $V? merge( + $K? object, + $V? object1, + jni$_.JObject? biFunction, ) { - return _merge( - reference.pointer, - _id_merge as _$jni.JMethodIDPtr, - object.reference.pointer, - object1.reference.pointer, - biFunction.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + final _$biFunction = biFunction?.reference ?? jni$_.jNullReference; + return _merge(reference.pointer, _id_merge as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer, _$biFunction.pointer) + .object<$V?>(V.nullableType); } static final _id_forEach = _class.instanceMethodId( @@ -5150,23 +6371,24 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/util/function/BiConsumer;)V', ); - static final _forEach = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _forEach = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void forEach(java.util.function.BiConsumer biConsumer)` void forEach( - _$jni.JObject biConsumer, + jni$_.JObject? biConsumer, ) { - _forEach(reference.pointer, _id_forEach as _$jni.JMethodIDPtr, - biConsumer.reference.pointer) + final _$biConsumer = biConsumer?.reference ?? jni$_.jNullReference; + _forEach(reference.pointer, _id_forEach as jni$_.JMethodIDPtr, + _$biConsumer.pointer) .check(); } @@ -5175,23 +6397,24 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/util/function/BiFunction;)V', ); - static final _replaceAll = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _replaceAll = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void replaceAll(java.util.function.BiFunction biFunction)` void replaceAll( - _$jni.JObject biFunction, + jni$_.JObject? biFunction, ) { - _replaceAll(reference.pointer, _id_replaceAll as _$jni.JMethodIDPtr, - biFunction.reference.pointer) + final _$biFunction = biFunction?.reference ?? jni$_.jNullReference; + _replaceAll(reference.pointer, _id_replaceAll as jni$_.JMethodIDPtr, + _$biFunction.pointer) .check(); } @@ -5200,23 +6423,23 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()Ljava/lang/Object;', ); - static final _clone = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _clone = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object clone()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject clone() { - return _clone(reference.pointer, _id_clone as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? clone() { + return _clone(reference.pointer, _id_clone as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_newHashMap = _class.staticMethodId( @@ -5224,64 +6447,124 @@ class HashMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(I)Ljava/util/HashMap;', ); - static final _newHashMap = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + static final _newHashMap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `static public java.util.HashMap newHashMap(int i)` /// The returned object must be released after use, by calling the [release] method. - static HashMap<$K, $V> - newHashMap<$K extends _$jni.JObject, $V extends _$jni.JObject>( + static HashMap<$K?, $V?>? + newHashMap<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( int i, { - required _$jni.JObjType<$K> K, - required _$jni.JObjType<$V> V, + required jni$_.JObjType<$K> K, + required jni$_.JObjType<$V> V, }) { return _newHashMap( - _class.reference.pointer, _id_newHashMap as _$jni.JMethodIDPtr, i) - .object($HashMap$Type(K, V)); + _class.reference.pointer, _id_newHashMap as jni$_.JMethodIDPtr, i) + .object?>( + $HashMap$NullableType<$K?, $V?>(K.nullableType, V.nullableType)); } } -final class $HashMap$Type<$K extends _$jni.JObject, $V extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$K> K; +final class $HashMap$NullableType<$K extends jni$_.JObject?, + $V extends jni$_.JObject?> extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal - const $HashMap$Type( + @jni$_.internal + const $HashMap$NullableType( this.K, this.V, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Ljava/util/HashMap;'; - @_$jni.internal - @_$core.override - HashMap<$K, $V> fromReference(_$jni.JReference reference) => - HashMap.fromReference(K, V, reference); + @jni$_.internal + @core$_.override + HashMap<$K, $V>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : HashMap<$K, $V>.fromReference( + K, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override + int get hashCode => Object.hash($HashMap$NullableType, K, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($HashMap$NullableType<$K, $V>) && + other is $HashMap$NullableType<$K, $V> && + K == other.K && + V == other.V; + } +} + +final class $HashMap$Type<$K extends jni$_.JObject?, $V extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$K> K; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $HashMap$Type( + this.K, + this.V, + ); + + @jni$_.internal + @core$_.override + String get signature => r'Ljava/util/HashMap;'; + + @jni$_.internal + @core$_.override + HashMap<$K, $V> fromReference(jni$_.JReference reference) => + HashMap<$K, $V>.fromReference( + K, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $HashMap$NullableType<$K, $V>(K, V); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override int get hashCode => Object.hash($HashMap$Type, K, V); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($HashMap$Type<$K, $V>) && other is $HashMap$Type<$K, $V> && @@ -5291,83 +6574,129 @@ final class $HashMap$Type<$K extends _$jni.JObject, $V extends _$jni.JObject> } /// from: `com.example.in_app_java.AndroidUtils` -class AndroidUtils extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class AndroidUtils extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal AndroidUtils.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/example/in_app_java/AndroidUtils'); + jni$_.JClass.forName(r'com/example/in_app_java/AndroidUtils'); /// The type which includes information such as the signature of this class. + static const nullableType = $AndroidUtils$NullableType(); static const type = $AndroidUtils$Type(); static final _id_showToast = _class.staticMethodId( r'showToast', r'(Landroid/app/Activity;Ljava/lang/CharSequence;I)V', ); - static final _showToast = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _showToast = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32 + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32 )>)>>('globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, int)>(); /// from: `static public void showToast(android.app.Activity mainActivity, java.lang.CharSequence text, int duration)` static void showToast( - _$jni.JObject mainActivity, - _$jni.JObject text, + jni$_.JObject? mainActivity, + jni$_.JObject? text, int duration, ) { - _showToast(_class.reference.pointer, _id_showToast as _$jni.JMethodIDPtr, - mainActivity.reference.pointer, text.reference.pointer, duration) + final _$mainActivity = mainActivity?.reference ?? jni$_.jNullReference; + final _$text = text?.reference ?? jni$_.jNullReference; + _showToast(_class.reference.pointer, _id_showToast as jni$_.JMethodIDPtr, + _$mainActivity.pointer, _$text.pointer, duration) .check(); } } -final class $AndroidUtils$Type extends _$jni.JObjType { - @_$jni.internal - const $AndroidUtils$Type(); +final class $AndroidUtils$NullableType extends jni$_.JObjType { + @jni$_.internal + const $AndroidUtils$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/example/in_app_java/AndroidUtils;'; - @_$jni.internal - @_$core.override - AndroidUtils fromReference(_$jni.JReference reference) => - AndroidUtils.fromReference(reference); + @jni$_.internal + @core$_.override + AndroidUtils? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : AndroidUtils.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($AndroidUtils$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($AndroidUtils$NullableType) && + other is $AndroidUtils$NullableType; + } +} + +final class $AndroidUtils$Type extends jni$_.JObjType { + @jni$_.internal + const $AndroidUtils$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/example/in_app_java/AndroidUtils;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + AndroidUtils fromReference(jni$_.JReference reference) => + AndroidUtils.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $AndroidUtils$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($AndroidUtils$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($AndroidUtils$Type) && other is $AndroidUtils$Type; diff --git a/pkgs/jnigen/example/in_app_java/lib/main.dart b/pkgs/jnigen/example/in_app_java/lib/main.dart index 3f3cdcab6..4dbdc84bc 100644 --- a/pkgs/jnigen/example/in_app_java/lib/main.dart +++ b/pkgs/jnigen/example/in_app_java/lib/main.dart @@ -14,7 +14,7 @@ JObject context = JObject.fromReference(Jni.getCachedApplicationContext()); final hashmap = HashMap.new$2(K: JString.type, V: JString.type); -final emojiCompat = EmojiCompat.get(); +final emojiCompat = EmojiCompat.get()!; extension IntX on int { JString toJString() { @@ -29,13 +29,13 @@ const sunglassEmoji = "😎"; void showToast() { final toastCount = hashmap.getOrDefault("toastCount".toJString(), 0.toJString()); - final newToastCount = (int.parse(toastCount.toDartString()) + 1).toJString(); + final newToastCount = (int.parse(toastCount!.toDartString()) + 1).toJString(); hashmap.put("toastCount".toJString(), newToastCount); final emoji = emojiCompat.hasEmojiGlyph(sunglassEmoji.toJString()) ? sunglassEmoji : ':cool:'; final message = - '${newToastCount.toDartString()} - ${Build.MODEL.toDartString()} $emoji'; + '${newToastCount.toDartString()} - ${Build.MODEL!.toDartString()} $emoji'; AndroidUtils.showToast(activity, message.toJString(), 0); } diff --git a/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart b/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart index f5bfcb56e..90448602e 100644 --- a/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart +++ b/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart @@ -20,6 +20,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -29,48 +30,49 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `Example` -class Example extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Example extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Example.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName(r'Example'); + static final _class = jni$_.JClass.forName(r'Example'); /// The type which includes information such as the signature of this class. + static const nullableType = $Example$NullableType(); static const type = $Example$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Example() { return Example.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -79,63 +81,107 @@ class Example extends _$jni.JObject { r'(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', ); - static final _thinkBeforeAnswering = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _thinkBeforeAnswering = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final java.lang.Object thinkBeforeAnswering(kotlin.coroutines.Continuation continuation)` /// The returned object must be released after use, by calling the [release] method. - _$core.Future<_$jni.JString> thinkBeforeAnswering() async { - final $p = _$jni.ReceivePort(); - final $c = _$jni.JObject.fromReference( - _$jni.ProtectedJniExtensions.newPortContinuation($p)); + core$_.Future thinkBeforeAnswering() async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + _thinkBeforeAnswering( reference.pointer, - _id_thinkBeforeAnswering as _$jni.JMethodIDPtr, - $c.reference.pointer) - .object(const _$jni.JObjectType()); + _id_thinkBeforeAnswering as jni$_.JMethodIDPtr, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); final $o = - _$jni.JGlobalReference(_$jni.JObjectPtr.fromAddress(await $p.first)); - final $k = const _$jni.JStringType().jClass.reference.pointer; - if (!_$jni.Jni.env.IsInstanceOf($o.pointer, $k)) { + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress(await $p.first)); + final $k = const jni$_.JStringType().jClass.reference; + if (!jni$_.Jni.env.IsInstanceOf($o.pointer, $k.pointer)) { + $k.release(); throw 'Failed'; } - return const _$jni.JStringType().fromReference($o); + $k.release(); + return const jni$_.JStringType().fromReference($o); } } -final class $Example$Type extends _$jni.JObjType { - @_$jni.internal - const $Example$Type(); +final class $Example$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Example$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'LExample;'; - @_$jni.internal - @_$core.override - Example fromReference(_$jni.JReference reference) => - Example.fromReference(reference); + @jni$_.internal + @core$_.override + Example? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Example.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Example$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Example$NullableType) && + other is $Example$NullableType; + } +} + +final class $Example$Type extends jni$_.JObjType { + @jni$_.internal + const $Example$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LExample;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Example fromReference(jni$_.JReference reference) => Example.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Example$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Example$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Example$Type) && other is $Example$Type; } diff --git a/pkgs/jnigen/example/notification_plugin/example/lib/main.dart b/pkgs/jnigen/example/notification_plugin/example/lib/main.dart index e5343b0fb..7b978c7ac 100644 --- a/pkgs/jnigen/example/notification_plugin/example/lib/main.dart +++ b/pkgs/jnigen/example/notification_plugin/example/lib/main.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:jni/jni.dart'; - // The hierarchy created in generated code will mirror the java package // structure. This is an implementation convenience and we may allow // more customization in future. diff --git a/pkgs/jnigen/example/notification_plugin/lib/notifications.dart b/pkgs/jnigen/example/notification_plugin/lib/notifications.dart index 2fa53747c..ea874e1da 100644 --- a/pkgs/jnigen/example/notification_plugin/lib/notifications.dart +++ b/pkgs/jnigen/example/notification_plugin/lib/notifications.dart @@ -24,6 +24,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -33,49 +34,50 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `com.example.notification_plugin.Notifications` -class Notifications extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Notifications extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Notifications.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/example/notification_plugin/Notifications'); + jni$_.JClass.forName(r'com/example/notification_plugin/Notifications'); /// The type which includes information such as the signature of this class. + static const nullableType = $Notifications$NullableType(); static const type = $Notifications$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Notifications() { return Notifications.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -84,70 +86,116 @@ class Notifications extends _$jni.JObject { r'(Landroid/content/Context;ILjava/lang/String;Ljava/lang/String;)V', ); - static final _showNotification = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _showNotification = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, int, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public void showNotification(android.content.Context context, int notificationID, java.lang.String title, java.lang.String text)` static void showNotification( - _$jni.JObject context, + jni$_.JObject? context, int notificationID, - _$jni.JString title, - _$jni.JString text, + jni$_.JString? title, + jni$_.JString? text, ) { + final _$context = context?.reference ?? jni$_.jNullReference; + final _$title = title?.reference ?? jni$_.jNullReference; + final _$text = text?.reference ?? jni$_.jNullReference; _showNotification( _class.reference.pointer, - _id_showNotification as _$jni.JMethodIDPtr, - context.reference.pointer, + _id_showNotification as jni$_.JMethodIDPtr, + _$context.pointer, notificationID, - title.reference.pointer, - text.reference.pointer) + _$title.pointer, + _$text.pointer) .check(); } } -final class $Notifications$Type extends _$jni.JObjType { - @_$jni.internal - const $Notifications$Type(); +final class $Notifications$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Notifications$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/example/notification_plugin/Notifications;'; - @_$jni.internal - @_$core.override - Notifications fromReference(_$jni.JReference reference) => - Notifications.fromReference(reference); + @jni$_.internal + @core$_.override + Notifications? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Notifications.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Notifications$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Notifications$NullableType) && + other is $Notifications$NullableType; + } +} + +final class $Notifications$Type extends jni$_.JObjType { + @jni$_.internal + const $Notifications$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/example/notification_plugin/Notifications;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Notifications fromReference(jni$_.JReference reference) => + Notifications.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Notifications$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Notifications$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Notifications$Type) && other is $Notifications$Type; diff --git a/pkgs/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart b/pkgs/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart index 0dadbcf24..7b7cd3e10 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart @@ -4,9 +4,8 @@ import 'dart:io'; -import 'package:path/path.dart'; import 'package:jni/jni.dart'; - +import 'package:path/path.dart'; import 'package:pdfbox_plugin/pdfbox_plugin.dart'; void writeInfo(String file) { @@ -14,23 +13,23 @@ void writeInfo(String file) { final inputFile = fileInputStreamClass .constructorId("(Ljava/lang/String;)V") .call(fileInputStreamClass, JObject.type, [file.toJString()]); - final pdDoc = PDDocument.load$6(inputFile); + final pdDoc = PDDocument.load$6(inputFile)!; int pages = pdDoc.getNumberOfPages(); - final info = pdDoc.getDocumentInformation(); + final info = pdDoc.getDocumentInformation()!; final title = info.getTitle(); final subject = info.getSubject(); final author = info.getAuthor(); stderr.writeln('Number of pages: $pages'); - if (!title.isNull) { + if (title != null) { stderr.writeln('Title: ${title.toDartString()}'); } - if (!subject.isNull) { + if (subject != null) { stderr.writeln('Subject: ${subject.toDartString()}'); } - if (!author.isNull) { + if (author != null) { stderr.writeln('Author: ${author.toDartString()}'); } diff --git a/pkgs/jnigen/example/pdfbox_plugin/example/lib/main.dart b/pkgs/jnigen/example/pdfbox_plugin/example/lib/main.dart index 52fb69d27..a70d514b4 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/example/lib/main.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/example/lib/main.dart @@ -2,13 +2,12 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:flutter/material.dart'; -import 'dart:io'; import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; import 'package:jni/jni.dart'; import 'package:path/path.dart'; - import 'package:pdfbox_plugin/pdfbox_plugin.dart'; Stream files(String dir) => Directory(dir).list().map((e) => e.path); @@ -155,15 +154,6 @@ class PDFFileInfo { late String author, subject, title; late int numPages; - /// Converts JString to dart string and deletes the original. - /// Also handles the case where the underlying string is Null. - String _fromJavaStr(JString jstr) { - if (jstr.isNull) { - return '(null)'; - } - return jstr.toDartString(releaseOriginal: true); - } - PDFFileInfo.usingPDFBox(this.filename) { // Since java.io is not directly available, use package:jni API to // create a java.io.File object. @@ -172,17 +162,17 @@ class PDFFileInfo { .constructorId("(Ljava/lang/String;)V") .call(fileClass, JObject.type, [filename]); // Static method call PDDocument.load -> PDDocument - final pdf = PDDocument.load(inputFile); + final pdf = PDDocument.load(inputFile)!; // Instance method call getNumberOfPages() -> int numPages = pdf.getNumberOfPages(); // Instance method that returns an object - final info = pdf.getDocumentInformation(); + final info = pdf.getDocumentInformation()!; /// java.lang.String is a special case and is mapped to JlString which is /// a subclass of JlObject. - author = _fromJavaStr(info.getAuthor()); - title = _fromJavaStr(info.getTitle()); - subject = _fromJavaStr(info.getSubject()); + author = info.getAuthor()?.toDartString(releaseOriginal: true) ?? 'null'; + title = info.getTitle()?.toDartString(releaseOriginal: true) ?? 'null'; + subject = info.getSubject()?.toDartString(releaseOriginal: true) ?? 'null'; pdf.close(); } diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart index 0943be9b2..4e10e9804 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart @@ -38,6 +38,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -47,48 +48,49 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; -import 'PDDocumentInformation.dart' as pddocumentinformation_; +import 'PDDocumentInformation.dart' as pddocumentinformation$_; /// from: `org.apache.pdfbox.pdmodel.PDDocument` /// /// This is the in-memory representation of the PDF document. /// The \#close() method must be called once the document is no longer needed. ///@author Ben Litchfield -class PDDocument extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class PDDocument extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal PDDocument.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'org/apache/pdfbox/pdmodel/PDDocument'); + jni$_.JClass.forName(r'org/apache/pdfbox/pdmodel/PDDocument'); /// The type which includes information such as the signature of this class. + static const nullableType = $PDDocument$NullableType(); static const type = $PDDocument$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` @@ -98,7 +100,7 @@ class PDDocument extends _$jni.JObject { /// You need to add at least one page for the document to be valid. factory PDDocument() { return PDDocument.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -106,16 +108,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/io/MemoryUsageSetting;)V', ); - static final _new$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -124,10 +126,12 @@ class PDDocument extends _$jni.JObject { /// You need to add at least one page for the document to be valid. ///@param memUsageSetting defines how memory is used for buffering PDF streams factory PDDocument.new$1( - _$jni.JObject memUsageSetting, + jni$_.JObject? memUsageSetting, ) { + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; return PDDocument.fromReference(_new$1(_class.reference.pointer, - _id_new$1 as _$jni.JMethodIDPtr, memUsageSetting.reference.pointer) + _id_new$1 as jni$_.JMethodIDPtr, _$memUsageSetting.pointer) .reference); } @@ -135,16 +139,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/cos/COSDocument;)V', ); - static final _new$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (org.apache.pdfbox.cos.COSDocument doc)` /// The returned object must be released after use, by calling the [release] method. @@ -152,10 +156,11 @@ class PDDocument extends _$jni.JObject { /// Constructor that uses an existing document. The COSDocument that is passed in must be valid. ///@param doc The COSDocument that this document wraps. factory PDDocument.new$2( - _$jni.JObject doc, + jni$_.JObject? doc, ) { + final _$doc = doc?.reference ?? jni$_.jNullReference; return PDDocument.fromReference(_new$2(_class.reference.pointer, - _id_new$2 as _$jni.JMethodIDPtr, doc.reference.pointer) + _id_new$2 as jni$_.JMethodIDPtr, _$doc.pointer) .reference); } @@ -163,22 +168,22 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/cos/COSDocument;Lorg/apache/pdfbox/io/RandomAccessRead;)V', ); - static final _new$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void (org.apache.pdfbox.cos.COSDocument doc, org.apache.pdfbox.io.RandomAccessRead source)` /// The returned object must be released after use, by calling the [release] method. @@ -187,14 +192,13 @@ class PDDocument extends _$jni.JObject { ///@param doc The COSDocument that this document wraps. ///@param source the parser which is used to read the pdf factory PDDocument.new$3( - _$jni.JObject doc, - _$jni.JObject source, + jni$_.JObject? doc, + jni$_.JObject? source, ) { - return PDDocument.fromReference(_new$3( - _class.reference.pointer, - _id_new$3 as _$jni.JMethodIDPtr, - doc.reference.pointer, - source.reference.pointer) + final _$doc = doc?.reference ?? jni$_.jNullReference; + final _$source = source?.reference ?? jni$_.jNullReference; + return PDDocument.fromReference(_new$3(_class.reference.pointer, + _id_new$3 as jni$_.JMethodIDPtr, _$doc.pointer, _$source.pointer) .reference); } @@ -202,24 +206,24 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/cos/COSDocument;Lorg/apache/pdfbox/io/RandomAccessRead;Lorg/apache/pdfbox/pdmodel/encryption/AccessPermission;)V', ); - static final _new$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void (org.apache.pdfbox.cos.COSDocument doc, org.apache.pdfbox.io.RandomAccessRead source, org.apache.pdfbox.pdmodel.encryption.AccessPermission permission)` /// The returned object must be released after use, by calling the [release] method. @@ -229,16 +233,19 @@ class PDDocument extends _$jni.JObject { ///@param source the parser which is used to read the pdf ///@param permission he access permissions of the pdf factory PDDocument.new$4( - _$jni.JObject doc, - _$jni.JObject source, - _$jni.JObject permission, + jni$_.JObject? doc, + jni$_.JObject? source, + jni$_.JObject? permission, ) { + final _$doc = doc?.reference ?? jni$_.jNullReference; + final _$source = source?.reference ?? jni$_.jNullReference; + final _$permission = permission?.reference ?? jni$_.jNullReference; return PDDocument.fromReference(_new$4( _class.reference.pointer, - _id_new$4 as _$jni.JMethodIDPtr, - doc.reference.pointer, - source.reference.pointer, - permission.reference.pointer) + _id_new$4 as jni$_.JMethodIDPtr, + _$doc.pointer, + _$source.pointer, + _$permission.pointer) .reference); } @@ -247,16 +254,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDPage;)V', ); - static final _addPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _addPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void addPage(org.apache.pdfbox.pdmodel.PDPage page)` /// @@ -264,10 +271,11 @@ class PDDocument extends _$jni.JObject { /// hierarchy and set the parent of the page to the root. ///@param page The page to add to the document. void addPage( - _$jni.JObject page, + jni$_.JObject? page, ) { - _addPage(reference.pointer, _id_addPage as _$jni.JMethodIDPtr, - page.reference.pointer) + final _$page = page?.reference ?? jni$_.jNullReference; + _addPage(reference.pointer, _id_addPage as jni$_.JMethodIDPtr, + _$page.pointer) .check(); } @@ -276,16 +284,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/PDSignature;)V', ); - static final _addSignature = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _addSignature = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void addSignature(org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature sigObject)` /// @@ -300,10 +308,11 @@ class PDDocument extends _$jni.JObject { ///@throws IllegalStateException if one attempts to add several signature /// fields. void addSignature( - _$jni.JObject sigObject, + jni$_.JObject? sigObject, ) { - _addSignature(reference.pointer, _id_addSignature as _$jni.JMethodIDPtr, - sigObject.reference.pointer) + final _$sigObject = sigObject?.reference ?? jni$_.jNullReference; + _addSignature(reference.pointer, _id_addSignature as jni$_.JMethodIDPtr, + _$sigObject.pointer) .check(); } @@ -312,22 +321,22 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/PDSignature;Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions;)V', ); - static final _addSignature$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _addSignature$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void addSignature(org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature sigObject, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions options)` /// @@ -343,11 +352,13 @@ class PDDocument extends _$jni.JObject { ///@throws IllegalStateException if one attempts to add several signature /// fields. void addSignature$1( - _$jni.JObject sigObject, - _$jni.JObject options, + jni$_.JObject? sigObject, + jni$_.JObject? options, ) { - _addSignature$1(reference.pointer, _id_addSignature$1 as _$jni.JMethodIDPtr, - sigObject.reference.pointer, options.reference.pointer) + final _$sigObject = sigObject?.reference ?? jni$_.jNullReference; + final _$options = options?.reference ?? jni$_.jNullReference; + _addSignature$1(reference.pointer, _id_addSignature$1 as jni$_.JMethodIDPtr, + _$sigObject.pointer, _$options.pointer) .check(); } @@ -356,22 +367,22 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/PDSignature;Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureInterface;)V', ); - static final _addSignature$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _addSignature$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void addSignature(org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature sigObject, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface signatureInterface)` /// @@ -386,11 +397,14 @@ class PDDocument extends _$jni.JObject { ///@throws IllegalStateException if one attempts to add several signature /// fields. void addSignature$2( - _$jni.JObject sigObject, - _$jni.JObject signatureInterface, + jni$_.JObject? sigObject, + jni$_.JObject? signatureInterface, ) { - _addSignature$2(reference.pointer, _id_addSignature$2 as _$jni.JMethodIDPtr, - sigObject.reference.pointer, signatureInterface.reference.pointer) + final _$sigObject = sigObject?.reference ?? jni$_.jNullReference; + final _$signatureInterface = + signatureInterface?.reference ?? jni$_.jNullReference; + _addSignature$2(reference.pointer, _id_addSignature$2 as jni$_.JMethodIDPtr, + _$sigObject.pointer, _$signatureInterface.pointer) .check(); } @@ -399,24 +413,24 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/PDSignature;Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureInterface;Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions;)V', ); - static final _addSignature$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _addSignature$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void addSignature(org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature sigObject, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface signatureInterface, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions options)` /// @@ -434,16 +448,20 @@ class PDDocument extends _$jni.JObject { ///@throws IllegalStateException if one attempts to add several signature /// fields. void addSignature$3( - _$jni.JObject sigObject, - _$jni.JObject signatureInterface, - _$jni.JObject options, + jni$_.JObject? sigObject, + jni$_.JObject? signatureInterface, + jni$_.JObject? options, ) { + final _$sigObject = sigObject?.reference ?? jni$_.jNullReference; + final _$signatureInterface = + signatureInterface?.reference ?? jni$_.jNullReference; + final _$options = options?.reference ?? jni$_.jNullReference; _addSignature$3( reference.pointer, - _id_addSignature$3 as _$jni.JMethodIDPtr, - sigObject.reference.pointer, - signatureInterface.reference.pointer, - options.reference.pointer) + _id_addSignature$3 as jni$_.JMethodIDPtr, + _$sigObject.pointer, + _$signatureInterface.pointer, + _$options.pointer) .check(); } @@ -452,24 +470,24 @@ class PDDocument extends _$jni.JObject { r'(Ljava/util/List;Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureInterface;Lorg/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions;)V', ); - static final _addSignatureField = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _addSignatureField = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void addSignatureField(java.util.List sigFields, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface signatureInterface, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions options)` /// @@ -482,16 +500,20 @@ class PDDocument extends _$jni.JObject { ///@deprecated The method is misleading, because only one signature may be /// added in a document. The method will be removed in the future. void addSignatureField( - _$jni.JList<_$jni.JObject> sigFields, - _$jni.JObject signatureInterface, - _$jni.JObject options, + jni$_.JList? sigFields, + jni$_.JObject? signatureInterface, + jni$_.JObject? options, ) { + final _$sigFields = sigFields?.reference ?? jni$_.jNullReference; + final _$signatureInterface = + signatureInterface?.reference ?? jni$_.jNullReference; + final _$options = options?.reference ?? jni$_.jNullReference; _addSignatureField( reference.pointer, - _id_addSignatureField as _$jni.JMethodIDPtr, - sigFields.reference.pointer, - signatureInterface.reference.pointer, - options.reference.pointer) + _id_addSignatureField as jni$_.JMethodIDPtr, + _$sigFields.pointer, + _$signatureInterface.pointer, + _$options.pointer) .check(); } @@ -500,26 +522,27 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDPage;)V', ); - static final _removePage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _removePage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void removePage(org.apache.pdfbox.pdmodel.PDPage page)` /// /// Remove the page from the document. ///@param page The page to remove from the document. void removePage( - _$jni.JObject page, + jni$_.JObject? page, ) { - _removePage(reference.pointer, _id_removePage as _$jni.JMethodIDPtr, - page.reference.pointer) + final _$page = page?.reference ?? jni$_.jNullReference; + _removePage(reference.pointer, _id_removePage as jni$_.JMethodIDPtr, + _$page.pointer) .check(); } @@ -528,15 +551,15 @@ class PDDocument extends _$jni.JObject { r'(I)V', ); - static final _removePage$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _removePage$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void removePage(int pageNumber)` /// @@ -545,7 +568,7 @@ class PDDocument extends _$jni.JObject { void removePage$1( int pageNumber, ) { - _removePage$1(reference.pointer, _id_removePage$1 as _$jni.JMethodIDPtr, + _removePage$1(reference.pointer, _id_removePage$1 as jni$_.JMethodIDPtr, pageNumber) .check(); } @@ -555,16 +578,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDPage;)Lorg/apache/pdfbox/pdmodel/PDPage;', ); - static final _importPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _importPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public org.apache.pdfbox.pdmodel.PDPage importPage(org.apache.pdfbox.pdmodel.PDPage page)` /// The returned object must be released after use, by calling the [release] method. @@ -590,12 +613,13 @@ class PDDocument extends _$jni.JObject { ///@param page The page to import. ///@return The page that was imported. ///@throws IOException If there is an error copying the page. - _$jni.JObject importPage( - _$jni.JObject page, + jni$_.JObject? importPage( + jni$_.JObject? page, ) { - return _importPage(reference.pointer, _id_importPage as _$jni.JMethodIDPtr, - page.reference.pointer) - .object(const _$jni.JObjectType()); + final _$page = page?.reference ?? jni$_.jNullReference; + return _importPage(reference.pointer, _id_importPage as jni$_.JMethodIDPtr, + _$page.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_getDocument = _class.instanceMethodId( @@ -603,16 +627,16 @@ class PDDocument extends _$jni.JObject { r'()Lorg/apache/pdfbox/cos/COSDocument;', ); - static final _getDocument = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDocument = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.cos.COSDocument getDocument()` @@ -620,10 +644,10 @@ class PDDocument extends _$jni.JObject { /// /// This will get the low level document. ///@return The document that this layer sits on top of. - _$jni.JObject getDocument() { + jni$_.JObject? getDocument() { return _getDocument( - reference.pointer, _id_getDocument as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getDocument as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getDocumentInformation = _class.instanceMethodId( @@ -631,16 +655,16 @@ class PDDocument extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/PDDocumentInformation;', ); - static final _getDocumentInformation = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDocumentInformation = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.PDDocumentInformation getDocumentInformation()` @@ -653,10 +677,12 @@ class PDDocument extends _$jni.JObject { /// document level metadata, a metadata stream should be used instead, see /// PDDocumentCatalog\#getMetadata(). ///@return The documents /Info dictionary, never null. - pddocumentinformation_.PDDocumentInformation getDocumentInformation() { + pddocumentinformation$_.PDDocumentInformation? getDocumentInformation() { return _getDocumentInformation( - reference.pointer, _id_getDocumentInformation as _$jni.JMethodIDPtr) - .object(const pddocumentinformation_.$PDDocumentInformation$Type()); + reference.pointer, _id_getDocumentInformation as jni$_.JMethodIDPtr) + .object( + const pddocumentinformation$_ + .$PDDocumentInformation$NullableType()); } static final _id_setDocumentInformation = _class.instanceMethodId( @@ -664,16 +690,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDDocumentInformation;)V', ); - static final _setDocumentInformation = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setDocumentInformation = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setDocumentInformation(org.apache.pdfbox.pdmodel.PDDocumentInformation info)` /// @@ -684,12 +710,11 @@ class PDDocument extends _$jni.JObject { /// PDDocumentCatalog\#setMetadata(org.apache.pdfbox.pdmodel.common.PDMetadata) PDDocumentCatalog\#setMetadata(PDMetadata). ///@param info The updated document information. void setDocumentInformation( - pddocumentinformation_.PDDocumentInformation info, + pddocumentinformation$_.PDDocumentInformation? info, ) { - _setDocumentInformation( - reference.pointer, - _id_setDocumentInformation as _$jni.JMethodIDPtr, - info.reference.pointer) + final _$info = info?.reference ?? jni$_.jNullReference; + _setDocumentInformation(reference.pointer, + _id_setDocumentInformation as jni$_.JMethodIDPtr, _$info.pointer) .check(); } @@ -698,16 +723,16 @@ class PDDocument extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/PDDocumentCatalog;', ); - static final _getDocumentCatalog = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDocumentCatalog = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.PDDocumentCatalog getDocumentCatalog()` @@ -715,10 +740,10 @@ class PDDocument extends _$jni.JObject { /// /// This will get the document CATALOG. This is guaranteed to not return null. ///@return The documents /Root dictionary - _$jni.JObject getDocumentCatalog() { + jni$_.JObject? getDocumentCatalog() { return _getDocumentCatalog( - reference.pointer, _id_getDocumentCatalog as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getDocumentCatalog as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_isEncrypted = _class.instanceMethodId( @@ -726,16 +751,16 @@ class PDDocument extends _$jni.JObject { r'()Z', ); - static final _isEncrypted = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isEncrypted = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isEncrypted()` @@ -744,7 +769,7 @@ class PDDocument extends _$jni.JObject { ///@return true If this document is encrypted. bool isEncrypted() { return _isEncrypted( - reference.pointer, _id_isEncrypted as _$jni.JMethodIDPtr) + reference.pointer, _id_isEncrypted as jni$_.JMethodIDPtr) .boolean; } @@ -753,16 +778,16 @@ class PDDocument extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/encryption/PDEncryption;', ); - static final _getEncryption = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getEncryption = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.encryption.PDEncryption getEncryption()` @@ -773,10 +798,10 @@ class PDDocument extends _$jni.JObject { /// but the only supported subclass at this time is a /// PDStandardEncryption object. ///@return The encryption dictionary(most likely a PDStandardEncryption object) - _$jni.JObject getEncryption() { + jni$_.JObject? getEncryption() { return _getEncryption( - reference.pointer, _id_getEncryption as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getEncryption as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setEncryptionDictionary = _class.instanceMethodId( @@ -784,16 +809,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/encryption/PDEncryption;)V', ); - static final _setEncryptionDictionary = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setEncryptionDictionary = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setEncryptionDictionary(org.apache.pdfbox.pdmodel.encryption.PDEncryption encryption)` /// @@ -801,12 +826,13 @@ class PDDocument extends _$jni.JObject { ///@param encryption The encryption dictionary(most likely a PDStandardEncryption object) ///@throws IOException If there is an error determining which security handler to use. void setEncryptionDictionary( - _$jni.JObject encryption, + jni$_.JObject? encryption, ) { + final _$encryption = encryption?.reference ?? jni$_.jNullReference; _setEncryptionDictionary( reference.pointer, - _id_setEncryptionDictionary as _$jni.JMethodIDPtr, - encryption.reference.pointer) + _id_setEncryptionDictionary as jni$_.JMethodIDPtr, + _$encryption.pointer) .check(); } @@ -816,16 +842,16 @@ class PDDocument extends _$jni.JObject { ); static final _getLastSignatureDictionary = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature getLastSignatureDictionary()` @@ -835,10 +861,10 @@ class PDDocument extends _$jni.JObject { /// last in time when empty signature fields are created first but signed after other fields. ///@return the last signature as PDSignatureField. ///@throws IOException if no document catalog can be found. - _$jni.JObject getLastSignatureDictionary() { + jni$_.JObject? getLastSignatureDictionary() { return _getLastSignatureDictionary(reference.pointer, - _id_getLastSignatureDictionary as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_getLastSignatureDictionary as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getSignatureFields = _class.instanceMethodId( @@ -846,16 +872,16 @@ class PDDocument extends _$jni.JObject { r'()Ljava/util/List;', ); - static final _getSignatureFields = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSignatureFields = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.List getSignatureFields()` @@ -864,10 +890,12 @@ class PDDocument extends _$jni.JObject { /// Retrieve all signature fields from the document. ///@return a List of PDSignatureFields ///@throws IOException if no document catalog can be found. - _$jni.JList<_$jni.JObject> getSignatureFields() { + jni$_.JList? getSignatureFields() { return _getSignatureFields( - reference.pointer, _id_getSignatureFields as _$jni.JMethodIDPtr) - .object(const _$jni.JListType(_$jni.JObjectType())); + reference.pointer, _id_getSignatureFields as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JListNullableType( + jni$_.JObjectNullableType())); } static final _id_getSignatureDictionaries = _class.instanceMethodId( @@ -875,16 +903,16 @@ class PDDocument extends _$jni.JObject { r'()Ljava/util/List;', ); - static final _getSignatureDictionaries = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSignatureDictionaries = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.List getSignatureDictionaries()` @@ -893,10 +921,12 @@ class PDDocument extends _$jni.JObject { /// Retrieve all signature dictionaries from the document. ///@return a List of PDSignatureFields ///@throws IOException if no document catalog can be found. - _$jni.JList<_$jni.JObject> getSignatureDictionaries() { + jni$_.JList? getSignatureDictionaries() { return _getSignatureDictionaries(reference.pointer, - _id_getSignatureDictionaries as _$jni.JMethodIDPtr) - .object(const _$jni.JListType(_$jni.JObjectType())); + _id_getSignatureDictionaries as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JListNullableType( + jni$_.JObjectNullableType())); } static final _id_registerTrueTypeFontForClosing = _class.instanceMethodId( @@ -905,16 +935,16 @@ class PDDocument extends _$jni.JObject { ); static final _registerTrueTypeFontForClosing = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void registerTrueTypeFontForClosing(org.apache.fontbox.ttf.TrueTypeFont ttf)` /// @@ -923,12 +953,13 @@ class PDDocument extends _$jni.JObject { /// method, it is done by the appropriate PDFont classes. ///@param ttf void registerTrueTypeFontForClosing( - _$jni.JObject ttf, + jni$_.JObject? ttf, ) { + final _$ttf = ttf?.reference ?? jni$_.jNullReference; _registerTrueTypeFontForClosing( reference.pointer, - _id_registerTrueTypeFontForClosing as _$jni.JMethodIDPtr, - ttf.reference.pointer) + _id_registerTrueTypeFontForClosing as jni$_.JMethodIDPtr, + _$ttf.pointer) .check(); } @@ -937,16 +968,16 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _load = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.File file)` /// The returned object must be released after use, by calling the [release] method. @@ -956,12 +987,13 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the file required a non-empty password. ///@throws IOException in case of a file reading or parsing error - static PDDocument load( - _$jni.JObject file, + static PDDocument? load( + jni$_.JObject? file, ) { - return _load(_class.reference.pointer, _id_load as _$jni.JMethodIDPtr, - file.reference.pointer) - .object(const $PDDocument$Type()); + final _$file = file?.reference ?? jni$_.jNullReference; + return _load(_class.reference.pointer, _id_load as jni$_.JMethodIDPtr, + _$file.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$1 = _class.staticMethodId( @@ -969,22 +1001,22 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.File file, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -995,13 +1027,16 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the file required a non-empty password. ///@throws IOException in case of a file reading or parsing error - static PDDocument load$1( - _$jni.JObject file, - _$jni.JObject memUsageSetting, + static PDDocument? load$1( + jni$_.JObject? file, + jni$_.JObject? memUsageSetting, ) { - return _load$1(_class.reference.pointer, _id_load$1 as _$jni.JMethodIDPtr, - file.reference.pointer, memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + final _$file = file?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; + return _load$1(_class.reference.pointer, _id_load$1 as jni$_.JMethodIDPtr, + _$file.pointer, _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$2 = _class.staticMethodId( @@ -1009,22 +1044,22 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;Ljava/lang/String;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.File file, java.lang.String password)` /// The returned object must be released after use, by calling the [release] method. @@ -1035,13 +1070,15 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException in case of a file reading or parsing error - static PDDocument load$2( - _$jni.JObject file, - _$jni.JString password, + static PDDocument? load$2( + jni$_.JObject? file, + jni$_.JString? password, ) { - return _load$2(_class.reference.pointer, _id_load$2 as _$jni.JMethodIDPtr, - file.reference.pointer, password.reference.pointer) - .object(const $PDDocument$Type()); + final _$file = file?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + return _load$2(_class.reference.pointer, _id_load$2 as jni$_.JMethodIDPtr, + _$file.pointer, _$password.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$3 = _class.staticMethodId( @@ -1049,24 +1086,24 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;Ljava/lang/String;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.File file, java.lang.String password, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -1078,18 +1115,18 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException in case of a file reading or parsing error - static PDDocument load$3( - _$jni.JObject file, - _$jni.JString password, - _$jni.JObject memUsageSetting, + static PDDocument? load$3( + jni$_.JObject? file, + jni$_.JString? password, + jni$_.JObject? memUsageSetting, ) { - return _load$3( - _class.reference.pointer, - _id_load$3 as _$jni.JMethodIDPtr, - file.reference.pointer, - password.reference.pointer, - memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + final _$file = file?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; + return _load$3(_class.reference.pointer, _id_load$3 as jni$_.JMethodIDPtr, + _$file.pointer, _$password.pointer, _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$4 = _class.staticMethodId( @@ -1097,26 +1134,26 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;Ljava/lang/String;Ljava/io/InputStream;Ljava/lang/String;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.File file, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias)` /// The returned object must be released after use, by calling the [release] method. @@ -1128,20 +1165,24 @@ class PDDocument extends _$jni.JObject { ///@param alias alias to be used for decryption when using public key security ///@return loaded document ///@throws IOException in case of a file reading or parsing error - static PDDocument load$4( - _$jni.JObject file, - _$jni.JString password, - _$jni.JObject keyStore, - _$jni.JString alias, + static PDDocument? load$4( + jni$_.JObject? file, + jni$_.JString? password, + jni$_.JObject? keyStore, + jni$_.JString? alias, ) { + final _$file = file?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$keyStore = keyStore?.reference ?? jni$_.jNullReference; + final _$alias = alias?.reference ?? jni$_.jNullReference; return _load$4( _class.reference.pointer, - _id_load$4 as _$jni.JMethodIDPtr, - file.reference.pointer, - password.reference.pointer, - keyStore.reference.pointer, - alias.reference.pointer) - .object(const $PDDocument$Type()); + _id_load$4 as jni$_.JMethodIDPtr, + _$file.pointer, + _$password.pointer, + _$keyStore.pointer, + _$alias.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$5 = _class.staticMethodId( @@ -1149,28 +1190,28 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;Ljava/lang/String;Ljava/io/InputStream;Ljava/lang/String;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$5 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.File file, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -1183,22 +1224,28 @@ class PDDocument extends _$jni.JObject { ///@param memUsageSetting defines how memory is used for buffering PDF streams ///@return loaded document ///@throws IOException in case of a file reading or parsing error - static PDDocument load$5( - _$jni.JObject file, - _$jni.JString password, - _$jni.JObject keyStore, - _$jni.JString alias, - _$jni.JObject memUsageSetting, + static PDDocument? load$5( + jni$_.JObject? file, + jni$_.JString? password, + jni$_.JObject? keyStore, + jni$_.JString? alias, + jni$_.JObject? memUsageSetting, ) { + final _$file = file?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$keyStore = keyStore?.reference ?? jni$_.jNullReference; + final _$alias = alias?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; return _load$5( _class.reference.pointer, - _id_load$5 as _$jni.JMethodIDPtr, - file.reference.pointer, - password.reference.pointer, - keyStore.reference.pointer, - alias.reference.pointer, - memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + _id_load$5 as jni$_.JMethodIDPtr, + _$file.pointer, + _$password.pointer, + _$keyStore.pointer, + _$alias.pointer, + _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$6 = _class.staticMethodId( @@ -1206,16 +1253,16 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/InputStream;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$6 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _load$6 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.InputStream input)` /// The returned object must be released after use, by calling the [release] method. @@ -1226,12 +1273,13 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the PDF required a non-empty password. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$6( - _$jni.JObject input, + static PDDocument? load$6( + jni$_.JObject? input, ) { - return _load$6(_class.reference.pointer, _id_load$6 as _$jni.JMethodIDPtr, - input.reference.pointer) - .object(const $PDDocument$Type()); + final _$input = input?.reference ?? jni$_.jNullReference; + return _load$6(_class.reference.pointer, _id_load$6 as jni$_.JMethodIDPtr, + _$input.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$7 = _class.staticMethodId( @@ -1239,22 +1287,22 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/InputStream;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$7 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$7 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.InputStream input, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -1266,13 +1314,16 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the PDF required a non-empty password. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$7( - _$jni.JObject input, - _$jni.JObject memUsageSetting, + static PDDocument? load$7( + jni$_.JObject? input, + jni$_.JObject? memUsageSetting, ) { - return _load$7(_class.reference.pointer, _id_load$7 as _$jni.JMethodIDPtr, - input.reference.pointer, memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + final _$input = input?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; + return _load$7(_class.reference.pointer, _id_load$7 as jni$_.JMethodIDPtr, + _$input.pointer, _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$8 = _class.staticMethodId( @@ -1280,22 +1331,22 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/InputStream;Ljava/lang/String;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$8 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$8 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.InputStream input, java.lang.String password)` /// The returned object must be released after use, by calling the [release] method. @@ -1307,13 +1358,15 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$8( - _$jni.JObject input, - _$jni.JString password, + static PDDocument? load$8( + jni$_.JObject? input, + jni$_.JString? password, ) { - return _load$8(_class.reference.pointer, _id_load$8 as _$jni.JMethodIDPtr, - input.reference.pointer, password.reference.pointer) - .object(const $PDDocument$Type()); + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + return _load$8(_class.reference.pointer, _id_load$8 as jni$_.JMethodIDPtr, + _$input.pointer, _$password.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$9 = _class.staticMethodId( @@ -1321,26 +1374,26 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/InputStream;Ljava/lang/String;Ljava/io/InputStream;Ljava/lang/String;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$9 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$9 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.InputStream input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias)` /// The returned object must be released after use, by calling the [release] method. @@ -1353,20 +1406,24 @@ class PDDocument extends _$jni.JObject { ///@param alias alias to be used for decryption when using public key security ///@return loaded document ///@throws IOException In case of a reading or parsing error. - static PDDocument load$9( - _$jni.JObject input, - _$jni.JString password, - _$jni.JObject keyStore, - _$jni.JString alias, + static PDDocument? load$9( + jni$_.JObject? input, + jni$_.JString? password, + jni$_.JObject? keyStore, + jni$_.JString? alias, ) { + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$keyStore = keyStore?.reference ?? jni$_.jNullReference; + final _$alias = alias?.reference ?? jni$_.jNullReference; return _load$9( _class.reference.pointer, - _id_load$9 as _$jni.JMethodIDPtr, - input.reference.pointer, - password.reference.pointer, - keyStore.reference.pointer, - alias.reference.pointer) - .object(const $PDDocument$Type()); + _id_load$9 as jni$_.JMethodIDPtr, + _$input.pointer, + _$password.pointer, + _$keyStore.pointer, + _$alias.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$10 = _class.staticMethodId( @@ -1374,24 +1431,24 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/InputStream;Ljava/lang/String;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$10 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$10 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.InputStream input, java.lang.String password, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -1404,18 +1461,18 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$10( - _$jni.JObject input, - _$jni.JString password, - _$jni.JObject memUsageSetting, + static PDDocument? load$10( + jni$_.JObject? input, + jni$_.JString? password, + jni$_.JObject? memUsageSetting, ) { - return _load$10( - _class.reference.pointer, - _id_load$10 as _$jni.JMethodIDPtr, - input.reference.pointer, - password.reference.pointer, - memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; + return _load$10(_class.reference.pointer, _id_load$10 as jni$_.JMethodIDPtr, + _$input.pointer, _$password.pointer, _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$11 = _class.staticMethodId( @@ -1423,28 +1480,28 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/InputStream;Ljava/lang/String;Ljava/io/InputStream;Ljava/lang/String;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$11 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$11 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(java.io.InputStream input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -1459,22 +1516,28 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$11( - _$jni.JObject input, - _$jni.JString password, - _$jni.JObject keyStore, - _$jni.JString alias, - _$jni.JObject memUsageSetting, + static PDDocument? load$11( + jni$_.JObject? input, + jni$_.JString? password, + jni$_.JObject? keyStore, + jni$_.JString? alias, + jni$_.JObject? memUsageSetting, ) { + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$keyStore = keyStore?.reference ?? jni$_.jNullReference; + final _$alias = alias?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; return _load$11( _class.reference.pointer, - _id_load$11 as _$jni.JMethodIDPtr, - input.reference.pointer, - password.reference.pointer, - keyStore.reference.pointer, - alias.reference.pointer, - memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + _id_load$11 as jni$_.JMethodIDPtr, + _$input.pointer, + _$password.pointer, + _$keyStore.pointer, + _$alias.pointer, + _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$12 = _class.staticMethodId( @@ -1482,16 +1545,16 @@ class PDDocument extends _$jni.JObject { r'([B)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$12 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _load$12 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(byte[] input)` /// The returned object must be released after use, by calling the [release] method. @@ -1501,12 +1564,13 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the PDF required a non-empty password. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$12( - _$jni.JArray<_$jni.jbyte> input, + static PDDocument? load$12( + jni$_.JByteArray? input, ) { - return _load$12(_class.reference.pointer, _id_load$12 as _$jni.JMethodIDPtr, - input.reference.pointer) - .object(const $PDDocument$Type()); + final _$input = input?.reference ?? jni$_.jNullReference; + return _load$12(_class.reference.pointer, _id_load$12 as jni$_.JMethodIDPtr, + _$input.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$13 = _class.staticMethodId( @@ -1514,22 +1578,22 @@ class PDDocument extends _$jni.JObject { r'([BLjava/lang/String;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$13 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$13 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(byte[] input, java.lang.String password)` /// The returned object must be released after use, by calling the [release] method. @@ -1540,13 +1604,15 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$13( - _$jni.JArray<_$jni.jbyte> input, - _$jni.JString password, + static PDDocument? load$13( + jni$_.JByteArray? input, + jni$_.JString? password, ) { - return _load$13(_class.reference.pointer, _id_load$13 as _$jni.JMethodIDPtr, - input.reference.pointer, password.reference.pointer) - .object(const $PDDocument$Type()); + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + return _load$13(_class.reference.pointer, _id_load$13 as jni$_.JMethodIDPtr, + _$input.pointer, _$password.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$14 = _class.staticMethodId( @@ -1554,26 +1620,26 @@ class PDDocument extends _$jni.JObject { r'([BLjava/lang/String;Ljava/io/InputStream;Ljava/lang/String;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$14 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$14 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(byte[] input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias)` /// The returned object must be released after use, by calling the [release] method. @@ -1586,20 +1652,24 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$14( - _$jni.JArray<_$jni.jbyte> input, - _$jni.JString password, - _$jni.JObject keyStore, - _$jni.JString alias, + static PDDocument? load$14( + jni$_.JByteArray? input, + jni$_.JString? password, + jni$_.JObject? keyStore, + jni$_.JString? alias, ) { + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$keyStore = keyStore?.reference ?? jni$_.jNullReference; + final _$alias = alias?.reference ?? jni$_.jNullReference; return _load$14( _class.reference.pointer, - _id_load$14 as _$jni.JMethodIDPtr, - input.reference.pointer, - password.reference.pointer, - keyStore.reference.pointer, - alias.reference.pointer) - .object(const $PDDocument$Type()); + _id_load$14 as jni$_.JMethodIDPtr, + _$input.pointer, + _$password.pointer, + _$keyStore.pointer, + _$alias.pointer) + .object(const $PDDocument$NullableType()); } static final _id_load$15 = _class.staticMethodId( @@ -1607,28 +1677,28 @@ class PDDocument extends _$jni.JObject { r'([BLjava/lang/String;Ljava/io/InputStream;Ljava/lang/String;Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/pdmodel/PDDocument;', ); - static final _load$15 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _load$15 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `static public org.apache.pdfbox.pdmodel.PDDocument load(byte[] input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, org.apache.pdfbox.io.MemoryUsageSetting memUsageSetting)` /// The returned object must be released after use, by calling the [release] method. @@ -1642,22 +1712,28 @@ class PDDocument extends _$jni.JObject { ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load$15( - _$jni.JArray<_$jni.jbyte> input, - _$jni.JString password, - _$jni.JObject keyStore, - _$jni.JString alias, - _$jni.JObject memUsageSetting, + static PDDocument? load$15( + jni$_.JByteArray? input, + jni$_.JString? password, + jni$_.JObject? keyStore, + jni$_.JString? alias, + jni$_.JObject? memUsageSetting, ) { + final _$input = input?.reference ?? jni$_.jNullReference; + final _$password = password?.reference ?? jni$_.jNullReference; + final _$keyStore = keyStore?.reference ?? jni$_.jNullReference; + final _$alias = alias?.reference ?? jni$_.jNullReference; + final _$memUsageSetting = + memUsageSetting?.reference ?? jni$_.jNullReference; return _load$15( _class.reference.pointer, - _id_load$15 as _$jni.JMethodIDPtr, - input.reference.pointer, - password.reference.pointer, - keyStore.reference.pointer, - alias.reference.pointer, - memUsageSetting.reference.pointer) - .object(const $PDDocument$Type()); + _id_load$15 as jni$_.JMethodIDPtr, + _$input.pointer, + _$password.pointer, + _$keyStore.pointer, + _$alias.pointer, + _$memUsageSetting.pointer) + .object(const $PDDocument$NullableType()); } static final _id_save = _class.instanceMethodId( @@ -1665,16 +1741,16 @@ class PDDocument extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _save = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _save = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void save(java.lang.String fileName)` /// @@ -1686,10 +1762,10 @@ class PDDocument extends _$jni.JObject { ///@param fileName The file to save as. ///@throws IOException if the output could not be written void save( - _$jni.JString fileName, + jni$_.JString? fileName, ) { - _save(reference.pointer, _id_save as _$jni.JMethodIDPtr, - fileName.reference.pointer) + final _$fileName = fileName?.reference ?? jni$_.jNullReference; + _save(reference.pointer, _id_save as jni$_.JMethodIDPtr, _$fileName.pointer) .check(); } @@ -1698,16 +1774,16 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/File;)V', ); - static final _save$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _save$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void save(java.io.File file)` /// @@ -1719,10 +1795,10 @@ class PDDocument extends _$jni.JObject { ///@param file The file to save as. ///@throws IOException if the output could not be written void save$1( - _$jni.JObject file, + jni$_.JObject? file, ) { - _save$1(reference.pointer, _id_save$1 as _$jni.JMethodIDPtr, - file.reference.pointer) + final _$file = file?.reference ?? jni$_.jNullReference; + _save$1(reference.pointer, _id_save$1 as jni$_.JMethodIDPtr, _$file.pointer) .check(); } @@ -1731,16 +1807,16 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/OutputStream;)V', ); - static final _save$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _save$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void save(java.io.OutputStream output)` /// @@ -1753,10 +1829,11 @@ class PDDocument extends _$jni.JObject { /// it in a java.io.BufferedOutputStream, unless it is already buffered. ///@throws IOException if the output could not be written void save$2( - _$jni.JObject output, + jni$_.JObject? output, ) { - _save$2(reference.pointer, _id_save$2 as _$jni.JMethodIDPtr, - output.reference.pointer) + final _$output = output?.reference ?? jni$_.jNullReference; + _save$2(reference.pointer, _id_save$2 as jni$_.JMethodIDPtr, + _$output.pointer) .check(); } @@ -1765,16 +1842,16 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/OutputStream;)V', ); - static final _saveIncremental = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _saveIncremental = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void saveIncremental(java.io.OutputStream output)` /// @@ -1792,10 +1869,11 @@ class PDDocument extends _$jni.JObject { ///@throws IOException if the output could not be written ///@throws IllegalStateException if the document was not loaded from a file or a stream. void saveIncremental( - _$jni.JObject output, + jni$_.JObject? output, ) { + final _$output = output?.reference ?? jni$_.jNullReference; _saveIncremental(reference.pointer, - _id_saveIncremental as _$jni.JMethodIDPtr, output.reference.pointer) + _id_saveIncremental as jni$_.JMethodIDPtr, _$output.pointer) .check(); } @@ -1804,22 +1882,22 @@ class PDDocument extends _$jni.JObject { r'(Ljava/io/OutputStream;Ljava/util/Set;)V', ); - static final _saveIncremental$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _saveIncremental$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void saveIncremental(java.io.OutputStream output, java.util.Set objectsToWrite)` /// @@ -1842,14 +1920,16 @@ class PDDocument extends _$jni.JObject { ///@throws IOException if the output could not be written ///@throws IllegalStateException if the document was not loaded from a file or a stream. void saveIncremental$1( - _$jni.JObject output, - _$jni.JSet<_$jni.JObject> objectsToWrite, + jni$_.JObject? output, + jni$_.JSet? objectsToWrite, ) { + final _$output = output?.reference ?? jni$_.jNullReference; + final _$objectsToWrite = objectsToWrite?.reference ?? jni$_.jNullReference; _saveIncremental$1( reference.pointer, - _id_saveIncremental$1 as _$jni.JMethodIDPtr, - output.reference.pointer, - objectsToWrite.reference.pointer) + _id_saveIncremental$1 as jni$_.JMethodIDPtr, + _$output.pointer, + _$objectsToWrite.pointer) .check(); } @@ -1859,16 +1939,16 @@ class PDDocument extends _$jni.JObject { ); static final _saveIncrementalForExternalSigning = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public org.apache.pdfbox.pdmodel.interactive.digitalsignature.ExternalSigningSupport saveIncrementalForExternalSigning(java.io.OutputStream output)` /// The returned object must be released after use, by calling the [release] method. @@ -1910,14 +1990,15 @@ class PDDocument extends _$jni.JObject { ///@throws IOException if the output could not be written ///@throws IllegalStateException if the document was not loaded from a file or a stream or /// signature options were not set. - _$jni.JObject saveIncrementalForExternalSigning( - _$jni.JObject output, + jni$_.JObject? saveIncrementalForExternalSigning( + jni$_.JObject? output, ) { + final _$output = output?.reference ?? jni$_.jNullReference; return _saveIncrementalForExternalSigning( reference.pointer, - _id_saveIncrementalForExternalSigning as _$jni.JMethodIDPtr, - output.reference.pointer) - .object(const _$jni.JObjectType()); + _id_saveIncrementalForExternalSigning as jni$_.JMethodIDPtr, + _$output.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_getPage = _class.instanceMethodId( @@ -1925,15 +2006,15 @@ class PDDocument extends _$jni.JObject { r'(I)Lorg/apache/pdfbox/pdmodel/PDPage;', ); - static final _getPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + static final _getPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public org.apache.pdfbox.pdmodel.PDPage getPage(int pageIndex)` /// The returned object must be released after use, by calling the [release] method. @@ -1945,12 +2026,12 @@ class PDDocument extends _$jni.JObject { /// PDDocument\#getPages() instead. ///@param pageIndex the 0-based page index ///@return the page at the given index. - _$jni.JObject getPage( + jni$_.JObject? getPage( int pageIndex, ) { return _getPage( - reference.pointer, _id_getPage as _$jni.JMethodIDPtr, pageIndex) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getPage as jni$_.JMethodIDPtr, pageIndex) + .object(const jni$_.JObjectNullableType()); } static final _id_getPages = _class.instanceMethodId( @@ -1958,16 +2039,16 @@ class PDDocument extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/PDPageTree;', ); - static final _getPages = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getPages = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.PDPageTree getPages()` @@ -1975,9 +2056,9 @@ class PDDocument extends _$jni.JObject { /// /// Returns the page tree. ///@return the page tree - _$jni.JObject getPages() { - return _getPages(reference.pointer, _id_getPages as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? getPages() { + return _getPages(reference.pointer, _id_getPages as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getNumberOfPages = _class.instanceMethodId( @@ -1985,16 +2066,16 @@ class PDDocument extends _$jni.JObject { r'()I', ); - static final _getNumberOfPages = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNumberOfPages = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getNumberOfPages()` @@ -2003,7 +2084,7 @@ class PDDocument extends _$jni.JObject { ///@return The total number of pages in the PDF document. int getNumberOfPages() { return _getNumberOfPages( - reference.pointer, _id_getNumberOfPages as _$jni.JMethodIDPtr) + reference.pointer, _id_getNumberOfPages as jni$_.JMethodIDPtr) .integer; } @@ -2012,16 +2093,16 @@ class PDDocument extends _$jni.JObject { r'()V', ); - static final _close = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _close = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void close()` @@ -2029,7 +2110,7 @@ class PDDocument extends _$jni.JObject { /// This will close the underlying COSDocument object. ///@throws IOException If there is an error releasing resources. void close() { - _close(reference.pointer, _id_close as _$jni.JMethodIDPtr).check(); + _close(reference.pointer, _id_close as jni$_.JMethodIDPtr).check(); } static final _id_protect = _class.instanceMethodId( @@ -2037,16 +2118,16 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/encryption/ProtectionPolicy;)V', ); - static final _protect = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _protect = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void protect(org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy policy)` /// @@ -2061,10 +2142,11 @@ class PDDocument extends _$jni.JObject { ///@param policy The protection policy. ///@throws IOException if there isn't any suitable security handler. void protect( - _$jni.JObject policy, + jni$_.JObject? policy, ) { - _protect(reference.pointer, _id_protect as _$jni.JMethodIDPtr, - policy.reference.pointer) + final _$policy = policy?.reference ?? jni$_.jNullReference; + _protect(reference.pointer, _id_protect as jni$_.JMethodIDPtr, + _$policy.pointer) .check(); } @@ -2074,16 +2156,16 @@ class PDDocument extends _$jni.JObject { ); static final _getCurrentAccessPermission = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.encryption.AccessPermission getCurrentAccessPermission()` @@ -2094,10 +2176,10 @@ class PDDocument extends _$jni.JObject { /// only mode so that permissions cannot be changed. Methods providing access to content should rely on this object /// to verify if the current user is allowed to proceed. ///@return the access permissions for the current user on the document. - _$jni.JObject getCurrentAccessPermission() { + jni$_.JObject? getCurrentAccessPermission() { return _getCurrentAccessPermission(reference.pointer, - _id_getCurrentAccessPermission as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_getCurrentAccessPermission as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_isAllSecurityToBeRemoved = _class.instanceMethodId( @@ -2105,16 +2187,16 @@ class PDDocument extends _$jni.JObject { r'()Z', ); - static final _isAllSecurityToBeRemoved = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isAllSecurityToBeRemoved = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isAllSecurityToBeRemoved()` @@ -2123,7 +2205,7 @@ class PDDocument extends _$jni.JObject { ///@return returns true if all security shall be removed otherwise false bool isAllSecurityToBeRemoved() { return _isAllSecurityToBeRemoved(reference.pointer, - _id_isAllSecurityToBeRemoved as _$jni.JMethodIDPtr) + _id_isAllSecurityToBeRemoved as jni$_.JMethodIDPtr) .boolean; } @@ -2132,15 +2214,15 @@ class PDDocument extends _$jni.JObject { r'(Z)V', ); - static final _setAllSecurityToBeRemoved = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setAllSecurityToBeRemoved = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setAllSecurityToBeRemoved(boolean removeAllSecurity)` /// @@ -2151,7 +2233,7 @@ class PDDocument extends _$jni.JObject { ) { _setAllSecurityToBeRemoved( reference.pointer, - _id_setAllSecurityToBeRemoved as _$jni.JMethodIDPtr, + _id_setAllSecurityToBeRemoved as jni$_.JMethodIDPtr, removeAllSecurity ? 1 : 0) .check(); } @@ -2161,16 +2243,16 @@ class PDDocument extends _$jni.JObject { r'()Ljava/lang/Long;', ); - static final _getDocumentId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDocumentId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Long getDocumentId()` @@ -2178,10 +2260,10 @@ class PDDocument extends _$jni.JObject { /// /// Provides the document ID. ///@return the document ID - _$jni.JLong getDocumentId() { + jni$_.JLong? getDocumentId() { return _getDocumentId( - reference.pointer, _id_getDocumentId as _$jni.JMethodIDPtr) - .object(const _$jni.JLongType()); + reference.pointer, _id_getDocumentId as jni$_.JMethodIDPtr) + .object(const jni$_.JLongNullableType()); } static final _id_setDocumentId = _class.instanceMethodId( @@ -2189,26 +2271,27 @@ class PDDocument extends _$jni.JObject { r'(Ljava/lang/Long;)V', ); - static final _setDocumentId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setDocumentId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setDocumentId(java.lang.Long docId)` /// /// Sets the document ID to the given value. ///@param docId the new document ID void setDocumentId( - _$jni.JLong docId, + jni$_.JLong? docId, ) { - _setDocumentId(reference.pointer, _id_setDocumentId as _$jni.JMethodIDPtr, - docId.reference.pointer) + final _$docId = docId?.reference ?? jni$_.jNullReference; + _setDocumentId(reference.pointer, _id_setDocumentId as jni$_.JMethodIDPtr, + _$docId.pointer) .check(); } @@ -2217,16 +2300,16 @@ class PDDocument extends _$jni.JObject { r'()F', ); - static final _getVersion = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getVersion = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getVersion()` @@ -2234,7 +2317,7 @@ class PDDocument extends _$jni.JObject { /// Returns the PDF specification version this document conforms to. ///@return the PDF version (e.g. 1.4f) double getVersion() { - return _getVersion(reference.pointer, _id_getVersion as _$jni.JMethodIDPtr) + return _getVersion(reference.pointer, _id_getVersion as jni$_.JMethodIDPtr) .float; } @@ -2243,15 +2326,15 @@ class PDDocument extends _$jni.JObject { r'(F)V', ); - static final _setVersion = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + static final _setVersion = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Double,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); /// from: `public void setVersion(float newVersion)` /// @@ -2261,7 +2344,7 @@ class PDDocument extends _$jni.JObject { double newVersion, ) { _setVersion( - reference.pointer, _id_setVersion as _$jni.JMethodIDPtr, newVersion) + reference.pointer, _id_setVersion as jni$_.JMethodIDPtr, newVersion) .check(); } @@ -2270,16 +2353,16 @@ class PDDocument extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/ResourceCache;', ); - static final _getResourceCache = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getResourceCache = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.ResourceCache getResourceCache()` @@ -2287,10 +2370,10 @@ class PDDocument extends _$jni.JObject { /// /// Returns the resource cache associated with this document, or null if there is none. ///@return the resource cache or null. - _$jni.JObject getResourceCache() { + jni$_.JObject? getResourceCache() { return _getResourceCache( - reference.pointer, _id_getResourceCache as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getResourceCache as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setResourceCache = _class.instanceMethodId( @@ -2298,57 +2381,99 @@ class PDDocument extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/ResourceCache;)V', ); - static final _setResourceCache = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setResourceCache = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setResourceCache(org.apache.pdfbox.pdmodel.ResourceCache resourceCache)` /// /// Sets the resource cache associated with this document. ///@param resourceCache A resource cache, or null. void setResourceCache( - _$jni.JObject resourceCache, + jni$_.JObject? resourceCache, ) { - _setResourceCache( - reference.pointer, - _id_setResourceCache as _$jni.JMethodIDPtr, - resourceCache.reference.pointer) + final _$resourceCache = resourceCache?.reference ?? jni$_.jNullReference; + _setResourceCache(reference.pointer, + _id_setResourceCache as jni$_.JMethodIDPtr, _$resourceCache.pointer) .check(); } } -final class $PDDocument$Type extends _$jni.JObjType { - @_$jni.internal - const $PDDocument$Type(); +final class $PDDocument$NullableType extends jni$_.JObjType { + @jni$_.internal + const $PDDocument$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lorg/apache/pdfbox/pdmodel/PDDocument;'; - @_$jni.internal - @_$core.override - PDDocument fromReference(_$jni.JReference reference) => - PDDocument.fromReference(reference); + @jni$_.internal + @core$_.override + PDDocument? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : PDDocument.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($PDDocument$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($PDDocument$NullableType) && + other is $PDDocument$NullableType; + } +} + +final class $PDDocument$Type extends jni$_.JObjType { + @jni$_.internal + const $PDDocument$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lorg/apache/pdfbox/pdmodel/PDDocument;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + PDDocument fromReference(jni$_.JReference reference) => + PDDocument.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $PDDocument$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($PDDocument$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($PDDocument$Type) && other is $PDDocument$Type; } diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart index ae30379a0..568c1f850 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart @@ -38,6 +38,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -47,10 +48,10 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `org.apache.pdfbox.pdmodel.PDDocumentInformation` /// @@ -59,36 +60,37 @@ import 'package:jni/jni.dart' as _$jni; /// method then it will clear the value. ///@author Ben Litchfield ///@author Gerardo Ortiz -class PDDocumentInformation extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class PDDocumentInformation extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal PDDocumentInformation.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'org/apache/pdfbox/pdmodel/PDDocumentInformation'); + jni$_.JClass.forName(r'org/apache/pdfbox/pdmodel/PDDocumentInformation'); /// The type which includes information such as the signature of this class. + static const nullableType = $PDDocumentInformation$NullableType(); static const type = $PDDocumentInformation$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` @@ -97,7 +99,7 @@ class PDDocumentInformation extends _$jni.JObject { /// Default Constructor. factory PDDocumentInformation() { return PDDocumentInformation.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -105,16 +107,16 @@ class PDDocumentInformation extends _$jni.JObject { r'(Lorg/apache/pdfbox/cos/COSDictionary;)V', ); - static final _new$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (org.apache.pdfbox.cos.COSDictionary dic)` /// The returned object must be released after use, by calling the [release] method. @@ -122,10 +124,11 @@ class PDDocumentInformation extends _$jni.JObject { /// Constructor that is used for a preexisting dictionary. ///@param dic The underlying dictionary. factory PDDocumentInformation.new$1( - _$jni.JObject dic, + jni$_.JObject? dic, ) { + final _$dic = dic?.reference ?? jni$_.jNullReference; return PDDocumentInformation.fromReference(_new$1(_class.reference.pointer, - _id_new$1 as _$jni.JMethodIDPtr, dic.reference.pointer) + _id_new$1 as jni$_.JMethodIDPtr, _$dic.pointer) .reference); } @@ -134,16 +137,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Lorg/apache/pdfbox/cos/COSDictionary;', ); - static final _getCOSObject = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCOSObject = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.cos.COSDictionary getCOSObject()` @@ -151,10 +154,10 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the underlying dictionary that this object wraps. ///@return The underlying info dictionary. - _$jni.JObject getCOSObject() { + jni$_.JObject? getCOSObject() { return _getCOSObject( - reference.pointer, _id_getCOSObject as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getCOSObject as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getPropertyStringValue = _class.instanceMethodId( @@ -162,16 +165,16 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)Ljava/lang/Object;', ); - static final _getPropertyStringValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getPropertyStringValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.lang.Object getPropertyStringValue(java.lang.String propertyKey)` /// The returned object must be released after use, by calling the [release] method. @@ -184,14 +187,15 @@ class PDDocumentInformation extends _$jni.JObject { /// ///@param propertyKey the dictionaries key ///@return the properties value - _$jni.JObject getPropertyStringValue( - _$jni.JString propertyKey, + jni$_.JObject? getPropertyStringValue( + jni$_.JString? propertyKey, ) { + final _$propertyKey = propertyKey?.reference ?? jni$_.jNullReference; return _getPropertyStringValue( reference.pointer, - _id_getPropertyStringValue as _$jni.JMethodIDPtr, - propertyKey.reference.pointer) - .object(const _$jni.JObjectType()); + _id_getPropertyStringValue as jni$_.JMethodIDPtr, + _$propertyKey.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_getTitle = _class.instanceMethodId( @@ -199,16 +203,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getTitle = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTitle = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getTitle()` @@ -216,9 +220,9 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the title of the document. This will return null if no title exists. ///@return The title of the document. - _$jni.JString getTitle() { - return _getTitle(reference.pointer, _id_getTitle as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getTitle() { + return _getTitle(reference.pointer, _id_getTitle as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setTitle = _class.instanceMethodId( @@ -226,26 +230,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setTitle = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setTitle = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setTitle(java.lang.String title)` /// /// This will set the title of the document. ///@param title The new title for the document. void setTitle( - _$jni.JString title, + jni$_.JString? title, ) { - _setTitle(reference.pointer, _id_setTitle as _$jni.JMethodIDPtr, - title.reference.pointer) + final _$title = title?.reference ?? jni$_.jNullReference; + _setTitle(reference.pointer, _id_setTitle as jni$_.JMethodIDPtr, + _$title.pointer) .check(); } @@ -254,16 +259,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getAuthor = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getAuthor = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getAuthor()` @@ -271,9 +276,9 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the author of the document. This will return null if no author exists. ///@return The author of the document. - _$jni.JString getAuthor() { - return _getAuthor(reference.pointer, _id_getAuthor as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getAuthor() { + return _getAuthor(reference.pointer, _id_getAuthor as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setAuthor = _class.instanceMethodId( @@ -281,26 +286,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setAuthor = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setAuthor = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setAuthor(java.lang.String author)` /// /// This will set the author of the document. ///@param author The new author for the document. void setAuthor( - _$jni.JString author, + jni$_.JString? author, ) { - _setAuthor(reference.pointer, _id_setAuthor as _$jni.JMethodIDPtr, - author.reference.pointer) + final _$author = author?.reference ?? jni$_.jNullReference; + _setAuthor(reference.pointer, _id_setAuthor as jni$_.JMethodIDPtr, + _$author.pointer) .check(); } @@ -309,16 +315,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getSubject = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSubject = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getSubject()` @@ -326,9 +332,9 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the subject of the document. This will return null if no subject exists. ///@return The subject of the document. - _$jni.JString getSubject() { - return _getSubject(reference.pointer, _id_getSubject as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getSubject() { + return _getSubject(reference.pointer, _id_getSubject as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setSubject = _class.instanceMethodId( @@ -336,26 +342,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setSubject = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setSubject = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setSubject(java.lang.String subject)` /// /// This will set the subject of the document. ///@param subject The new subject for the document. void setSubject( - _$jni.JString subject, + jni$_.JString? subject, ) { - _setSubject(reference.pointer, _id_setSubject as _$jni.JMethodIDPtr, - subject.reference.pointer) + final _$subject = subject?.reference ?? jni$_.jNullReference; + _setSubject(reference.pointer, _id_setSubject as jni$_.JMethodIDPtr, + _$subject.pointer) .check(); } @@ -364,16 +371,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getKeywords = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getKeywords = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getKeywords()` @@ -381,10 +388,10 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the keywords of the document. This will return null if no keywords exists. ///@return The keywords of the document. - _$jni.JString getKeywords() { + jni$_.JString? getKeywords() { return _getKeywords( - reference.pointer, _id_getKeywords as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getKeywords as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setKeywords = _class.instanceMethodId( @@ -392,26 +399,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setKeywords = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setKeywords = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setKeywords(java.lang.String keywords)` /// /// This will set the keywords of the document. ///@param keywords The new keywords for the document. void setKeywords( - _$jni.JString keywords, + jni$_.JString? keywords, ) { - _setKeywords(reference.pointer, _id_setKeywords as _$jni.JMethodIDPtr, - keywords.reference.pointer) + final _$keywords = keywords?.reference ?? jni$_.jNullReference; + _setKeywords(reference.pointer, _id_setKeywords as jni$_.JMethodIDPtr, + _$keywords.pointer) .check(); } @@ -420,16 +428,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getCreator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCreator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getCreator()` @@ -437,9 +445,9 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the creator of the document. This will return null if no creator exists. ///@return The creator of the document. - _$jni.JString getCreator() { - return _getCreator(reference.pointer, _id_getCreator as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getCreator() { + return _getCreator(reference.pointer, _id_getCreator as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setCreator = _class.instanceMethodId( @@ -447,26 +455,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setCreator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCreator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setCreator(java.lang.String creator)` /// /// This will set the creator of the document. ///@param creator The new creator for the document. void setCreator( - _$jni.JString creator, + jni$_.JString? creator, ) { - _setCreator(reference.pointer, _id_setCreator as _$jni.JMethodIDPtr, - creator.reference.pointer) + final _$creator = creator?.reference ?? jni$_.jNullReference; + _setCreator(reference.pointer, _id_setCreator as jni$_.JMethodIDPtr, + _$creator.pointer) .check(); } @@ -475,16 +484,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getProducer = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getProducer = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getProducer()` @@ -492,10 +501,10 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the producer of the document. This will return null if no producer exists. ///@return The producer of the document. - _$jni.JString getProducer() { + jni$_.JString? getProducer() { return _getProducer( - reference.pointer, _id_getProducer as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getProducer as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setProducer = _class.instanceMethodId( @@ -503,26 +512,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setProducer = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setProducer = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setProducer(java.lang.String producer)` /// /// This will set the producer of the document. ///@param producer The new producer for the document. void setProducer( - _$jni.JString producer, + jni$_.JString? producer, ) { - _setProducer(reference.pointer, _id_setProducer as _$jni.JMethodIDPtr, - producer.reference.pointer) + final _$producer = producer?.reference ?? jni$_.jNullReference; + _setProducer(reference.pointer, _id_setProducer as jni$_.JMethodIDPtr, + _$producer.pointer) .check(); } @@ -531,16 +541,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/util/Calendar;', ); - static final _getCreationDate = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCreationDate = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Calendar getCreationDate()` @@ -548,10 +558,10 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the creation date of the document. This will return null if no creation date exists. ///@return The creation date of the document. - _$jni.JObject getCreationDate() { + jni$_.JObject? getCreationDate() { return _getCreationDate( - reference.pointer, _id_getCreationDate as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getCreationDate as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setCreationDate = _class.instanceMethodId( @@ -559,26 +569,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/util/Calendar;)V', ); - static final _setCreationDate = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCreationDate = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setCreationDate(java.util.Calendar date)` /// /// This will set the creation date of the document. ///@param date The new creation date for the document. void setCreationDate( - _$jni.JObject date, + jni$_.JObject? date, ) { + final _$date = date?.reference ?? jni$_.jNullReference; _setCreationDate(reference.pointer, - _id_setCreationDate as _$jni.JMethodIDPtr, date.reference.pointer) + _id_setCreationDate as jni$_.JMethodIDPtr, _$date.pointer) .check(); } @@ -587,16 +598,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/util/Calendar;', ); - static final _getModificationDate = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getModificationDate = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Calendar getModificationDate()` @@ -604,10 +615,10 @@ class PDDocumentInformation extends _$jni.JObject { /// /// This will get the modification date of the document. This will return null if no modification date exists. ///@return The modification date of the document. - _$jni.JObject getModificationDate() { + jni$_.JObject? getModificationDate() { return _getModificationDate( - reference.pointer, _id_getModificationDate as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getModificationDate as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setModificationDate = _class.instanceMethodId( @@ -615,28 +626,27 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/util/Calendar;)V', ); - static final _setModificationDate = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setModificationDate = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setModificationDate(java.util.Calendar date)` /// /// This will set the modification date of the document. ///@param date The new modification date for the document. void setModificationDate( - _$jni.JObject date, + jni$_.JObject? date, ) { - _setModificationDate( - reference.pointer, - _id_setModificationDate as _$jni.JMethodIDPtr, - date.reference.pointer) + final _$date = date?.reference ?? jni$_.jNullReference; + _setModificationDate(reference.pointer, + _id_setModificationDate as jni$_.JMethodIDPtr, _$date.pointer) .check(); } @@ -645,16 +655,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getTrapped = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTrapped = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getTrapped()` @@ -663,9 +673,9 @@ class PDDocumentInformation extends _$jni.JObject { /// This will get the trapped value for the document. /// This will return null if one is not found. ///@return The trapped value for the document. - _$jni.JString getTrapped() { - return _getTrapped(reference.pointer, _id_getTrapped as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getTrapped() { + return _getTrapped(reference.pointer, _id_getTrapped as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getMetadataKeys = _class.instanceMethodId( @@ -673,16 +683,16 @@ class PDDocumentInformation extends _$jni.JObject { r'()Ljava/util/Set;', ); - static final _getMetadataKeys = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getMetadataKeys = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Set getMetadataKeys()` @@ -691,10 +701,12 @@ class PDDocumentInformation extends _$jni.JObject { /// This will get the keys of all metadata information fields for the document. ///@return all metadata key strings. ///@since Apache PDFBox 1.3.0 - _$jni.JSet<_$jni.JString> getMetadataKeys() { + jni$_.JSet? getMetadataKeys() { return _getMetadataKeys( - reference.pointer, _id_getMetadataKeys as _$jni.JMethodIDPtr) - .object(const _$jni.JSetType(_$jni.JStringType())); + reference.pointer, _id_getMetadataKeys as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JSetNullableType( + jni$_.JStringNullableType())); } static final _id_getCustomMetadataValue = _class.instanceMethodId( @@ -702,16 +714,16 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)Ljava/lang/String;', ); - static final _getCustomMetadataValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getCustomMetadataValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.lang.String getCustomMetadataValue(java.lang.String fieldName)` /// The returned object must be released after use, by calling the [release] method. @@ -720,14 +732,15 @@ class PDDocumentInformation extends _$jni.JObject { /// This will return null if one is not found. ///@param fieldName Name of custom metadata field from pdf document. ///@return String Value of metadata field - _$jni.JString getCustomMetadataValue( - _$jni.JString fieldName, + jni$_.JString? getCustomMetadataValue( + jni$_.JString? fieldName, ) { + final _$fieldName = fieldName?.reference ?? jni$_.jNullReference; return _getCustomMetadataValue( reference.pointer, - _id_getCustomMetadataValue as _$jni.JMethodIDPtr, - fieldName.reference.pointer) - .object(const _$jni.JStringType()); + _id_getCustomMetadataValue as jni$_.JMethodIDPtr, + _$fieldName.pointer) + .object(const jni$_.JStringNullableType()); } static final _id_setCustomMetadataValue = _class.instanceMethodId( @@ -735,22 +748,22 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;Ljava/lang/String;)V', ); - static final _setCustomMetadataValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _setCustomMetadataValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void setCustomMetadataValue(java.lang.String fieldName, java.lang.String fieldValue)` /// @@ -758,14 +771,16 @@ class PDDocumentInformation extends _$jni.JObject { ///@param fieldName The name of the custom metadata field. ///@param fieldValue The value to the custom metadata field. void setCustomMetadataValue( - _$jni.JString fieldName, - _$jni.JString fieldValue, + jni$_.JString? fieldName, + jni$_.JString? fieldValue, ) { + final _$fieldName = fieldName?.reference ?? jni$_.jNullReference; + final _$fieldValue = fieldValue?.reference ?? jni$_.jNullReference; _setCustomMetadataValue( reference.pointer, - _id_setCustomMetadataValue as _$jni.JMethodIDPtr, - fieldName.reference.pointer, - fieldValue.reference.pointer) + _id_setCustomMetadataValue as jni$_.JMethodIDPtr, + _$fieldName.pointer, + _$fieldValue.pointer) .check(); } @@ -774,16 +789,16 @@ class PDDocumentInformation extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setTrapped = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setTrapped = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setTrapped(java.lang.String value)` /// @@ -792,40 +807,86 @@ class PDDocumentInformation extends _$jni.JObject { ///@param value The new trapped value for the document. ///@throws IllegalArgumentException if the parameter is invalid. void setTrapped( - _$jni.JString value, + jni$_.JString? value, ) { - _setTrapped(reference.pointer, _id_setTrapped as _$jni.JMethodIDPtr, - value.reference.pointer) + final _$value = value?.reference ?? jni$_.jNullReference; + _setTrapped(reference.pointer, _id_setTrapped as jni$_.JMethodIDPtr, + _$value.pointer) .check(); } } -final class $PDDocumentInformation$Type - extends _$jni.JObjType { - @_$jni.internal - const $PDDocumentInformation$Type(); +final class $PDDocumentInformation$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $PDDocumentInformation$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lorg/apache/pdfbox/pdmodel/PDDocumentInformation;'; - @_$jni.internal - @_$core.override - PDDocumentInformation fromReference(_$jni.JReference reference) => - PDDocumentInformation.fromReference(reference); + @jni$_.internal + @core$_.override + PDDocumentInformation? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : PDDocumentInformation.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => ($PDDocumentInformation$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($PDDocumentInformation$NullableType) && + other is $PDDocumentInformation$NullableType; + } +} + +final class $PDDocumentInformation$Type + extends jni$_.JObjType { + @jni$_.internal + const $PDDocumentInformation$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lorg/apache/pdfbox/pdmodel/PDDocumentInformation;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + PDDocumentInformation fromReference(jni$_.JReference reference) => + PDDocumentInformation.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $PDDocumentInformation$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($PDDocumentInformation$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($PDDocumentInformation$Type) && other is $PDDocumentInformation$Type; diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart index 134b0cc16..929c1b63c 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart @@ -38,6 +38,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -47,12 +48,12 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; -import '../pdmodel/PDDocument.dart' as pddocument_; +import '../pdmodel/PDDocument.dart' as pddocument$_; /// from: `org.apache.pdfbox.text.PDFTextStripper` /// @@ -63,36 +64,37 @@ import '../pdmodel/PDDocument.dart' as pddocument_; /// The basic flow of this process is that we get a document and use a series of processXXX() functions that work on /// smaller and smaller chunks of the page. Eventually, we fully process each page and then print it. ///@author Ben Litchfield -class PDFTextStripper extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class PDFTextStripper extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal PDFTextStripper.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'org/apache/pdfbox/text/PDFTextStripper'); + jni$_.JClass.forName(r'org/apache/pdfbox/text/PDFTextStripper'); /// The type which includes information such as the signature of this class. + static const nullableType = $PDFTextStripper$NullableType(); static const type = $PDFTextStripper$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` @@ -102,7 +104,7 @@ class PDFTextStripper extends _$jni.JObject { ///@throws IOException If there is an error loading the properties. factory PDFTextStripper() { return PDFTextStripper.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -111,16 +113,16 @@ class PDFTextStripper extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDDocument;)Ljava/lang/String;', ); - static final _getText = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getText = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.lang.String getText(org.apache.pdfbox.pdmodel.PDDocument doc)` /// The returned object must be released after use, by calling the [release] method. @@ -135,12 +137,13 @@ class PDFTextStripper extends _$jni.JObject { ///@param doc The document to get the text from. ///@return The text of the PDF document. ///@throws IOException if the doc state is invalid or it is encrypted. - _$jni.JString getText( - pddocument_.PDDocument doc, + jni$_.JString? getText( + pddocument$_.PDDocument? doc, ) { - return _getText(reference.pointer, _id_getText as _$jni.JMethodIDPtr, - doc.reference.pointer) - .object(const _$jni.JStringType()); + final _$doc = doc?.reference ?? jni$_.jNullReference; + return _getText( + reference.pointer, _id_getText as jni$_.JMethodIDPtr, _$doc.pointer) + .object(const jni$_.JStringNullableType()); } static final _id_writeText = _class.instanceMethodId( @@ -148,22 +151,22 @@ class PDFTextStripper extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDDocument;Ljava/io/Writer;)V', ); - static final _writeText = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _writeText = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void writeText(org.apache.pdfbox.pdmodel.PDDocument doc, java.io.Writer outputStream)` /// @@ -172,11 +175,13 @@ class PDFTextStripper extends _$jni.JObject { ///@param outputStream The location to put the text. ///@throws IOException If the doc is in an invalid state. void writeText( - pddocument_.PDDocument doc, - _$jni.JObject outputStream, + pddocument$_.PDDocument? doc, + jni$_.JObject? outputStream, ) { - _writeText(reference.pointer, _id_writeText as _$jni.JMethodIDPtr, - doc.reference.pointer, outputStream.reference.pointer) + final _$doc = doc?.reference ?? jni$_.jNullReference; + final _$outputStream = outputStream?.reference ?? jni$_.jNullReference; + _writeText(reference.pointer, _id_writeText as jni$_.JMethodIDPtr, + _$doc.pointer, _$outputStream.pointer) .check(); } @@ -185,16 +190,16 @@ class PDFTextStripper extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/PDPage;)V', ); - static final _processPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _processPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void processPage(org.apache.pdfbox.pdmodel.PDPage page)` /// @@ -202,10 +207,11 @@ class PDFTextStripper extends _$jni.JObject { ///@param page The page to process. ///@throws IOException If there is an error processing the page. void processPage( - _$jni.JObject page, + jni$_.JObject? page, ) { - _processPage(reference.pointer, _id_processPage as _$jni.JMethodIDPtr, - page.reference.pointer) + final _$page = page?.reference ?? jni$_.jNullReference; + _processPage(reference.pointer, _id_processPage as jni$_.JMethodIDPtr, + _$page.pointer) .check(); } @@ -214,16 +220,16 @@ class PDFTextStripper extends _$jni.JObject { r'()I', ); - static final _getStartPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getStartPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getStartPage()` @@ -234,7 +240,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return Value of property startPage. int getStartPage() { return _getStartPage( - reference.pointer, _id_getStartPage as _$jni.JMethodIDPtr) + reference.pointer, _id_getStartPage as jni$_.JMethodIDPtr) .integer; } @@ -243,15 +249,15 @@ class PDFTextStripper extends _$jni.JObject { r'(I)V', ); - static final _setStartPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setStartPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setStartPage(int startPageValue)` /// @@ -260,7 +266,7 @@ class PDFTextStripper extends _$jni.JObject { void setStartPage( int startPageValue, ) { - _setStartPage(reference.pointer, _id_setStartPage as _$jni.JMethodIDPtr, + _setStartPage(reference.pointer, _id_setStartPage as jni$_.JMethodIDPtr, startPageValue) .check(); } @@ -270,16 +276,16 @@ class PDFTextStripper extends _$jni.JObject { r'()I', ); - static final _getEndPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getEndPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getEndPage()` @@ -289,7 +295,7 @@ class PDFTextStripper extends _$jni.JObject { /// Integer.MAX_VALUE such that all pages of the pdf will be extracted. ///@return Value of property endPage. int getEndPage() { - return _getEndPage(reference.pointer, _id_getEndPage as _$jni.JMethodIDPtr) + return _getEndPage(reference.pointer, _id_getEndPage as jni$_.JMethodIDPtr) .integer; } @@ -298,15 +304,15 @@ class PDFTextStripper extends _$jni.JObject { r'(I)V', ); - static final _setEndPage = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setEndPage = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setEndPage(int endPageValue)` /// @@ -315,7 +321,7 @@ class PDFTextStripper extends _$jni.JObject { void setEndPage( int endPageValue, ) { - _setEndPage(reference.pointer, _id_setEndPage as _$jni.JMethodIDPtr, + _setEndPage(reference.pointer, _id_setEndPage as jni$_.JMethodIDPtr, endPageValue) .check(); } @@ -325,16 +331,16 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setLineSeparator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setLineSeparator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setLineSeparator(java.lang.String separator)` /// @@ -342,12 +348,11 @@ class PDFTextStripper extends _$jni.JObject { /// preference is not set explicitly using this method. ///@param separator The desired line separator string. void setLineSeparator( - _$jni.JString separator, + jni$_.JString? separator, ) { - _setLineSeparator( - reference.pointer, - _id_setLineSeparator as _$jni.JMethodIDPtr, - separator.reference.pointer) + final _$separator = separator?.reference ?? jni$_.jNullReference; + _setLineSeparator(reference.pointer, + _id_setLineSeparator as jni$_.JMethodIDPtr, _$separator.pointer) .check(); } @@ -356,16 +361,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getLineSeparator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getLineSeparator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getLineSeparator()` @@ -373,10 +378,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// This will get the line separator. ///@return The desired line separator string. - _$jni.JString getLineSeparator() { + jni$_.JString? getLineSeparator() { return _getLineSeparator( - reference.pointer, _id_getLineSeparator as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getLineSeparator as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getWordSeparator = _class.instanceMethodId( @@ -384,16 +389,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getWordSeparator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getWordSeparator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getWordSeparator()` @@ -401,10 +406,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// This will get the word separator. ///@return The desired word separator string. - _$jni.JString getWordSeparator() { + jni$_.JString? getWordSeparator() { return _getWordSeparator( - reference.pointer, _id_getWordSeparator as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getWordSeparator as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setWordSeparator = _class.instanceMethodId( @@ -412,16 +417,16 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setWordSeparator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setWordSeparator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setWordSeparator(java.lang.String separator)` /// @@ -431,12 +436,11 @@ class PDFTextStripper extends _$jni.JObject { /// the empty string. ///@param separator The desired page separator string. void setWordSeparator( - _$jni.JString separator, + jni$_.JString? separator, ) { - _setWordSeparator( - reference.pointer, - _id_setWordSeparator as _$jni.JMethodIDPtr, - separator.reference.pointer) + final _$separator = separator?.reference ?? jni$_.jNullReference; + _setWordSeparator(reference.pointer, + _id_setWordSeparator as jni$_.JMethodIDPtr, _$separator.pointer) .check(); } @@ -447,16 +451,16 @@ class PDFTextStripper extends _$jni.JObject { ); static final _getSuppressDuplicateOverlappingText = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getSuppressDuplicateOverlappingText()` @@ -464,7 +468,7 @@ class PDFTextStripper extends _$jni.JObject { /// @return Returns the suppressDuplicateOverlappingText. bool getSuppressDuplicateOverlappingText() { return _getSuppressDuplicateOverlappingText(reference.pointer, - _id_getSuppressDuplicateOverlappingText as _$jni.JMethodIDPtr) + _id_getSuppressDuplicateOverlappingText as jni$_.JMethodIDPtr) .boolean; } @@ -475,14 +479,14 @@ class PDFTextStripper extends _$jni.JObject { ); static final _setSuppressDuplicateOverlappingText = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setSuppressDuplicateOverlappingText(boolean suppressDuplicateOverlappingTextValue)` /// @@ -495,7 +499,7 @@ class PDFTextStripper extends _$jni.JObject { ) { _setSuppressDuplicateOverlappingText( reference.pointer, - _id_setSuppressDuplicateOverlappingText as _$jni.JMethodIDPtr, + _id_setSuppressDuplicateOverlappingText as jni$_.JMethodIDPtr, suppressDuplicateOverlappingTextValue ? 1 : 0) .check(); } @@ -505,16 +509,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Z', ); - static final _getSeparateByBeads = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSeparateByBeads = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getSeparateByBeads()` @@ -523,7 +527,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return If the text will be grouped by beads. bool getSeparateByBeads() { return _getSeparateByBeads( - reference.pointer, _id_getSeparateByBeads as _$jni.JMethodIDPtr) + reference.pointer, _id_getSeparateByBeads as jni$_.JMethodIDPtr) .boolean; } @@ -532,15 +536,15 @@ class PDFTextStripper extends _$jni.JObject { r'(Z)V', ); - static final _setShouldSeparateByBeads = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setShouldSeparateByBeads = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setShouldSeparateByBeads(boolean aShouldSeparateByBeads)` /// @@ -551,7 +555,7 @@ class PDFTextStripper extends _$jni.JObject { ) { _setShouldSeparateByBeads( reference.pointer, - _id_setShouldSeparateByBeads as _$jni.JMethodIDPtr, + _id_setShouldSeparateByBeads as jni$_.JMethodIDPtr, aShouldSeparateByBeads ? 1 : 0) .check(); } @@ -561,16 +565,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem;', ); - static final _getEndBookmark = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getEndBookmark = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem getEndBookmark()` @@ -578,10 +582,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Get the bookmark where text extraction should end, inclusive. Default is null. ///@return The ending bookmark. - _$jni.JObject getEndBookmark() { + jni$_.JObject? getEndBookmark() { return _getEndBookmark( - reference.pointer, _id_getEndBookmark as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getEndBookmark as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setEndBookmark = _class.instanceMethodId( @@ -589,26 +593,27 @@ class PDFTextStripper extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem;)V', ); - static final _setEndBookmark = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setEndBookmark = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setEndBookmark(org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem aEndBookmark)` /// /// Set the bookmark where the text extraction should stop. ///@param aEndBookmark The ending bookmark. void setEndBookmark( - _$jni.JObject aEndBookmark, + jni$_.JObject? aEndBookmark, ) { - _setEndBookmark(reference.pointer, _id_setEndBookmark as _$jni.JMethodIDPtr, - aEndBookmark.reference.pointer) + final _$aEndBookmark = aEndBookmark?.reference ?? jni$_.jNullReference; + _setEndBookmark(reference.pointer, _id_setEndBookmark as jni$_.JMethodIDPtr, + _$aEndBookmark.pointer) .check(); } @@ -617,16 +622,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Lorg/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem;', ); - static final _getStartBookmark = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getStartBookmark = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem getStartBookmark()` @@ -634,10 +639,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Get the bookmark where text extraction should start, inclusive. Default is null. ///@return The starting bookmark. - _$jni.JObject getStartBookmark() { + jni$_.JObject? getStartBookmark() { return _getStartBookmark( - reference.pointer, _id_getStartBookmark as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getStartBookmark as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setStartBookmark = _class.instanceMethodId( @@ -645,28 +650,29 @@ class PDFTextStripper extends _$jni.JObject { r'(Lorg/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem;)V', ); - static final _setStartBookmark = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setStartBookmark = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setStartBookmark(org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem aStartBookmark)` /// /// Set the bookmark where text extraction should start, inclusive. ///@param aStartBookmark The starting bookmark. void setStartBookmark( - _$jni.JObject aStartBookmark, + jni$_.JObject? aStartBookmark, ) { + final _$aStartBookmark = aStartBookmark?.reference ?? jni$_.jNullReference; _setStartBookmark( reference.pointer, - _id_setStartBookmark as _$jni.JMethodIDPtr, - aStartBookmark.reference.pointer) + _id_setStartBookmark as jni$_.JMethodIDPtr, + _$aStartBookmark.pointer) .check(); } @@ -675,16 +681,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Z', ); - static final _getAddMoreFormatting = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getAddMoreFormatting = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getAddMoreFormatting()` @@ -693,7 +699,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return true if some more text formatting will be added bool getAddMoreFormatting() { return _getAddMoreFormatting( - reference.pointer, _id_getAddMoreFormatting as _$jni.JMethodIDPtr) + reference.pointer, _id_getAddMoreFormatting as jni$_.JMethodIDPtr) .boolean; } @@ -702,15 +708,15 @@ class PDFTextStripper extends _$jni.JObject { r'(Z)V', ); - static final _setAddMoreFormatting = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setAddMoreFormatting = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setAddMoreFormatting(boolean newAddMoreFormatting)` /// @@ -721,7 +727,7 @@ class PDFTextStripper extends _$jni.JObject { ) { _setAddMoreFormatting( reference.pointer, - _id_setAddMoreFormatting as _$jni.JMethodIDPtr, + _id_setAddMoreFormatting as jni$_.JMethodIDPtr, newAddMoreFormatting ? 1 : 0) .check(); } @@ -731,16 +737,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Z', ); - static final _getSortByPosition = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSortByPosition = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getSortByPosition()` @@ -749,7 +755,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return true If the text tokens will be sorted before being written. bool getSortByPosition() { return _getSortByPosition( - reference.pointer, _id_getSortByPosition as _$jni.JMethodIDPtr) + reference.pointer, _id_getSortByPosition as jni$_.JMethodIDPtr) .boolean; } @@ -758,15 +764,15 @@ class PDFTextStripper extends _$jni.JObject { r'(Z)V', ); - static final _setSortByPosition = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setSortByPosition = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public void setSortByPosition(boolean newSortByPosition)` /// @@ -783,7 +789,7 @@ class PDFTextStripper extends _$jni.JObject { ) { _setSortByPosition( reference.pointer, - _id_setSortByPosition as _$jni.JMethodIDPtr, + _id_setSortByPosition as jni$_.JMethodIDPtr, newSortByPosition ? 1 : 0) .check(); } @@ -793,16 +799,16 @@ class PDFTextStripper extends _$jni.JObject { r'()F', ); - static final _getSpacingTolerance = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSpacingTolerance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getSpacingTolerance()` @@ -812,7 +818,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return The current tolerance / scaling factor double getSpacingTolerance() { return _getSpacingTolerance( - reference.pointer, _id_getSpacingTolerance as _$jni.JMethodIDPtr) + reference.pointer, _id_getSpacingTolerance as jni$_.JMethodIDPtr) .float; } @@ -821,15 +827,15 @@ class PDFTextStripper extends _$jni.JObject { r'(F)V', ); - static final _setSpacingTolerance = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + static final _setSpacingTolerance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Double,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); /// from: `public void setSpacingTolerance(float spacingToleranceValue)` /// @@ -842,7 +848,7 @@ class PDFTextStripper extends _$jni.JObject { ) { _setSpacingTolerance( reference.pointer, - _id_setSpacingTolerance as _$jni.JMethodIDPtr, + _id_setSpacingTolerance as jni$_.JMethodIDPtr, spacingToleranceValue) .check(); } @@ -852,16 +858,16 @@ class PDFTextStripper extends _$jni.JObject { r'()F', ); - static final _getAverageCharTolerance = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getAverageCharTolerance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getAverageCharTolerance()` @@ -871,7 +877,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return The current tolerance / scaling factor double getAverageCharTolerance() { return _getAverageCharTolerance(reference.pointer, - _id_getAverageCharTolerance as _$jni.JMethodIDPtr) + _id_getAverageCharTolerance as jni$_.JMethodIDPtr) .float; } @@ -880,15 +886,15 @@ class PDFTextStripper extends _$jni.JObject { r'(F)V', ); - static final _setAverageCharTolerance = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + static final _setAverageCharTolerance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Double,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); /// from: `public void setAverageCharTolerance(float averageCharToleranceValue)` /// @@ -901,7 +907,7 @@ class PDFTextStripper extends _$jni.JObject { ) { _setAverageCharTolerance( reference.pointer, - _id_setAverageCharTolerance as _$jni.JMethodIDPtr, + _id_setAverageCharTolerance as jni$_.JMethodIDPtr, averageCharToleranceValue) .check(); } @@ -911,16 +917,16 @@ class PDFTextStripper extends _$jni.JObject { r'()F', ); - static final _getIndentThreshold = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getIndentThreshold = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getIndentThreshold()` @@ -930,7 +936,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return the number of whitespace character widths to use when detecting paragraph indents. double getIndentThreshold() { return _getIndentThreshold( - reference.pointer, _id_getIndentThreshold as _$jni.JMethodIDPtr) + reference.pointer, _id_getIndentThreshold as jni$_.JMethodIDPtr) .float; } @@ -939,15 +945,15 @@ class PDFTextStripper extends _$jni.JObject { r'(F)V', ); - static final _setIndentThreshold = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + static final _setIndentThreshold = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Double,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); /// from: `public void setIndentThreshold(float indentThresholdValue)` /// @@ -959,7 +965,7 @@ class PDFTextStripper extends _$jni.JObject { double indentThresholdValue, ) { _setIndentThreshold(reference.pointer, - _id_setIndentThreshold as _$jni.JMethodIDPtr, indentThresholdValue) + _id_setIndentThreshold as jni$_.JMethodIDPtr, indentThresholdValue) .check(); } @@ -968,16 +974,16 @@ class PDFTextStripper extends _$jni.JObject { r'()F', ); - static final _getDropThreshold = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDropThreshold = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getDropThreshold()` @@ -987,7 +993,7 @@ class PDFTextStripper extends _$jni.JObject { ///@return the character height multiple for max allowed whitespace between lines in the same paragraph. double getDropThreshold() { return _getDropThreshold( - reference.pointer, _id_getDropThreshold as _$jni.JMethodIDPtr) + reference.pointer, _id_getDropThreshold as jni$_.JMethodIDPtr) .float; } @@ -996,15 +1002,15 @@ class PDFTextStripper extends _$jni.JObject { r'(F)V', ); - static final _setDropThreshold = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + static final _setDropThreshold = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Double,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); /// from: `public void setDropThreshold(float dropThresholdValue)` /// @@ -1016,7 +1022,7 @@ class PDFTextStripper extends _$jni.JObject { double dropThresholdValue, ) { _setDropThreshold(reference.pointer, - _id_setDropThreshold as _$jni.JMethodIDPtr, dropThresholdValue) + _id_setDropThreshold as jni$_.JMethodIDPtr, dropThresholdValue) .check(); } @@ -1025,16 +1031,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getParagraphStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getParagraphStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getParagraphStart()` @@ -1042,10 +1048,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Returns the string which will be used at the beginning of a paragraph. ///@return the paragraph start string - _$jni.JString getParagraphStart() { + jni$_.JString? getParagraphStart() { return _getParagraphStart( - reference.pointer, _id_getParagraphStart as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getParagraphStart as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setParagraphStart = _class.instanceMethodId( @@ -1053,26 +1059,27 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setParagraphStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setParagraphStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setParagraphStart(java.lang.String s)` /// /// Sets the string which will be used at the beginning of a paragraph. ///@param s the paragraph start string void setParagraphStart( - _$jni.JString s, + jni$_.JString? s, ) { + final _$s = s?.reference ?? jni$_.jNullReference; _setParagraphStart(reference.pointer, - _id_setParagraphStart as _$jni.JMethodIDPtr, s.reference.pointer) + _id_setParagraphStart as jni$_.JMethodIDPtr, _$s.pointer) .check(); } @@ -1081,16 +1088,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getParagraphEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getParagraphEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getParagraphEnd()` @@ -1098,10 +1105,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Returns the string which will be used at the end of a paragraph. ///@return the paragraph end string - _$jni.JString getParagraphEnd() { + jni$_.JString? getParagraphEnd() { return _getParagraphEnd( - reference.pointer, _id_getParagraphEnd as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getParagraphEnd as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setParagraphEnd = _class.instanceMethodId( @@ -1109,26 +1116,27 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setParagraphEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setParagraphEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setParagraphEnd(java.lang.String s)` /// /// Sets the string which will be used at the end of a paragraph. ///@param s the paragraph end string void setParagraphEnd( - _$jni.JString s, + jni$_.JString? s, ) { + final _$s = s?.reference ?? jni$_.jNullReference; _setParagraphEnd(reference.pointer, - _id_setParagraphEnd as _$jni.JMethodIDPtr, s.reference.pointer) + _id_setParagraphEnd as jni$_.JMethodIDPtr, _$s.pointer) .check(); } @@ -1137,16 +1145,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getPageStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getPageStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getPageStart()` @@ -1154,10 +1162,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Returns the string which will be used at the beginning of a page. ///@return the page start string - _$jni.JString getPageStart() { + jni$_.JString? getPageStart() { return _getPageStart( - reference.pointer, _id_getPageStart as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getPageStart as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setPageStart = _class.instanceMethodId( @@ -1165,26 +1173,27 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setPageStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setPageStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setPageStart(java.lang.String pageStartValue)` /// /// Sets the string which will be used at the beginning of a page. ///@param pageStartValue the page start string void setPageStart( - _$jni.JString pageStartValue, + jni$_.JString? pageStartValue, ) { - _setPageStart(reference.pointer, _id_setPageStart as _$jni.JMethodIDPtr, - pageStartValue.reference.pointer) + final _$pageStartValue = pageStartValue?.reference ?? jni$_.jNullReference; + _setPageStart(reference.pointer, _id_setPageStart as jni$_.JMethodIDPtr, + _$pageStartValue.pointer) .check(); } @@ -1193,16 +1202,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getPageEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getPageEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getPageEnd()` @@ -1210,9 +1219,9 @@ class PDFTextStripper extends _$jni.JObject { /// /// Returns the string which will be used at the end of a page. ///@return the page end string - _$jni.JString getPageEnd() { - return _getPageEnd(reference.pointer, _id_getPageEnd as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getPageEnd() { + return _getPageEnd(reference.pointer, _id_getPageEnd as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setPageEnd = _class.instanceMethodId( @@ -1220,26 +1229,27 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setPageEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setPageEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setPageEnd(java.lang.String pageEndValue)` /// /// Sets the string which will be used at the end of a page. ///@param pageEndValue the page end string void setPageEnd( - _$jni.JString pageEndValue, + jni$_.JString? pageEndValue, ) { - _setPageEnd(reference.pointer, _id_setPageEnd as _$jni.JMethodIDPtr, - pageEndValue.reference.pointer) + final _$pageEndValue = pageEndValue?.reference ?? jni$_.jNullReference; + _setPageEnd(reference.pointer, _id_setPageEnd as jni$_.JMethodIDPtr, + _$pageEndValue.pointer) .check(); } @@ -1248,16 +1258,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getArticleStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getArticleStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getArticleStart()` @@ -1265,10 +1275,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Returns the string which will be used at the beginning of an article. ///@return the article start string - _$jni.JString getArticleStart() { + jni$_.JString? getArticleStart() { return _getArticleStart( - reference.pointer, _id_getArticleStart as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getArticleStart as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setArticleStart = _class.instanceMethodId( @@ -1276,28 +1286,30 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setArticleStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setArticleStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setArticleStart(java.lang.String articleStartValue)` /// /// Sets the string which will be used at the beginning of an article. ///@param articleStartValue the article start string void setArticleStart( - _$jni.JString articleStartValue, + jni$_.JString? articleStartValue, ) { + final _$articleStartValue = + articleStartValue?.reference ?? jni$_.jNullReference; _setArticleStart( reference.pointer, - _id_setArticleStart as _$jni.JMethodIDPtr, - articleStartValue.reference.pointer) + _id_setArticleStart as jni$_.JMethodIDPtr, + _$articleStartValue.pointer) .check(); } @@ -1306,16 +1318,16 @@ class PDFTextStripper extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getArticleEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getArticleEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getArticleEnd()` @@ -1323,10 +1335,10 @@ class PDFTextStripper extends _$jni.JObject { /// /// Returns the string which will be used at the end of an article. ///@return the article end string - _$jni.JString getArticleEnd() { + jni$_.JString? getArticleEnd() { return _getArticleEnd( - reference.pointer, _id_getArticleEnd as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getArticleEnd as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setArticleEnd = _class.instanceMethodId( @@ -1334,55 +1346,101 @@ class PDFTextStripper extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setArticleEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setArticleEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setArticleEnd(java.lang.String articleEndValue)` /// /// Sets the string which will be used at the end of an article. ///@param articleEndValue the article end string void setArticleEnd( - _$jni.JString articleEndValue, + jni$_.JString? articleEndValue, ) { - _setArticleEnd(reference.pointer, _id_setArticleEnd as _$jni.JMethodIDPtr, - articleEndValue.reference.pointer) + final _$articleEndValue = + articleEndValue?.reference ?? jni$_.jNullReference; + _setArticleEnd(reference.pointer, _id_setArticleEnd as jni$_.JMethodIDPtr, + _$articleEndValue.pointer) .check(); } } -final class $PDFTextStripper$Type extends _$jni.JObjType { - @_$jni.internal - const $PDFTextStripper$Type(); +final class $PDFTextStripper$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $PDFTextStripper$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lorg/apache/pdfbox/text/PDFTextStripper;'; - @_$jni.internal - @_$core.override - PDFTextStripper fromReference(_$jni.JReference reference) => - PDFTextStripper.fromReference(reference); + @jni$_.internal + @core$_.override + PDFTextStripper? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : PDFTextStripper.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($PDFTextStripper$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($PDFTextStripper$NullableType) && + other is $PDFTextStripper$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $PDFTextStripper$Type extends jni$_.JObjType { + @jni$_.internal + const $PDFTextStripper$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lorg/apache/pdfbox/text/PDFTextStripper;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + PDFTextStripper fromReference(jni$_.JReference reference) => + PDFTextStripper.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $PDFTextStripper$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($PDFTextStripper$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($PDFTextStripper$Type) && other is $PDFTextStripper$Type; diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmAnnotatedElementVisitor.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmAnnotatedElementVisitor.java deleted file mode 100644 index 0a723b310..000000000 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmAnnotatedElementVisitor.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -package com.github.dart_lang.jnigen.apisummarizer.disasm; - -import com.github.dart_lang.jnigen.apisummarizer.elements.JavaAnnotation; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Type; - -// This interface removes some repetitive code using default methods - -public interface AsmAnnotatedElementVisitor { - void addAnnotation(JavaAnnotation annotation); - - default AnnotationVisitor visitAnnotationDefault(String descriptor, boolean visible) { - var annotation = new JavaAnnotation(); - var aType = Type.getType(descriptor); - annotation.binaryName = aType.getClassName(); - addAnnotation(annotation); - return new AsmAnnotationVisitor(annotation); - } -} diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmClassVisitor.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmClassVisitor.java index d979b4e32..010c0679d 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmClassVisitor.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmClassVisitor.java @@ -13,12 +13,11 @@ import org.objectweb.asm.*; import org.objectweb.asm.signature.SignatureReader; -public class AsmClassVisitor extends ClassVisitor implements AsmAnnotatedElementVisitor { - private static Param param( - Type type, String name, @SuppressWarnings("SameParameterValue") String signature) { +public class AsmClassVisitor extends ClassVisitor { + private static Param param(Type type, String name) { var param = new Param(); param.name = name; - param.type = TypeUtils.typeUsage(type, signature); + param.type = TypeUtils.typeUsage(type); return param; } @@ -31,6 +30,7 @@ public Map getVisited() { /// Actual access for the inner classes as originally defined. Map actualAccess = new HashMap<>(); + Map outerClass = new HashMap<>(); public AsmClassVisitor() { super(AsmConstants.API); @@ -48,10 +48,11 @@ public void visit( visiting.push(current); current.binaryName = name.replace('/', '.'); current.modifiers = TypeUtils.access(actualAccess.getOrDefault(current.binaryName, access)); + current.outerClassBinaryName = outerClass.getOrDefault(current.binaryName, null); current.declKind = TypeUtils.declKind(access); - current.superclass = TypeUtils.typeUsage(Type.getObjectType(superName), null); + current.superclass = TypeUtils.typeUsage(Type.getObjectType(superName)); current.interfaces = - StreamUtil.map(interfaces, i -> TypeUtils.typeUsage(Type.getObjectType(i), null)); + StreamUtil.map(interfaces, i -> TypeUtils.typeUsage(Type.getObjectType(i))); if (signature != null) { var reader = new SignatureReader(signature); reader.accept(new AsmClassSignatureVisitor(current)); @@ -63,11 +64,15 @@ public void visit( public void visitInnerClass(String name, String outerName, String innerName, int access) { var binaryName = name.replace('/', '.'); actualAccess.put(binaryName, access); - + if (outerName != null) { + var outerClassBinaryName = outerName.replace('/', '.'); + outerClass.put(binaryName, outerClassBinaryName); + } if (visited.containsKey(binaryName)) { // If the order of visit is outerClass-first, innerClass-second then only // correct the modifiers. visited.get(binaryName).modifiers = TypeUtils.access(access); + visited.get(binaryName).outerClassBinaryName = outerClass.get(binaryName); } } @@ -80,7 +85,7 @@ public FieldVisitor visitField( var field = new Field(); field.name = name; - field.type = TypeUtils.typeUsage(Type.getType(descriptor), signature); + field.type = TypeUtils.typeUsage(Type.getType(descriptor)); field.defaultValue = value; field.modifiers = TypeUtils.access(access); if ((access & ACC_ENUM) != 0) { @@ -116,9 +121,9 @@ public MethodVisitor visitMethod( } else { paramNames.put(paramName, 1); } - params.add(param(pt, paramName, null)); + params.add(param(pt, paramName)); } - method.returnType = TypeUtils.typeUsage(type.getReturnType(), signature); + method.returnType = TypeUtils.typeUsage(type.getReturnType()); method.modifiers = TypeUtils.access(access); method.params = params; if (signature != null) { @@ -134,22 +139,45 @@ public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { if (descriptor.equals("Lkotlin/Metadata;")) { return new KotlinMetadataAnnotationVisitor(peekVisiting()); } - return super.visitAnnotation(descriptor, visible); - } - - @Override - public void addAnnotation(JavaAnnotation annotation) { + var annotation = TypeUtils.annotationFromDescriptor(descriptor); peekVisiting().annotations.add(annotation); - } - - @Override - public AnnotationVisitor visitAnnotationDefault(String descriptor, boolean visible) { - return super.visitAnnotation(descriptor, visible); + return new AsmAnnotationVisitor(annotation); } @Override public AnnotationVisitor visitTypeAnnotation( int typeRef, TypePath typePath, String descriptor, boolean visible) { + var typeReference = new TypeReference(typeRef); + var annotation = TypeUtils.annotationFromDescriptor(descriptor); + TypeUsage.ReferredType startingType = null; + switch (typeReference.getSort()) { + case TypeReference.CLASS_TYPE_PARAMETER: + { + var index = typeReference.getTypeParameterIndex(); + peekVisiting().typeParams.get(index).annotations.add(annotation); + break; + } + case TypeReference.CLASS_TYPE_PARAMETER_BOUND: + { + var typeParamIndex = typeReference.getTypeParameterIndex(); + var index = typeReference.getTypeParameterBoundIndex(); + startingType = peekVisiting().typeParams.get(typeParamIndex).bounds.get(index).type; + break; + } + case TypeReference.CLASS_EXTENDS: + { + var index = typeReference.getSuperTypeIndex(); + if (index == -1) { + startingType = peekVisiting().superclass.type; + } else { + startingType = peekVisiting().interfaces.get(index).type; + } + break; + } + } + if (startingType != null) { + TypeUtils.moveToTypePath(startingType, typePath).annotations.add(annotation); + } return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible); } diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmFieldVisitor.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmFieldVisitor.java index eb72302ab..1535622fa 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmFieldVisitor.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmFieldVisitor.java @@ -5,11 +5,11 @@ package com.github.dart_lang.jnigen.apisummarizer.disasm; import com.github.dart_lang.jnigen.apisummarizer.elements.Field; -import com.github.dart_lang.jnigen.apisummarizer.elements.JavaAnnotation; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.TypePath; -public class AsmFieldVisitor extends FieldVisitor implements AsmAnnotatedElementVisitor { +public class AsmFieldVisitor extends FieldVisitor { Field field; public AsmFieldVisitor(Field field) { @@ -18,12 +18,17 @@ public AsmFieldVisitor(Field field) { } @Override - public void addAnnotation(JavaAnnotation annotation) { + public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { + var annotation = TypeUtils.annotationFromDescriptor(descriptor); field.annotations.add(annotation); + return new AsmAnnotationVisitor(annotation); } @Override - public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { - return AsmAnnotatedElementVisitor.super.visitAnnotationDefault(descriptor, visible); + public AnnotationVisitor visitTypeAnnotation( + int typeRef, TypePath typePath, String descriptor, boolean visible) { + var annotation = TypeUtils.annotationFromDescriptor(descriptor); + TypeUtils.moveToTypePath(field.type.type, typePath).annotations.add(annotation); + return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible); } } diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmMethodVisitor.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmMethodVisitor.java index 6d66fd6d6..9c2679460 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmMethodVisitor.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmMethodVisitor.java @@ -4,15 +4,16 @@ package com.github.dart_lang.jnigen.apisummarizer.disasm; -import com.github.dart_lang.jnigen.apisummarizer.elements.JavaAnnotation; import com.github.dart_lang.jnigen.apisummarizer.elements.Method; +import com.github.dart_lang.jnigen.apisummarizer.elements.TypeUsage; import java.util.ArrayList; import java.util.List; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.TypePath; +import org.objectweb.asm.TypeReference; -public class AsmMethodVisitor extends MethodVisitor implements AsmAnnotatedElementVisitor { +public class AsmMethodVisitor extends MethodVisitor { Method method; List paramNames = new ArrayList<>(); @@ -27,27 +28,66 @@ public void visitParameter(String name, int access) { } @Override - public void addAnnotation(JavaAnnotation annotation) { + public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { + var annotation = TypeUtils.annotationFromDescriptor(descriptor); method.annotations.add(annotation); - } - - @Override - public AnnotationVisitor visitAnnotationDefault(String descriptor, boolean visible) { - return AsmAnnotatedElementVisitor.super.visitAnnotationDefault(descriptor, visible); + return new AsmAnnotationVisitor(annotation); } @Override public AnnotationVisitor visitTypeAnnotation( int typeRef, TypePath typePath, String descriptor, boolean visible) { - // TODO(#23): Collect annotation on type parameter + var typeReference = new TypeReference(typeRef); + var annotation = TypeUtils.annotationFromDescriptor(descriptor); + TypeUsage.ReferredType startingType = null; + switch (typeReference.getSort()) { + case TypeReference.METHOD_TYPE_PARAMETER: + { + var index = typeReference.getTypeParameterIndex(); + method.typeParams.get(index).annotations.add(annotation); + break; + } + case TypeReference.METHOD_TYPE_PARAMETER_BOUND: + { + var typeParamIndex = typeReference.getTypeParameterIndex(); + var index = typeReference.getTypeParameterBoundIndex(); + startingType = method.typeParams.get(typeParamIndex).bounds.get(index).type; + break; + } + case TypeReference.METHOD_RETURN: + { + startingType = method.returnType.type; + break; + } + case TypeReference.METHOD_RECEIVER: + { + // Not sure what this is. + break; + } + case TypeReference.METHOD_FORMAL_PARAMETER: + { + var index = typeReference.getFormalParameterIndex(); + startingType = method.params.get(index).type.type; + break; + } + case TypeReference.THROWS: + { + // Ignore this as Dart does not have an equivalent to `throws`. + break; + } + } + if (startingType != null) { + TypeUtils.moveToTypePath(startingType, typePath).annotations.add(annotation); + } return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible); } @Override public AnnotationVisitor visitParameterAnnotation( int parameter, String descriptor, boolean visible) { - // TODO(#23): collect and attach it to parameters - return super.visitParameterAnnotation(parameter, descriptor, visible); + var annotation = TypeUtils.annotationFromDescriptor(descriptor); + method.params.get(parameter).annotations.add(annotation); + return new AsmAnnotationVisitor(annotation); } @Override diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmTypeUsageSignatureVisitor.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmTypeUsageSignatureVisitor.java index 6ddda4546..46ccd10ae 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmTypeUsageSignatureVisitor.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmTypeUsageSignatureVisitor.java @@ -81,20 +81,49 @@ public void visitClassType(String name) { typeUsage.type = new TypeUsage.DeclaredType(typeUsage.shorthand, simpleName, new ArrayList<>()); } + @Override + public void visitTypeArgument() { + assert (typeUsage.type instanceof TypeUsage.DeclaredType); + var typeArg = new TypeUsage("?", TypeUsage.Kind.WILDCARD, new TypeUsage.Wildcard(null, null)); + ((TypeUsage.DeclaredType) typeUsage.type).params.add(typeArg); + } + @Override public SignatureVisitor visitTypeArgument(char wildcard) { - // TODO(#141) support wildcards - // TODO(#144) support extend/super clauses assert (typeUsage.type instanceof TypeUsage.DeclaredType); var typeArg = new TypeUsage(); + typeArg.kind = TypeUsage.Kind.DECLARED; ((TypeUsage.DeclaredType) typeUsage.type).params.add(typeArg); + if (wildcard != '=') { + typeArg.kind = TypeUsage.Kind.WILDCARD; + typeArg.type = new TypeUsage.Wildcard(null, null); + typeArg.shorthand = "?"; + switch (wildcard) { + case '+': + { + var extendsBound = new TypeUsage(); + ((TypeUsage.Wildcard) typeArg.type).extendsBound = extendsBound; + typeArg = extendsBound; + break; + } + case '-': + { + var superBound = new TypeUsage(); + ((TypeUsage.Wildcard) typeArg.type).superBound = superBound; + typeArg = superBound; + break; + } + } + } return new AsmTypeUsageSignatureVisitor(typeArg); } @Override public void visitInnerClassType(String name) { typeUsage.shorthand += "." + name; - ((TypeUsage.DeclaredType) typeUsage.type).binaryName += "$" + name; - ((TypeUsage.DeclaredType) typeUsage.type).simpleName = name; + var declaredType = ((TypeUsage.DeclaredType) typeUsage.type); + declaredType.binaryName += "$" + name; + declaredType.simpleName = name; + declaredType.typeParamIndices.add(declaredType.params.size()); } } diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/TypeUtils.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/TypeUtils.java index 66c723aa5..09ace8570 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/TypeUtils.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/TypeUtils.java @@ -9,6 +9,7 @@ import static org.objectweb.asm.Type.OBJECT; import com.github.dart_lang.jnigen.apisummarizer.elements.DeclKind; +import com.github.dart_lang.jnigen.apisummarizer.elements.JavaAnnotation; import com.github.dart_lang.jnigen.apisummarizer.elements.TypeUsage; import com.github.dart_lang.jnigen.apisummarizer.util.SkipException; import java.util.HashMap; @@ -16,6 +17,7 @@ import java.util.Map; import java.util.Set; import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; class TypeUtils { @@ -31,7 +33,7 @@ public static String simpleName(Type type) { return components[components.length - 1]; } - public static TypeUsage typeUsage(Type type, @SuppressWarnings("unused") String signature) { + public static TypeUsage typeUsage(Type type) { var usage = new TypeUsage(); usage.shorthand = type.getClassName(); switch (type.getSort()) { @@ -43,7 +45,7 @@ public static TypeUsage typeUsage(Type type, @SuppressWarnings("unused") String break; case ARRAY: usage.kind = TypeUsage.Kind.ARRAY; - usage.type = new TypeUsage.Array(TypeUtils.typeUsage(type.getElementType(), null)); + usage.type = new TypeUsage.Array(TypeUtils.typeUsage(type.getElementType())); break; default: usage.kind = TypeUsage.Kind.PRIMITIVE; @@ -78,6 +80,13 @@ public static Set access(int access) { acc.put("synthetic", ACC_SYNTHETIC); } + static JavaAnnotation annotationFromDescriptor(String descriptor) { + var annotation = new JavaAnnotation(); + var aType = Type.getType(descriptor); + annotation.binaryName = aType.getClassName(); + return annotation; + } + static DeclKind declKind(int access) { if ((access & ACC_ENUM) != 0) return DeclKind.ENUM; if ((access & ACC_INTERFACE) != 0) return DeclKind.INTERFACE; @@ -99,6 +108,50 @@ static String defaultParamName(Type type) { } } + static TypeUsage.ReferredType moveToTypePath( + TypeUsage.ReferredType startingType, TypePath typePath) { + if (typePath == null) { + return startingType; + } + var currentType = startingType; + int nestingLevel = 0; + for (int i = 0; i < typePath.getLength(); ++i) { + var step = typePath.getStep(i); + switch (step) { + case TypePath.ARRAY_ELEMENT: + { + currentType = ((TypeUsage.Array) currentType).elementType.type; + nestingLevel = 0; + break; + } + case TypePath.INNER_TYPE: + { + ++nestingLevel; + break; + } + case TypePath.WILDCARD_BOUND: + { + var wildcard = ((TypeUsage.Wildcard) currentType); + var extendsBound = wildcard.extendsBound; + var superBound = wildcard.superBound; + currentType = (extendsBound == null ? superBound : extendsBound).type; + nestingLevel = 0; + break; + } + case TypePath.TYPE_ARGUMENT: + { + var declared = ((TypeUsage.DeclaredType) currentType); + var startingIndex = + nestingLevel == 0 ? 0 : declared.typeParamIndices.get(nestingLevel - 1); + currentType = declared.params.get(startingIndex + typePath.getStepArgument(i)).type; + nestingLevel = 0; + break; + } + } + } + return currentType; + } + private static String unCapitalize(String s) { var first = Character.toLowerCase(s.charAt(0)); if (s.length() == 1) { diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/doclet/ElementBuilders.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/doclet/ElementBuilders.java index 675da7b8a..4d8a84b52 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/doclet/ElementBuilders.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/doclet/ElementBuilders.java @@ -23,6 +23,10 @@ public ElementBuilders(AstEnv env) { private void fillInFromTypeElement(TypeElement e, ClassDecl c) { c.modifiers = e.getModifiers().stream().map(Modifier::toString).collect(Collectors.toSet()); c.binaryName = env.elements.getBinaryName(e).toString(); + if (e.getNestingKind().isNested()) { + c.outerClassBinaryName = + env.elements.getBinaryName((TypeElement) e.getEnclosingElement()).toString(); + } switch (e.getKind()) { case INTERFACE: c.declKind = DeclKind.INTERFACE; @@ -111,6 +115,7 @@ public TypeParam typeParam(TypeParameterElement tpe) { var tp = new TypeParam(); tp.name = tpe.getSimpleName().toString(); tp.bounds = tpe.getBounds().stream().map(this::typeUsage).collect(Collectors.toList()); + tp.annotations = annotations(tpe.getAnnotationMirrors()); return tp; } @@ -129,65 +134,78 @@ public TypeUsage typeUsage(TypeMirror type) { var element = env.types.asElement(type); switch (type.getKind()) { case DECLARED: - // Unique name that's binary name not qualified name - // (It's somewhat confusing but qualified name does not need to be unique, - // because of nesting) - u.kind = TypeUsage.Kind.DECLARED; - var name = - element instanceof TypeElement - ? env.elements.getBinaryName((TypeElement) element).toString() - : element.getSimpleName().toString(); - List params = null; - if (type instanceof DeclaredType) { // it will be - params = + { + // Unique name that's binary name not qualified name + // (It's somewhat confusing but qualified name does not need to be unique, + // because of nesting) + u.kind = TypeUsage.Kind.DECLARED; + var name = + element instanceof TypeElement + ? env.elements.getBinaryName((TypeElement) element).toString() + : element.getSimpleName().toString(); + assert (type instanceof DeclaredType); + List params = ((DeclaredType) type) .getTypeArguments().stream().map(this::typeUsage).collect(Collectors.toList()); + u.type = new TypeUsage.DeclaredType(name, element.getSimpleName().toString(), params); + break; } - u.type = new TypeUsage.DeclaredType(name, element.getSimpleName().toString(), params); - break; case TYPEVAR: - u.kind = TypeUsage.Kind.TYPE_VARIABLE; - // TODO(#23): Encode bounds of type variable. - // A straightforward approach will cause infinite recursion very - // easily. Another approach I can think of is only encoding the - // erasure of the type variable per JLS. - u.type = new TypeUsage.TypeVar(element.getSimpleName().toString()); - break; + { + u.kind = TypeUsage.Kind.TYPE_VARIABLE; + // TODO(#23): Encode bounds of type variable. + // A straightforward approach will cause infinite recursion very + // easily. Another approach I can think of is only encoding the + // erasure of the type variable per JLS. + u.type = new TypeUsage.TypeVar(element.getSimpleName().toString()); + break; + } case ARRAY: - u.kind = TypeUsage.Kind.ARRAY; - var arr = ((ArrayType) type); - u.type = new TypeUsage.Array(typeUsage(arr.getComponentType())); - break; + { + u.kind = TypeUsage.Kind.ARRAY; + var arr = ((ArrayType) type); + u.type = new TypeUsage.Array(typeUsage(arr.getComponentType())); + break; + } case VOID: - u.type = new TypeUsage.PrimitiveType("void"); - u.kind = TypeUsage.Kind.PRIMITIVE; - break; + { + u.type = new TypeUsage.PrimitiveType("void"); + u.kind = TypeUsage.Kind.PRIMITIVE; + break; + } case WILDCARD: - u.kind = TypeUsage.Kind.WILDCARD; - var wildcard = ((WildcardType) type); - var extendsBound = wildcard.getExtendsBound(); - var superBound = wildcard.getSuperBound(); - u.type = - new TypeUsage.Wildcard( - extendsBound != null ? typeUsage(extendsBound) : null, - superBound != null ? typeUsage(superBound) : null); - break; + { + u.kind = TypeUsage.Kind.WILDCARD; + var wildcard = ((WildcardType) type); + var extendsBound = wildcard.getExtendsBound(); + var superBound = wildcard.getSuperBound(); + u.type = + new TypeUsage.Wildcard( + extendsBound != null ? typeUsage(extendsBound) : null, + superBound != null ? typeUsage(superBound) : null); + break; + } case INTERSECTION: - u.kind = TypeUsage.Kind.INTERSECTION; - u.type = - new TypeUsage.Intersection( - ((IntersectionType) type) - .getBounds().stream().map(this::typeUsage).collect(Collectors.toList())); - break; + { + u.kind = TypeUsage.Kind.INTERSECTION; + u.type = + new TypeUsage.Intersection( + ((IntersectionType) type) + .getBounds().stream().map(this::typeUsage).collect(Collectors.toList())); + break; + } default: - u.kind = TypeUsage.Kind.PRIMITIVE; - if (type instanceof PrimitiveType) { - u.type = new TypeUsage.PrimitiveType(type.toString()); - } else { - System.out.println("Unsupported type: " + type); - // throw exception. + { + u.kind = TypeUsage.Kind.PRIMITIVE; + if (type instanceof PrimitiveType) { + u.type = new TypeUsage.PrimitiveType(type.toString()); + } else { + System.err.println("Unsupported type: " + type); + // throw exception. + } } } + u.type.annotations = annotations(type.getAnnotationMirrors()); return u; } diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/ClassDecl.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/ClassDecl.java index f50bc7d6d..fd069ad6c 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/ClassDecl.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/ClassDecl.java @@ -31,11 +31,12 @@ public class ClassDecl { public List methods = new ArrayList<>(); public List fields = new ArrayList<>(); public TypeUsage superclass; + public String outerClassBinaryName; public List interfaces = new ArrayList<>(); public boolean hasStaticInit; public boolean hasInstanceInit; public JavaDocComment javadoc; - public List annotations; + public List annotations = new ArrayList<>(); public KotlinClass kotlinClass; public KotlinPackage kotlinPackage; diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinPackage.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinPackage.java index 5252e0071..3610a18aa 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinPackage.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinPackage.java @@ -6,11 +6,14 @@ public class KotlinPackage { public List functions; + public List properties; public static KotlinPackage fromKmPackage(KmPackage p) { var pkg = new KotlinPackage(); pkg.functions = p.getFunctions().stream().map(KotlinFunction::fromKmFunction).collect(Collectors.toList()); + pkg.properties = + p.getProperties().stream().map(KotlinProperty::fromKmProperty).collect(Collectors.toList()); return pkg; } } diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinType.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinType.java index 8e91122ef..69af1b9ee 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinType.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinType.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.stream.Collectors; +import kotlinx.metadata.Flag; import kotlinx.metadata.KmClassifier; import kotlinx.metadata.KmType; @@ -15,11 +16,14 @@ public class KotlinType { public String name; public int id; public List arguments; + public boolean isNullable; public static KotlinType fromKmType(KmType t) { if (t == null) return null; var type = new KotlinType(); type.flags = t.getFlags(); + // Processing the information needed from the flags. + type.isNullable = Flag.Type.IS_NULLABLE.invoke(type.flags); var classifier = t.getClassifier(); if (classifier instanceof KmClassifier.Class) { type.kind = "class"; diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeParam.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeParam.java index 8172ee6d8..44856ab42 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeParam.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeParam.java @@ -10,4 +10,5 @@ public class TypeParam { public String name; public List bounds = new ArrayList<>(); + public List annotations = new ArrayList<>(); } diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeUsage.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeUsage.java index a60407caf..5b1b0745e 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeUsage.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeUsage.java @@ -4,6 +4,7 @@ package com.github.dart_lang.jnigen.apisummarizer.elements; +import java.util.ArrayList; import java.util.List; public class TypeUsage { @@ -30,7 +31,9 @@ public enum Kind { public Kind kind; public ReferredType type; - public abstract static class ReferredType {} + public abstract static class ReferredType { + public List annotations = new ArrayList<>(); + } public static class PrimitiveType extends ReferredType { public String name; @@ -44,6 +47,7 @@ public static class DeclaredType extends ReferredType { public String binaryName; public String simpleName; public List params; + public List typeParamIndices = new ArrayList<>(); public DeclaredType(String binaryName, String simpleName, List params) { this.binaryName = binaryName; @@ -78,10 +82,10 @@ public Intersection(List types) { } public static class Array extends ReferredType { - public TypeUsage type; + public TypeUsage elementType; public Array(TypeUsage type) { - this.type = type; + this.elementType = type; } } } diff --git a/pkgs/jnigen/lib/src/bindings/dart_generator.dart b/pkgs/jnigen/lib/src/bindings/dart_generator.dart index a2d758966..56c88d772 100644 --- a/pkgs/jnigen/lib/src/bindings/dart_generator.dart +++ b/pkgs/jnigen/lib/src/bindings/dart_generator.dart @@ -14,8 +14,8 @@ import 'resolver.dart'; import 'visitor.dart'; // Import prefixes. -const _jni = '_\$jni'; -const _core = '_\$core'; +const _jni = r'jni$_'; +const _core = r'core$_'; // dart:core types const _override = '@$_core.override'; @@ -37,9 +37,6 @@ const _internal = '@$_jni.internal'; // Prefixes and suffixes. const _typeParamPrefix = '\$'; -/// Used for C bindings. -const _selfPointer = 'reference.pointer'; - /// Used for Dart-only bindings. const _self = 'this'; @@ -154,6 +151,7 @@ import 'package:jni/jni.dart' as $_jni; // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -314,7 +312,8 @@ ${modifier}final $classRef = $_jni.JClass.forName(r'$internalName'); // Class definition. final name = node.finalName; - final superName = node.superclass!.accept(_TypeGenerator(resolver)); + final superName = node.superclass! + .accept(_TypeGenerator(resolver, includeNullability: false)); final implClassName = '\$$name'; final typeParamsDef = node.allTypeParams .accept(const _TypeParamDef()) @@ -354,7 +353,7 @@ class $name$typeParamsDef extends $superName { $ctorTypeClassesDef $_jReference reference, ) : - $instanceTypeGetter = $staticTypeGetter$staticTypeGetterCallArgs, + $instanceTypeGetter = $staticTypeGetter$typeParamsCall$staticTypeGetterCallArgs, super.fromReference( $superTypeClassesCall reference @@ -367,28 +366,38 @@ class $name$typeParamsDef extends $superName { // Static TypeClass getter. s.writeln( ' /// The type which includes information such as the signature of this class.'); - final typeClassName = node.typeClassName; - if (typeParams.isEmpty) { - s.writeln('static const $staticTypeGetter = $typeClassName();'); - } else { - final staticTypeGetterTypeClassesDef = typeParams - .map( - (typeParam) => '$_jType<$_typeParamPrefix$typeParam> $typeParam,') - .join(_newLine(depth: 2)); - final typeClassesCall = - typeParams.map((typeParam) => '$typeParam,').join(_newLine(depth: 3)); - s.write(''' - static $typeClassName$typeParamsCall $staticTypeGetter$typeParamsDef( + void generateTypeClassGetter({required bool isNullable}) { + final typeClassName = + isNullable ? node.nullableTypeClassName : node.typeClassName; + final typeClassGetterName = + isNullable ? 'nullableType' : staticTypeGetter; + if (typeParams.isEmpty) { + s.writeln('static const $typeClassGetterName = ' + '$typeClassName$typeParamsCall();'); + } else { + final staticTypeGetterTypeClassesDef = typeParams + .map((typeParam) => + '$_jType<$_typeParamPrefix$typeParam> $typeParam,') + .join(_newLine(depth: 2)); + final typeClassesCall = typeParams + .map((typeParam) => '$typeParam,') + .join(_newLine(depth: 3)); + s.write(''' + static $typeClassName$typeParamsCall $typeClassGetterName$typeParamsDef( $staticTypeGetterTypeClassesDef ) { - return $typeClassName( + return $typeClassName$typeParamsCall( $typeClassesCall ); } '''); + } } + generateTypeClassGetter(isNullable: true); + generateTypeClassGetter(isNullable: false); + // Fields and Methods generateFieldsAndMethods(node, classRef); @@ -484,7 +493,7 @@ class $name$typeParamsDef extends $superName { s.write(''' final \$i = $_jni.JImplementer(); implementIn(\$i, \$impl); - return $name.fromReference( + return $name$typeParamsCall.fromReference( $typeClassesCall \$i.implementReference(), ); @@ -517,7 +526,7 @@ class $name$typeParamsDef extends $superName { abstract base mixin class $implClassName$typeParamsDef { factory $implClassName( $abstractFactoryArgs - ) = _$implClassName; + ) = _$implClassName$typeParamsCall; $typeClassGetters @@ -564,19 +573,41 @@ final class _$implClassName$typeParamsDef with $implClassName$typeParamsCall { s.writeln('}'); } // TypeClass definition. - final typeClassesCall = - typeParams.map((typeParam) => '$typeParam,').join(_newLine(depth: 2)); - final signature = node.signature; - final superTypeClass = superClass.accept(_TypeClassGenerator(resolver)); - final hashCodeTypeClasses = typeParams.join(', '); - final equalityTypeClasses = typeParams - .map((typeParam) => ' &&\n $typeParam == other.$typeParam') - .join(); - final hashCode = typeParams.isEmpty - ? '($typeClassName).hashCode' - : 'Object.hash($typeClassName, $hashCodeTypeClasses)'; - s.write(''' -final class $typeClassName$typeParamsDef extends $_jType<$name$typeParamsCall> { + void generateTypeClass({required bool isNullable}) { + final typeClassName = + isNullable ? node.nullableTypeClassName : node.typeClassName; + final typeClassesCall = + typeParams.map((typeParam) => '$typeParam,').join(_newLine(depth: 2)); + final signature = node.signature; + final superType = superClass.accept(_TypeClassGenerator(resolver)).name; + final hashCodeTypeClasses = typeParams.join(', '); + final equalityTypeClasses = typeParams + .map((typeParam) => ' &&\n $typeParam == other.$typeParam') + .join(); + final hashCode = typeParams.isEmpty + ? '($typeClassName).hashCode' + : 'Object.hash($typeClassName, $hashCodeTypeClasses)'; + final nullableType = isNullable + ? 'this' + : (DeclaredType( + binaryName: node.binaryName, + annotations: [Annotation.nullable], + params: node.allTypeParams + .map((typeParam) => TypeUsage( + shorthand: '', kind: Kind.typeVariable, typeJson: {}) + ..type = (TypeVar(name: typeParam.name) + ..origin = TypeParam( + name: typeParam.name, + annotations: [Annotation.nonNull], + bounds: typeParam.bounds, + ))) + .toList()) + ..classDecl = node) + .accept(_TypeClassGenerator(resolver)) + .name; + final nullable = isNullable ? '?' : ''; + s.write(''' +final class $typeClassName$typeParamsDef extends $_jType<$name$typeParamsCall$nullable> { $typeClassesDef $_internal @@ -590,14 +621,31 @@ final class $typeClassName$typeParamsDef extends $_jType<$name$typeParamsCall> { $_internal $_override - $name$typeParamsCall fromReference($_jReference reference) => $name.fromReference( - $typeClassesCall - reference - ); + $name$typeParamsCall$nullable fromReference($_jReference reference) => + '''); + if (isNullable) { + s.write(''' + reference.isNull ? null : $name$typeParamsCall.fromReference( + $typeClassesCall + reference, + ); +'''); + } else { + s.write(''' + $name$typeParamsCall.fromReference( + $typeClassesCall + reference, + ); +'''); + } + s.write(''' + $_internal + $_override + $_jType get superType => $superType; $_internal $_override - $_jType get superType => ${superTypeClass.name}; + $_jType<$name$typeParamsCall?> get nullableType => $nullableType; $_internal $_override @@ -614,6 +662,11 @@ final class $typeClassName$typeParamsDef extends $_jType<$name$typeParamsCall> { } '''); + } + + generateTypeClass(isNullable: true); + generateTypeClass(isNullable: false); + log.finest('Generated bindings for class ${node.binaryName}'); } } @@ -656,31 +709,42 @@ class _TypeGenerator extends TypeVisitor { /// Whether the generic types should be erased. final bool typeErasure; + final bool includeNullability; + + /// Whether the type is used inside `JArray`. + final bool arrayType; + const _TypeGenerator( this.resolver, { this.forInterfaceImplementation = false, this.typeErasure = false, + this.includeNullability = true, + this.arrayType = false, }); @override String visitArrayType(ArrayType node) { - final innerType = node.type; - if (innerType.kind == Kind.primitive) { - return '$_jArray<$_jni.j${(innerType.type as PrimitiveType).name}>'; - } + final innerType = node.elementType; + final nullable = includeNullability && node.isNullable ? '?' : ''; final typeGenerator = _TypeGenerator( resolver, forInterfaceImplementation: forInterfaceImplementation, typeErasure: forInterfaceImplementation, + includeNullability: true, + arrayType: true, ); - return '$_jArray<${innerType.accept(typeGenerator)}>'; + if (innerType.kind == Kind.primitive) { + return '$_jni.J${innerType.accept(typeGenerator)}Array$nullable'; + } + return '$_jArray<${innerType.accept(typeGenerator)}>$nullable'; } @override String visitDeclaredType(DeclaredType node) { + final nullable = includeNullability && node.isNullable ? '?' : ''; if (node.classDecl.binaryName == 'java.lang.Object' || node.classDecl.binaryName == 'java.lang.String') { - return '$_jni.${node.classDecl.finalName}'; + return '$_jni.${node.classDecl.finalName}$nullable'; } // All type parameters of this type @@ -692,18 +756,21 @@ class _TypeGenerator extends TypeVisitor { resolver, forInterfaceImplementation: forInterfaceImplementation, typeErasure: forInterfaceImplementation, + includeNullability: true, + arrayType: false, ); final definedTypeParams = node.params.accept(typeGenerator).toList(); // Replacing the declared ones. They come at the end. // The rest will be JObject. if (allTypeParams.length >= node.params.length) { + final nullable = includeNullability ? '?' : ''; allTypeParams.replaceRange( 0, allTypeParams.length - node.params.length, List.filled( allTypeParams.length - node.params.length, - _jObject, + '$_jObject$nullable', ), ); allTypeParams.replaceRange( @@ -715,11 +782,14 @@ class _TypeGenerator extends TypeVisitor { final typeParams = allTypeParams.join(', ').encloseIfNotEmpty('<', '>'); final prefix = resolver?.resolvePrefix(node.classDecl) ?? ''; - return '$prefix${node.classDecl.finalName}$typeParams'; + return '$prefix${node.classDecl.finalName}$typeParams$nullable'; } @override String visitPrimitiveType(PrimitiveType node) { + if (arrayType) { + return node.name.capitalize(); + } return node.dartType; } @@ -727,24 +797,40 @@ class _TypeGenerator extends TypeVisitor { String visitTypeVar(TypeVar node) { // TODO(https://github.com/dart-lang/native/issues/704): Tighten to // typevar bounds instead. - if (typeErasure) { - return _jObject; - } - if (forInterfaceImplementation && node.origin.parent is Method) { - return _jObject; + { + final nullable = includeNullability && node.isNullable ? '?' : ''; + if (typeErasure) { + return '$_jObject$nullable'; + } + if (forInterfaceImplementation && node.origin.parent is Method) { + return '$_jObject$nullable'; + } } - return '$_typeParamPrefix${node.name}'; + final nullable = includeNullability && node.hasQuestionMark ? '?' : ''; + return '$_typeParamPrefix${node.name}$nullable'; } @override String visitWildcard(Wildcard node) { // TODO(https://github.com/dart-lang/native/issues/701): Support wildcards. - return super.visitWildcard(node); + if (node.superBound != null || node.extendsBound == null) { + // Dart does not support `* super T` wildcards. Fall back to Object?. + return super.visitWildcard(node); + } + final typeGenerator = _TypeGenerator( + resolver, + arrayType: arrayType, + forInterfaceImplementation: forInterfaceImplementation, + includeNullability: includeNullability && node.isNullable, + typeErasure: typeErasure, + ); + return node.extendsBound!.accept(typeGenerator); } @override String visitNonPrimitiveType(ReferredType node) { - return _jObject; + final nullable = includeNullability ? '?' : ''; + return '$_jObject$nullable'; } } @@ -770,6 +856,8 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { /// Whether the generic types should be erased. final bool typeErasure; + final bool includeNullability; + final Resolver resolver; _TypeClassGenerator( @@ -777,12 +865,13 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { this.isConst = true, this.boxPrimitives = false, this.forInterfaceImplementation = false, + this.includeNullability = true, this.typeErasure = false, }); @override _TypeClass visitArrayType(ArrayType node) { - final innerTypeClass = node.type.accept(_TypeClassGenerator( + final innerTypeClass = node.elementType.accept(_TypeClassGenerator( resolver, isConst: false, boxPrimitives: false, @@ -790,9 +879,24 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { // Do type erasure for interface implementation. typeErasure: forInterfaceImplementation, )); + final innerType = node.elementType.accept(_TypeGenerator( + resolver, + forInterfaceImplementation: forInterfaceImplementation, + // Do type erasure for interface implementation. + typeErasure: forInterfaceImplementation, + arrayType: true, + )); final ifConst = innerTypeClass.canBeConst && isConst ? 'const ' : ''; + final type = + includeNullability && node.isNullable ? 'NullableType' : 'Type'; + if (node.elementType.kind == Kind.primitive) { + return _TypeClass( + '$ifConst$_jni.J${innerType}Array$type()', + innerTypeClass.canBeConst, + ); + } return _TypeClass( - '$ifConst${_jArray}Type(${innerTypeClass.name})', + '$ifConst$_jArray$type<$innerType>(${innerTypeClass.name})', innerTypeClass.canBeConst, ); } @@ -818,7 +922,7 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { allTypeParams.isEmpty || definedTypeClasses.every((e) => e.canBeConst); // Replacing the declared ones. They come at the end. - // The rest will be `JObjectType`. + // The rest will be `JObjectNullableType`. if (allTypeParams.length >= node.params.length) { allTypeParams.replaceRange( 0, @@ -827,7 +931,7 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { allTypeParams.length - node.params.length, // Adding const to subexpressions if the entire expression is not // const. - '${canBeConst ? '' : 'const '}${_jObject}Type()', + '${canBeConst ? '' : 'const '}${_jObject}NullableType()', ), ); allTypeParams.replaceRange( @@ -841,9 +945,23 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { final args = allTypeParams.join(', '); final ifConst = isConst && canBeConst ? 'const ' : ''; + final type = includeNullability && node.isNullable + ? node.classDecl.nullableTypeClassName + : node.classDecl.typeClassName; + final typeArgs = node.classDecl.isObject + ? '' + : node.params + .accept(_TypeGenerator( + resolver, + forInterfaceImplementation: forInterfaceImplementation, + // Do type erasure for interface implementation. + typeErasure: forInterfaceImplementation, + )) + .join(', ') + .encloseIfNotEmpty('<', '>'); final prefix = resolver.resolvePrefix(node.classDecl); return _TypeClass( - '$ifConst$prefix${node.classDecl.typeClassName}($args)', + '$ifConst$prefix$type$typeArgs($args)', canBeConst, ); } @@ -859,30 +977,49 @@ class _TypeClassGenerator extends TypeVisitor<_TypeClass> { _TypeClass visitTypeVar(TypeVar node) { // TODO(https://github.com/dart-lang/native/issues/704): Tighten to typevar // bounds instead. + final type = + includeNullability && node.hasQuestionMark ? 'NullableType' : 'Type'; + final convertToNullable = + includeNullability && node.hasQuestionMark ? '.nullableType' : ''; if (typeErasure) { final ifConst = isConst ? 'const ' : ''; - return _TypeClass('$ifConst${_jObject}Type()', true); + return _TypeClass('$ifConst$_jObject$type()', true); } if (forInterfaceImplementation) { if (node.origin.parent is ClassDecl) { - return _TypeClass('_\$impls[\$p]!.${node.name}', false); + return _TypeClass( + '_\$impls[\$p]!.${node.name}$convertToNullable', false); } final ifConst = isConst ? 'const ' : ''; - return _TypeClass('$ifConst${_jObject}Type()', true); + return _TypeClass('$ifConst$_jObject$type()', true); } - return _TypeClass(node.name, false); + return _TypeClass('${node.name}$convertToNullable', false); } @override _TypeClass visitWildcard(Wildcard node) { // TODO(https://github.com/dart-lang/native/issues/701): Support wildcards. - return super.visitWildcard(node); + if (node.superBound != null || node.extendsBound == null) { + // Dart does not support `* super T` wildcards. Fall back to Object?. + return super.visitWildcard(node); + } + final typeClassGenerator = _TypeClassGenerator( + resolver, + boxPrimitives: boxPrimitives, + forInterfaceImplementation: forInterfaceImplementation, + includeNullability: includeNullability && node.isNullable, + isConst: isConst, + typeErasure: typeErasure, + ); + return node.extendsBound!.accept(typeClassGenerator); } @override _TypeClass visitNonPrimitiveType(ReferredType node) { final ifConst = isConst ? 'const ' : ''; - return _TypeClass('$ifConst${_jObject}Type()', true); + final type = + includeNullability && node.isNullable ? 'NullableType' : 'Type'; + return _TypeClass('$ifConst$_jObject$type()', true); } } @@ -893,7 +1030,8 @@ class _TypeParamDef extends Visitor { String visit(TypeParam node) { // TODO(https://github.com/dart-lang/native/issues/704): resolve the actual // type being extended, if any. - return '$_typeParamPrefix${node.name} extends $_jObject'; + final nullable = node.isNullable ? '?' : ''; + return '$_typeParamPrefix${node.name} extends $_jObject$nullable'; } } @@ -912,8 +1050,9 @@ class _JniResultGetter extends TypeVisitor { @override String visitNonPrimitiveType(ReferredType node) { - final type = node.accept(_TypeClassGenerator(resolver)).name; - return 'object($type)'; + final typeClass = node.accept(_TypeClassGenerator(resolver)).name; + final type = node.accept(_TypeGenerator(resolver)); + return 'object<$type>($typeClass)'; } } @@ -953,7 +1092,7 @@ class _ToNativeSuffix extends TypeVisitor { @override String visitNonPrimitiveType(ReferredType node) { - return '.$_selfPointer'; + return '.pointer'; } } @@ -1120,13 +1259,7 @@ ${modifier}final _$name = $_protectedExtension return node.asyncReturnType != null; } - String cCtor(Method node) { - final name = node.finalName; - final params = node.params.accept(const _ParamCall()).join(', '); - return '_$name($params).reference'; - } - - String dartOnlyCtor(Method node) { + String constructor(Method node) { final name = node.finalName; final params = [ '$classRef.reference.pointer', @@ -1136,20 +1269,10 @@ ${modifier}final _$name = $_protectedExtension return '_$name($params).reference'; } - String cMethodCall(Method node) { + String methodCall(Method node) { final name = node.finalName; final params = [ - if (!node.isStatic) _selfPointer, - ...node.params.accept(const _ParamCall()), - ].join(', '); - final resultGetter = node.returnType.accept(_JniResultGetter(resolver)); - return '_$name($params).$resultGetter'; - } - - String dartOnlyMethodCall(Method node) { - final name = node.finalName; - final params = [ - node.isStatic ? '$classRef.reference.pointer' : _selfPointer, + node.isStatic ? '$classRef.reference.pointer' : 'reference.pointer', '_id_$name as $_jni.JMethodIDPtr', ...node.params.accept(const _ParamCall()), ].join(', '); @@ -1192,12 +1315,21 @@ ${modifier}final _$name = $_protectedExtension .map((tp) => '$tp ??= $_jni.lowestCommonSuperType' '(${typeLocators[tp]}) as $_jType<$_typeParamPrefix$tp>;') .join(_newLine(depth: 2)); - + // This is needed to keep the references alive in the scope while waiting + // for the FFI call. + final localReferences = node.params + .accept(const _ParamReference()) + .where((ref) => ref.isNotEmpty) + .toList(); if (node.isConstructor) { final className = node.classDecl.finalName; final name = node.finalName; final ctorName = name == 'new\$' ? className : '$className.$name'; final paramsDef = node.params.accept(_ParamDef(resolver)).delimited(', '); + final typeParamsCall = node.classDecl.allTypeParams + .map((typeParam) => '$_typeParamPrefix${typeParam.name}') + .join(', ') + .encloseIfNotEmpty('<', '>'); final typeClassDef = node.classDecl.allTypeParams .map((typeParam) => typeParam .accept(_CtorTypeClassDef(isRequired: isRequired(typeParam)))) @@ -1207,11 +1339,12 @@ ${modifier}final _$name = $_protectedExtension .map((typeParam) => typeParam.name) .delimited(', '); - final ctorExpr = dartOnlyCtor(node); + final ctorExpr = constructor(node); s.write(''' factory $ctorName($paramsDef$typeClassDef) { $typeInference - return ${node.classDecl.finalName}.fromReference( + ${localReferences.join(_newLine(depth: 2))} + return ${node.classDecl.finalName}$typeParamsCall.fromReference( $typeClassCall $ctorExpr ); @@ -1243,23 +1376,29 @@ ${modifier}final _$name = $_protectedExtension .encloseIfNotEmpty('<', '>'); if (isSuspendFun(node)) { defArgs.removeLast(); + localReferences.removeLast(); } final params = defArgs.delimited(', '); s.write(' $ifStatic$returnType $name$typeParamsDef($params$typeClassDef)'); - final callExpr = dartOnlyMethodCall(node); + final callExpr = methodCall(node); if (isSuspendFun(node)) { final returningType = node.asyncReturnType!.accept(_TypeClassGenerator(resolver)).name; + final continuation = node.params.last.finalName; s.write('''async { $typeInference final \$p = $_jni.ReceivePort(); - final \$c = $_jObject.fromReference($_protectedExtension.newPortContinuation(\$p)); + final _\$$continuation = $_protectedExtension.newPortContinuation(\$p); + ${localReferences.join(_newLine(depth: 2))} $callExpr; + _\$$continuation.release(); final \$o = $_jGlobalReference($_jPointer.fromAddress(await \$p.first)); - final \$k = $returnTypeClass.jClass.reference.pointer; - if (!$_jni.Jni.env.IsInstanceOf(\$o.pointer, \$k)) { + final \$k = $returnTypeClass.jClass.reference; + if (!$_jni.Jni.env.IsInstanceOf(\$o.pointer, \$k.pointer)) { + \$k.release(); throw 'Failed'; } + \$k.release(); return $returningType.fromReference(\$o); } @@ -1268,6 +1407,7 @@ ${modifier}final _$name = $_protectedExtension final returning = returnType == 'void' ? callExpr : 'return $callExpr'; s.writeln('''{ $typeInference + ${localReferences.join(_newLine(depth: 2))} $returning; } '''); @@ -1334,6 +1474,30 @@ class _ParamDef extends Visitor { } } +/// Method parameter reference as a local variable. +/// +/// `JReference`s are finalizable, in order to make sure they will be kept alive +/// in the method's scope they have to be assigned to a local variable. +/// +/// For example: +/// ```dart +/// final _foo = foo.reference; +/// ``` +class _ParamReference extends Visitor { + const _ParamReference(); + + @override + String visit(Param node) { + if (node.type.kind == Kind.primitive) { + return ''; + } + final nullable = node.isNullable ? '?' : ''; + final orDefault = node.isNullable ? ' ?? $_jni.jNullReference' : ''; + return 'final _\$${node.finalName} = ' + '${node.finalName}$nullable.reference$orDefault;'; + } +} + /// Method parameter used in calling the native method. /// /// For example `foo.reference.pointer` in: @@ -1346,7 +1510,8 @@ class _ParamCall extends Visitor { @override String visit(Param node) { final nativeSuffix = node.type.accept(const _ToNativeSuffix()); - final paramCall = '${node.finalName}$nativeSuffix'; + final nonPrimitive = node.type.kind == Kind.primitive ? '' : r'_$'; + final paramCall = '$nonPrimitive${node.finalName}$nativeSuffix'; return paramCall; } } @@ -1408,6 +1573,9 @@ class _ParamTypeLocator extends Visitor>> { @override Map> visit(Param node) { + if (node.isNullable) { + return {}; + } return node.type.accept(_TypeVarLocator(resolver: resolver)).map( (key, value) => MapEntry( key, @@ -1433,7 +1601,11 @@ class _TypeVarLocator extends TypeVisitor>> { @override Map> visitWildcard(Wildcard node) { // TODO(https://github.com/dart-lang/native/issues/701): Support wildcards. - return super.visitWildcard(node); + if (node.superBound != null || node.extendsBound == null) { + // Dart does not support `* super T` wildcards. Fall back to Object?. + return super.visitWildcard(node); + } + return node.extendsBound!.accept(this); } @override @@ -1474,7 +1646,7 @@ class _TypeVarLocator extends TypeVisitor>> { @override Map> visitArrayType(ArrayType node) { - final exprs = node.type.accept(this); + final exprs = node.elementType.accept(this); for (final e in exprs.values.expand((i) => i)) { e.appendLeft('(('); e.prependRight(' as ${_jArray}Type).elementType as $_jType)'); @@ -1671,9 +1843,12 @@ class _InterfaceParamCast extends Visitor { resolver, boxPrimitives: true, forInterfaceImplementation: true, + includeNullability: false, )) .name; - s.write('\$a[$paramIndex].as($typeClass, releaseOriginal: true)'); + final nullable = + node.isNullable && node.type.kind != Kind.primitive ? '?' : '!'; + s.write('\$a![$paramIndex]$nullable.as($typeClass, releaseOriginal: true)'); if (node.type.kind == Kind.primitive) { // Convert to Dart type. final name = (node.type.type as PrimitiveType).name; @@ -1704,8 +1879,8 @@ class _InterfaceReturnBox extends TypeVisitor { // Casting is done to create a new global reference. The user might // use the original reference elsewhere and so the original object // should not be `setAsReleased`. - return '(\$r as $_jObject).as(const ${_jObject}Type())' - '.reference.toPointer()'; + return '(\$r as $_jObject?)?.as(const ${_jObject}Type())' + '.reference.toPointer() ?? $_jni.nullptr'; } @override diff --git a/pkgs/jnigen/lib/src/bindings/descriptor.dart b/pkgs/jnigen/lib/src/bindings/descriptor.dart index e5b0ab3bc..b309a38da 100644 --- a/pkgs/jnigen/lib/src/bindings/descriptor.dart +++ b/pkgs/jnigen/lib/src/bindings/descriptor.dart @@ -74,7 +74,7 @@ class TypeDescriptor extends TypeVisitor { @override String visitArrayType(ArrayType node) { - final inner = node.type.accept(this); + final inner = node.elementType.accept(this); return '[$inner'; } diff --git a/pkgs/jnigen/lib/src/bindings/excluder.dart b/pkgs/jnigen/lib/src/bindings/excluder.dart index c9fba9ab5..85f4a681c 100644 --- a/pkgs/jnigen/lib/src/bindings/excluder.dart +++ b/pkgs/jnigen/lib/src/bindings/excluder.dart @@ -35,6 +35,7 @@ class Excluder extends Visitor { void visit(Classes node) { node.decls.removeWhere((_, classDecl) { final excluded = classDecl.isPrivate || + classDecl.isExcluded || !(config.exclude?.classes?.included(classDecl) ?? true); if (excluded) { log.fine('Excluded class ${classDecl.binaryName}'); @@ -61,13 +62,17 @@ class _ClassExcluder extends Visitor { @override void visit(ClassDecl node) { node.methods = node.methods.where((method) { + final isExcluded = method.isExcluded; final isPrivate = method.isPrivate; final isAbstractCtor = method.isConstructor && node.isAbstract; final isBridgeMethod = method.isSynthetic && method.isBridge; final isExcludedInConfig = config.exclude?.methods?.included(node, method) ?? false; - final excluded = - isPrivate || isAbstractCtor || isBridgeMethod || isExcludedInConfig; + final excluded = isPrivate || + isAbstractCtor || + isBridgeMethod || + isExcludedInConfig || + isExcluded; if (excluded) { log.fine('Excluded method ${node.binaryName}#${method.name}'); } @@ -80,8 +85,9 @@ class _ClassExcluder extends Visitor { return !excluded; }).toList(); node.fields = node.fields.where((field) { - final excluded = field.isPrivate && - (config.exclude?.fields?.included(node, field) ?? true); + final excluded = field.isExcluded || + (field.isPrivate && + (config.exclude?.fields?.included(node, field) ?? true)); if (excluded) { log.fine('Excluded field ${node.binaryName}#${field.name}'); } diff --git a/pkgs/jnigen/lib/src/bindings/kotlin_processor.dart b/pkgs/jnigen/lib/src/bindings/kotlin_processor.dart index 4980debf9..b1539fa94 100644 --- a/pkgs/jnigen/lib/src/bindings/kotlin_processor.dart +++ b/pkgs/jnigen/lib/src/bindings/kotlin_processor.dart @@ -5,6 +5,31 @@ import '../elements/elements.dart'; import 'visitor.dart'; +String _toJavaBinaryName(String kotlinBinaryName) { + final binaryName = + kotlinBinaryName.replaceAll('.', r'$').replaceAll('/', '.'); + return const { + 'kotlin.Any': 'java.lang.Object', + 'kotlin.Byte': 'java.lang.Byte', + 'kotlin.Short': 'java.lang.Short', + 'kotlin.Int': 'java.lang.Integer', + 'kotlin.Long': 'java.lang.Long', + 'kotlin.Char': 'java.lang.Character', + 'kotlin.Float': 'java.lang.Float', + 'kotlin.Double': 'java.lang.Double', + 'kotlin.Boolean': 'java.lang.Boolean', + 'kotlin.Cloneable': 'java.lang.Cloneable', + 'kotlin.Comparable': 'java.lang.Comparable', + 'kotlin.Enum': 'java.lang.Enum', + 'kotlin.Annotation': 'java.lang.annotation.Annotation', + 'kotlin.CharSequence': 'java.lang.CharSequence', + 'kotlin.String': 'java.lang.String', + 'kotlin.Number': 'java.lang.Number', + 'kotlin.Throwable': 'java.lang.Throwable', + }[binaryName] ?? + binaryName; +} + /// A [Visitor] that adds the the information from Kotlin's metadata to the Java /// classes and methods. class KotlinProcessor extends Visitor { @@ -24,6 +49,46 @@ class _KotlinClassProcessor extends Visitor { return; } // This [ClassDecl] is actually a Kotlin class. + if (node.kotlinClass != null) { + for (var i = 0; i < node.kotlinClass!.typeParameters.length; ++i) { + node.typeParams[i].accept( + _KotlinTypeParamProcessor(node.kotlinClass!.typeParameters[i])); + } + if (node.superclass case final superClass?) { + final kotlinSuperTypes = node.kotlinClass!.superTypes.where( + (superType) => + _toJavaBinaryName(superType.name ?? '') == superClass.name, + ); + if (kotlinSuperTypes.isNotEmpty) { + superClass.accept(_KotlinTypeProcessor(kotlinSuperTypes.single)); + } + } + } + + // Matching fields and properties from the metadata. + final properties = {}; + final getters = {}; + final setters = {}; + final kotlinProperties = + (node.kotlinClass?.properties ?? node.kotlinPackage?.properties)!; + for (final property in kotlinProperties) { + if (property.fieldName case final fieldName?) { + properties[fieldName] = property; + } + if (property.getterName case final getterName?) { + final getterSignature = getterName + property.getterDescriptor!; + getters[getterSignature] = property; + } + if (property.setterName case final setterName?) { + final setterSignature = setterName + property.setterDescriptor!; + setters[setterSignature] = property; + } + } + for (final field in node.fields) { + if (properties[field.name] case final property?) { + field.accept(_KotlinPropertyProcessor(property)); + } + } // Matching methods and functions from the metadata. final functions = {}; final kotlinFunctions = @@ -32,15 +97,37 @@ class _KotlinClassProcessor extends Visitor { final signature = function.name + function.descriptor; functions[signature] = function; } + final constructors = {}; + final kotlinConstructors = node.kotlinClass?.constructors ?? []; + for (final constructor in kotlinConstructors) { + final signature = constructor.name + constructor.descriptor; + constructors[signature] = constructor; + } for (final method in node.methods) { final signature = method.name + method.descriptor!; - if (functions.containsKey(signature)) { - method.accept(_KotlinMethodProcessor(functions[signature]!)); + if (functions[signature] case final function?) { + method.accept(_KotlinMethodProcessor(function)); + } else if (constructors[signature] case final constructor?) { + method.accept(_KotlinConstructorProcessor(constructor)); + } else if (getters[signature] case final getter?) { + method.accept(_KotlinGetterProcessor(getter)); + } else if (setters[signature] case final setter?) { + method.accept(_KotlinSetterProcessor(setter)); } } } } +void _processParams( + List params, List kotlinParams) { + if (params.length != kotlinParams.length) { + return; + } + for (var i = 0; i < params.length; ++i) { + params[i].accept(_KotlinParamProcessor(kotlinParams[i])); + } +} + class _KotlinMethodProcessor extends Visitor { final KotlinFunction function; @@ -48,15 +135,155 @@ class _KotlinMethodProcessor extends Visitor { @override void visit(Method node) { + _processParams(node.params, function.valueParameters); + for (var i = 0; i < node.typeParams.length; ++i) { + node.typeParams[i] + .accept(_KotlinTypeParamProcessor(function.typeParameters[i])); + } if (function.isSuspend) { const kotlinContinutationType = 'kotlin.coroutines.Continuation'; assert(node.params.isNotEmpty && node.params.last.type.kind == Kind.declared && node.params.last.type.name == kotlinContinutationType); - final continuationType = node.params.last.type.type as DeclaredType; - node.asyncReturnType = continuationType.params.isEmpty + var continuationType = + (node.params.last.type.type as DeclaredType).params.firstOrNull; + if (continuationType != null && + continuationType.kind == Kind.wildcard && + (continuationType.type as Wildcard).superBound != null) { + continuationType = (continuationType.type as Wildcard).superBound!; + } + node.asyncReturnType = continuationType == null ? TypeUsage.object - : continuationType.params.first.clone(); + : continuationType.clone(); + node.asyncReturnType!.accept(_KotlinTypeProcessor(function.returnType)); + + // The continuation object is always non-null. + node.returnType.type.annotations ??= []; + node.returnType.type.annotations!.add(Annotation.nonNull); + } else { + node.returnType.accept(_KotlinTypeProcessor(function.returnType)); + } + } +} + +class _KotlinConstructorProcessor extends Visitor { + final KotlinConstructor constructor; + + _KotlinConstructorProcessor(this.constructor); + + @override + void visit(Method node) { + _processParams(node.params, constructor.valueParameters); + } +} + +class _KotlinGetterProcessor extends Visitor { + final KotlinProperty getter; + + _KotlinGetterProcessor(this.getter); + + @override + void visit(Method node) { + node.returnType.accept(_KotlinTypeProcessor(getter.returnType)); + } +} + +class _KotlinSetterProcessor extends Visitor { + final KotlinProperty setter; + + _KotlinSetterProcessor(this.setter); + + @override + void visit(Method node) { + if (setter.setterParameter case final setterParam?) { + node.params.single.type.accept(_KotlinTypeProcessor(setterParam.type)); } + node.params.single.type.accept(_KotlinTypeProcessor(setter.returnType)); + } +} + +class _KotlinPropertyProcessor extends Visitor { + final KotlinProperty property; + + _KotlinPropertyProcessor(this.property); + + @override + void visit(Field node) { + node.type.accept(_KotlinTypeProcessor(property.returnType)); + } +} + +class _KotlinParamProcessor extends Visitor { + final KotlinValueParameter kotlinParam; + + _KotlinParamProcessor(this.kotlinParam); + + @override + void visit(Param node) { + node.type.accept(_KotlinTypeProcessor(kotlinParam.type)); + } +} + +class _KotlinTypeParamProcessor extends Visitor { + final KotlinTypeParameter kotlinTypeParam; + + _KotlinTypeParamProcessor(this.kotlinTypeParam); + + @override + void visit(TypeParam node) { + final kotlinBounds = kotlinTypeParam.upperBounds; + final bounds = {}; + for (final bound in kotlinBounds) { + if (bound.name case final boundName?) { + bounds[_toJavaBinaryName(boundName)] = bound; + } + } + for (final bound in node.bounds) { + if (bounds[bound.name] case final kotlinBound?) { + bound.accept(_KotlinTypeProcessor(kotlinBound)); + } + } + } +} + +class _KotlinTypeProcessor extends TypeVisitor { + final KotlinType kotlinType; + + _KotlinTypeProcessor(this.kotlinType); + + @override + void visitDeclaredType(DeclaredType node) { + for (var i = 0; i < node.params.length; ++i) { + node.params[i].accept(_KotlinTypeProcessor(kotlinType.arguments[i].type)); + } + super.visitDeclaredType(node); + } + + @override + void visitArrayType(ArrayType node) { + if (kotlinType.arguments.isNotEmpty) { + node.elementType + .accept(_KotlinTypeProcessor(kotlinType.arguments.first.type)); + } + super.visitArrayType(node); + } + + @override + void visitWildcard(Wildcard node) { + node.extendsBound?.accept(_KotlinTypeProcessor(kotlinType)); + node.superBound?.accept(_KotlinTypeProcessor(kotlinType)); + super.visitWildcard(node); + } + + @override + void visitNonPrimitiveType(ReferredType node) { + node.annotations ??= []; + node.annotations! + .add(kotlinType.isNullable ? Annotation.nullable : Annotation.nonNull); + } + + @override + void visitPrimitiveType(PrimitiveType node) { + // Do nothing. } } diff --git a/pkgs/jnigen/lib/src/bindings/linker.dart b/pkgs/jnigen/lib/src/bindings/linker.dart index c6b8c097b..5749a28a9 100644 --- a/pkgs/jnigen/lib/src/bindings/linker.dart +++ b/pkgs/jnigen/lib/src/bindings/linker.dart @@ -94,21 +94,23 @@ class _ClassLinker extends Visitor { if (linked.contains(node)) return; log.finest('Linking ${node.binaryName}.'); linked.add(node); - final typeLinker = _TypeLinker(resolve, typeVarOrigin); - node.parent = node.parentName == null ? null : resolve(node.parentName); - node.parent?.accept(this); + node.outerClass = node.outerClassBinaryName == null + ? null + : resolve(node.outerClassBinaryName); + node.outerClass?.accept(this); // Add type params of outer classes to the nested classes. final allTypeParams = []; if (!node.isStatic) { - allTypeParams.addAll(node.parent?.allTypeParams ?? []); + allTypeParams.addAll(node.outerClass?.allTypeParams ?? []); } allTypeParams.addAll(node.typeParams); node.allTypeParams = allTypeParams; for (final typeParam in node.allTypeParams) { typeVarOrigin[typeParam.name] = typeParam; } + final typeLinker = _TypeLinker(resolve, typeVarOrigin); node.superclass ??= TypeUsage.object; node.superclass!.type.accept(typeLinker); @@ -148,39 +150,48 @@ class _MethodLinker extends Visitor { @override void visit(Method node) { - final usedDocklet = node.descriptor == null; - if (usedDocklet && - !node.classDecl.isStatic && + final hasOuterClassArg = !node.classDecl.isStatic && node.classDecl.isNested && - (node.isConstructor || node.isStatic)) { - // For now the nullity of [node.descriptor] identifies if the doclet - // backend was used and the method would potentially need "unnesting". - // Static methods and constructors of non-static nested classes take an - // instance of their outer class as the first parameter. - // - // This is not accounted for by the **doclet** summarizer, so we - // manually add it as the first parameter. - final parentTypeParamCount = node.classDecl.allTypeParams.length - + (node.isConstructor || node.isStatic); + if (hasOuterClassArg) { + final outerClassTypeParamCount = node.classDecl.allTypeParams.length - node.classDecl.typeParams.length; - final parentTypeParams = [ + final outerClassTypeParams = [ for (final typeParam - in node.classDecl.allTypeParams.take(parentTypeParamCount)) ...[ + in node.classDecl.allTypeParams.take(outerClassTypeParamCount)) ...[ TypeUsage( shorthand: typeParam.name, kind: Kind.typeVariable, typeJson: {}) - ..type = TypeVar(name: typeParam.name), + ..type = (TypeVar(name: typeParam.name) + ..annotations = [if (typeParam.hasNonNull) Annotation.nonNull]), ] ]; - final parentType = DeclaredType( - binaryName: node.classDecl.parent!.binaryName, - params: parentTypeParams, + final outerClassType = DeclaredType( + binaryName: node.classDecl.outerClass!.binaryName, + params: outerClassTypeParams, + // `$outerClass` parameter must not be null. + annotations: [Annotation.nonNull], ); - final parentTypeUsage = TypeUsage( - shorthand: parentType.binaryName, kind: Kind.declared, typeJson: {}) - ..type = parentType; - final param = Param(name: '\$parent', type: parentTypeUsage); - // Make the list modifiable. - if (node.params.isEmpty) node.params = []; - node.params.insert(0, param); + final outerClassTypeUsage = TypeUsage( + shorthand: outerClassType.binaryName, + kind: Kind.declared, + typeJson: {}, + )..type = outerClassType; + final param = Param(name: '\$outerClass', type: outerClassTypeUsage); + final usedDoclet = node.descriptor == null; + // For now the nullity of [node.descriptor] identifies if the doclet + // backend was used and the method would potentially need "unnesting". + // Static methods and constructors of non-static nested classes take an + // instance of their outer class as the first parameter. + // + // This is not accounted for by the **doclet** summarizer, so we + // manually add it as the first parameter. + if (usedDoclet) { + // Make the list modifiable. + if (node.params.isEmpty) node.params = []; + node.params.insert(0, param); + } else { + node.params.first = param; + } } for (final typeParam in node.typeParams) { typeVarOrigin[typeParam.name] = typeParam; @@ -222,7 +233,7 @@ class _TypeLinker extends TypeVisitor { @override void visitArrayType(ArrayType node) { - node.type.accept(this); + node.elementType.accept(this); } @override @@ -232,12 +243,12 @@ class _TypeLinker extends TypeVisitor { @override void visitPrimitiveType(PrimitiveType node) { - // Do nothing + // Do nothing. } @override void visitNonPrimitiveType(ReferredType node) { - // Do nothing + // Do nothing. } } diff --git a/pkgs/jnigen/lib/src/bindings/printer.dart b/pkgs/jnigen/lib/src/bindings/printer.dart new file mode 100644 index 000000000..121d3d0f7 --- /dev/null +++ b/pkgs/jnigen/lib/src/bindings/printer.dart @@ -0,0 +1,149 @@ +import '../elements/elements.dart'; +import 'visitor.dart'; + +class Printer extends Visitor { + const Printer(); + @override + void visit(Classes node) { + for (final MapEntry(:key, :value) in node.decls.entries) { + print('<$key>'); + const _ClassPrinter().visit(value); + print(''); + } + } +} + +class _ClassPrinter extends Visitor { + const _ClassPrinter(); + @override + void visit(ClassDecl node) { + print(' '); + for (final method in node.methods) { + method.accept(const _MethodPrinter()); + } + print(' '); + + print(' '); + for (final field in node.fields) { + field.accept(const _FieldPrinter()); + } + print(' '); + } +} + +class _MethodPrinter extends Visitor { + const _MethodPrinter(); + @override + void visit(Method node) { + print(' <${node.finalName}>'); + print(' '); + node.returnType.accept(_TypePrinter(8)); + print(' '); + print(' '); + for (final param in node.params) { + param.accept(const _ParamPrinter()); + } + print(' '); + print(' '); + } +} + +class _FieldPrinter extends Visitor { + const _FieldPrinter(); + @override + void visit(Field node) { + print(' <${node.finalName}>'); + node.type.accept(_TypePrinter(6)); + print(' '); + } +} + +class _ParamPrinter extends Visitor { + const _ParamPrinter(); + + @override + void visit(Param node) { + print(' <${node.finalName}>'); + node.type.type.accept(_TypePrinter(10)); + print(' '); + } +} + +class _TypePrinter extends TypeVisitor { + int depth; + _TypePrinter(this.depth); + + void printAnnotation(ReferredType node) { + if (node.annotations != null) { + print('${' ' * depth}'); + depth += 2; + for (final annotation in node.annotations!) { + annotation.accept(_AnnotationPrinter(depth)); + } + depth -= 2; + print('${' ' * depth}'); + } + } + + @override + void visitArrayType(ArrayType node) { + print('${' ' * depth}'); + depth += 2; + node.elementType.accept(this); + + printAnnotation(node); + + depth -= 2; + print('${' ' * depth}'); + } + + @override + void visitDeclaredType(DeclaredType node) { + print('${' ' * depth}<${node.classDecl.binaryName}>'); + depth += 2; + printAnnotation(node); + for (final param in node.params) { + param.accept(this); + } + depth -= 2; + print('${' ' * depth}'); + } + + @override + void visitTypeVar(TypeVar node) { + print('${' ' * depth}<${node.name}>'); + print('${' ' * (depth + 1)}'); + print('${' ' * (depth + 1)}${node.origin.name}'); + print('${' ' * (depth + 1)}'); + printAnnotation(node); + print('${' ' * depth}'); + } + + @override + void visitPrimitiveType(PrimitiveType node) { + print('${' ' * depth}<${node.name}>'); + printAnnotation(node); + print('${' ' * depth}'); + } + + @override + void visitWildcard(Wildcard node) { + print('${' ' * depth}<*>'); + printAnnotation(node); + print('${' ' * depth}'); + } + + @override + void visitNonPrimitiveType(ReferredType node) {} +} + +class _AnnotationPrinter extends Visitor { + int depth; + + _AnnotationPrinter(this.depth); + + @override + void visit(Annotation node) { + print('${' ' * depth}'); + } +} diff --git a/pkgs/jnigen/lib/src/bindings/renamer.dart b/pkgs/jnigen/lib/src/bindings/renamer.dart index b5a0b34c2..572a2eb96 100644 --- a/pkgs/jnigen/lib/src/bindings/renamer.dart +++ b/pkgs/jnigen/lib/src/bindings/renamer.dart @@ -155,7 +155,7 @@ class Renamer implements Visitor { class _ClassRenamer implements Visitor { final Config config; final Set renamed; - final Map classNameCounts = {}; + final Map topLevelNameCounts = {}; final Map> nameCounts = {}; _ClassRenamer( @@ -175,37 +175,43 @@ class _ClassRenamer implements Visitor { } node.methodNumsAfterRenaming = {}; - // TODO(https://github.com/dart-lang/native/issues/1516): Nested classes - // should continue to use dollar sign. - // TODO(https://github.com/dart-lang/native/issues/1544): Class names can - // have dollar signs even if not nested. - final className = _preprocess(node.name.replaceAll(r'$', '_')); + final superClass = (node.superclass!.type as DeclaredType).classDecl; + superClass.accept(this); + nameCounts[node]!.addAll(nameCounts[superClass] ?? {}); + + if (node.outerClass case final outerClass?) { + outerClass.accept(this); + } + + final outerClassName = + node.outerClass == null ? '' : '${node.outerClass!.finalName}\$'; + final className = '$outerClassName${_preprocess(node.name)}'; // When generating all the classes in a single file // the names need to be unique. final uniquifyName = config.outputConfig.dartConfig.structure == OutputStructure.singleFile; node.finalName = uniquifyName - ? _renameConflict(classNameCounts, className, _ElementKind.klass) + ? _renameConflict(topLevelNameCounts, className, _ElementKind.klass) : className; node.typeClassName = '\$${node.finalName}\$Type'; + node.nullableTypeClassName = '\$${node.finalName}\$NullableType'; log.fine('Class ${node.binaryName} is named ${node.finalName}'); - final superClass = (node.superclass!.type as DeclaredType).classDecl; - superClass.accept(this); - nameCounts[node]!.addAll(nameCounts[superClass] ?? {}); - // Rename fields before renaming methods. In case a method and a field have // identical names, the field will keep its original name and the // method will be renamed. - final fieldRenamer = _FieldRenamer(config, nameCounts[node]!); + final fieldRenamer = _FieldRenamer( + config, + uniquifyName && node.isTopLevel ? topLevelNameCounts : nameCounts[node]!, + ); for (final field in node.fields) { field.accept(fieldRenamer); } final methodRenamer = _MethodRenamer( config, - nameCounts[node]!, + uniquifyName && node.isTopLevel ? topLevelNameCounts : nameCounts[node]!, ); for (final method in node.methods) { method.accept(methodRenamer); @@ -246,13 +252,6 @@ class _MethodRenamer implements Visitor { for (final param in node.params) { param.accept(paramRenamer); } - - // Kotlin specific - if (node.asyncReturnType != null) { - // It's a suspend fun so the continuation parameter - // should be named $c instead - node.params.last.finalName = '\$c'; - } } } diff --git a/pkgs/jnigen/lib/src/bindings/resolver.dart b/pkgs/jnigen/lib/src/bindings/resolver.dart index a6805237c..25ba34ded 100644 --- a/pkgs/jnigen/lib/src/bindings/resolver.dart +++ b/pkgs/jnigen/lib/src/bindings/resolver.dart @@ -22,7 +22,10 @@ class Resolver { final List _importStrings = []; final Set _relativeImportedClasses = {}; - final Map _importedNameToClass = {}; + final Map _importedNameToClass = { + r'_$core': '', + r'_$jni': '', + }; final Map _classToImportedName = {}; Resolver({ @@ -51,7 +54,7 @@ class Resolver { /// Get the prefix for the class String resolvePrefix(ClassDecl classDecl) { if (classDecl.path == 'package:jni/jni.dart') { - return '_\$jni.'; + return r'jni$_.'; } final binaryName = classDecl.binaryName; final target = getFileClassName(binaryName); @@ -83,18 +86,14 @@ class Resolver { } final pkgName = cutFromLast(target, '.')[1].toLowerCase(); - if (pkgName.isEmpty) { - throw UnsupportedError('No package could be deduced from ' - 'qualified binaryName'); - } // We always name imports with an underscore suffix, so that they can be // never shadowed by a parameter or local variable. - var importedName = '${pkgName}_'; + var importedName = '$pkgName\$_'; var suffix = 0; while (_importedNameToClass.containsKey(importedName)) { - suffix++; - importedName = '$pkgName${suffix}_'; + ++suffix; + importedName = '$pkgName\$_$suffix'; } _importedNameToClass[importedName] = target; diff --git a/pkgs/jnigen/lib/src/config/config_types.dart b/pkgs/jnigen/lib/src/config/config_types.dart index 1d856e47a..bead7f371 100644 --- a/pkgs/jnigen/lib/src/config/config_types.dart +++ b/pkgs/jnigen/lib/src/config/config_types.dart @@ -10,6 +10,7 @@ import 'package:pub_semver/pub_semver.dart'; import 'package:yaml/yaml.dart'; import '../elements/elements.dart'; +import '../elements/j_elements.dart' as j_ast; import '../logging/logging.dart'; import '../util/find_package.dart'; import 'config_exception.dart'; @@ -265,22 +266,24 @@ void _validateClassName(String className) { /// Configuration for jnigen binding generation. class Config { - Config({ - required this.outputConfig, - required this.classes, - this.experiments, - this.exclude, - this.sourcePath, - this.classPath, - this.preamble, - this.customClassBody, - this.androidSdkConfig, - this.mavenDownloads, - this.summarizerOptions, - this.logLevel = Level.INFO, - this.dumpJsonTo, - this.imports, - }) { + Config( + {required this.outputConfig, + required this.classes, + this.experiments, + this.exclude, + this.sourcePath, + this.classPath, + this.preamble, + this.customClassBody, + this.androidSdkConfig, + this.mavenDownloads, + this.summarizerOptions, + this.nonNullAnnotations, + this.nullableAnnotations, + this.logLevel = Level.INFO, + this.dumpJsonTo, + this.imports, + this.visitors}) { for (final className in classes) { _validateClassName(className); } @@ -335,12 +338,21 @@ class Config { /// Call [importClasses] before using this. late final Map importedClasses; + /// Annotations specifying that this type is nullable. + final List? nullableAnnotations; + + /// Annotations specifying that this type is non-nullable. + final List? nonNullAnnotations; + /// Custom code that is added to the end of the class body with the specified /// binary name. /// /// Used for testing package:jnigen. final Map? customClassBody; + // User custom visitors. + List? visitors; + Future importClasses() async { importedClasses = {}; for (final import in [ @@ -401,9 +413,12 @@ class Config { ..path = '$importPath/$filePath' ..finalName = decl['name'] as String ..typeClassName = decl['type_class'] as String + ..nullableTypeClassName = decl['nullable_type_class'] as String ..superCount = decl['super_count'] as int ..allTypeParams = [] - ..parent = null; + // TODO(https://github.com/dart-lang/native/issues/746): include + // outerClass in the interop information. + ..outerClass = null; for (final typeParamEntry in (decl['type_params'] as YamlMap?)?.entries ?? >[]) { @@ -547,6 +562,12 @@ class Config { ) .toSet(), imports: prov.getPathList(_Props.import), + nonNullAnnotations: prov.hasValue(_Props.nonNullAnnotations) + ? prov.getStringList(_Props.nonNullAnnotations) + : null, + nullableAnnotations: prov.hasValue(_Props.nullableAnnotations) + ? prov.getStringList(_Props.nullableAnnotations) + : null, mavenDownloads: prov.hasValue(_Props.mavenDownloads) ? MavenDownloads( sourceDeps: prov.getStringList(_Props.sourceDeps) ?? const [], @@ -620,6 +641,9 @@ class _Props { static const preamble = 'preamble'; static const logLevel = 'log_level'; + static const nonNullAnnotations = 'non_null_annotations'; + static const nullableAnnotations = 'nullable_annotations'; + static const mavenDownloads = 'maven_downloads'; static const sourceDeps = '$mavenDownloads.source_deps'; static const mavenSourceDir = '$mavenDownloads.source_dir'; diff --git a/pkgs/jnigen/lib/src/elements/elements.dart b/pkgs/jnigen/lib/src/elements/elements.dart index b286576f5..d1bcaaadd 100644 --- a/pkgs/jnigen/lib/src/elements/elements.dart +++ b/pkgs/jnigen/lib/src/elements/elements.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; // Types to describe java API elements @@ -20,9 +21,8 @@ abstract class Element> { R accept(Visitor v); } -@JsonEnum() - /// A kind describes the type of a declaration. +@JsonEnum() enum DeclKind { @JsonValue('CLASS') classKind, @@ -57,9 +57,10 @@ class Classes implements Element { // option in java. @JsonSerializable(createToJson: false) -class ClassDecl extends ClassMember implements Element { +class ClassDecl with ClassMember, Annotated implements Element { ClassDecl({ - this.annotations = const [], + this.isExcluded = false, + this.annotations, this.javadoc, required this.declKind, this.modifiers = const {}, @@ -68,6 +69,7 @@ class ClassDecl extends ClassMember implements Element { this.methods = const [], this.fields = const [], this.superclass, + this.outerClassBinaryName, this.interfaces = const [], this.hasStaticInit = false, this.hasInstanceInit = false, @@ -76,10 +78,13 @@ class ClassDecl extends ClassMember implements Element { this.kotlinPackage, }); + bool isExcluded; + @override final Set modifiers; - final List annotations; + @override + List? annotations; final KotlinClass? kotlinClass; final KotlinPackage? kotlinPackage; final JavaDocComment? javadoc; @@ -95,6 +100,14 @@ class ClassDecl extends ClassMember implements Element { /// Will default to java.lang.Object if null by [Linker]. TypeUsage? superclass; + final String? outerClassBinaryName; + + /// Outer class's [ClassDecl] obtained from [outerClassBinaryName]. + /// + /// Populated by [Linker]. + @JsonKey(includeFromJson: false) + late final ClassDecl? outerClass; + /// Contains enum constant names if class is an enum, /// as obtained by `.values()` method in Java. final List? values; @@ -109,12 +122,6 @@ class ClassDecl extends ClassMember implements Element { @JsonKey(includeFromJson: false) late final int superCount; - /// Parent's [ClassDecl] obtained from [parentName]. - /// - /// Populated by [Linker]. - @JsonKey(includeFromJson: false) - late final ClassDecl? parent; - /// Final name of this class. /// /// Populated by [Renamer]. @@ -128,11 +135,19 @@ class ClassDecl extends ClassMember implements Element { @JsonKey(includeFromJson: false) late final String typeClassName; - /// Type parameters including the ones from its ancestors + /// Name of the nullable type class. + /// + /// Populated by [Renamer]. + @JsonKey(includeFromJson: false) + late final String nullableTypeClassName; + + /// Type parameters including the ones from its outer classes. + /// + /// For `Foo.Bar.Baz` it is [T, U, V, W]. /// /// Populated by [Linker]. @JsonKey(includeFromJson: false) - List allTypeParams = const []; + late final List allTypeParams; /// The path which this class is generated in. /// @@ -164,20 +179,22 @@ class ClassDecl extends ClassMember implements Element { @override ClassDecl get classDecl => this; + /// Simple name of this class without the outerclasses. + /// + /// This is not uniquely identifiable from the [binaryName]. For instance, + /// `com.xyz.Foo$Bar` could represent a class named `Bar` that is nested in a + /// class name `Foo` in which case its name is `Bar`. But it can also + /// represent a class named `Foo$Bar`. @override - String get name => binaryName.split('.').last; + String get name => binaryName + .substring((outerClassBinaryName?.length ?? -1) + 1) + .split('.') + .last; bool get isObject => superCount == 0; - // TODO(https://github.com/dart-lang/native/issues/1544): Use a better - // heuristic. Class names can have dollar signs without being nested. @JsonKey(includeFromJson: false) - late final String? parentName = binaryName.contains(r'$') - ? binaryName.splitMapJoin(RegExp(r'\$[^$]+$'), onMatch: (_) => '') - : null; - - @JsonKey(includeFromJson: false) - late final isNested = parentName != null; + bool get isNested => outerClassBinaryName != null; /// Whether the class is actually only a number of top-level Kotlin Functions. bool get isTopLevel => kotlinPackage != null; @@ -274,20 +291,21 @@ class TypeUsage { clonedType = ArrayType.fromJson(clonedTypeJson); break; } + clonedType.annotations = type.annotations; return TypeUsage(shorthand: shorthand, kind: kind, typeJson: clonedTypeJson) ..type = clonedType; } } -abstract class ReferredType { - const ReferredType(); +abstract class ReferredType with Annotated { + ReferredType(); String get name; R accept(TypeVisitor v); } class PrimitiveType extends ReferredType { - static const _primitives = { + static final _primitives = { 'byte': PrimitiveType._( name: 'byte', signature: 'B', @@ -362,17 +380,19 @@ class PrimitiveType extends ReferredType { ), }; - const PrimitiveType._({ + PrimitiveType._({ required this.name, required this.signature, required this.dartType, required this.boxedName, required this.cType, required this.ffiVarArgType, - }); + }) : annotations = null; @override final String name; + @override + List? annotations; final String signature; final String dartType; @@ -394,11 +414,14 @@ class PrimitiveType extends ReferredType { class DeclaredType extends ReferredType { DeclaredType({ required this.binaryName, + this.annotations, this.params = const [], }); final String binaryName; final List params; + @override + List? annotations; @JsonKey(includeFromJson: false) late ClassDecl classDecl; @@ -421,10 +444,46 @@ class TypeVar extends ReferredType { @JsonKey(includeFromJson: false) late final TypeParam origin; - TypeVar({required this.name}); + TypeVar({ + required this.name, + this.annotations, + }); @override String name; + @override + List? annotations; + + @override + bool get isNullable { + // A type-var is nullable if its origin is nullable. + if (origin.isNullable) { + return true; + } + // If origin is non-null, it has to be explicitly set as nullable. + if (!origin.isNullable && !hasNullable) { + return false; + } + return super.isNullable; + } + + /// Whether this type-variable has a question mark. + /// + /// This is different from [isNullable], a type-variable that extends + /// `JObject?` is nullable, so to get the reference from an object with this + /// type, a null check is needed. However type-variables can have an extra + /// question mark, meaning that even if the original type extends `JObject`, + /// this is nullable. + bool get hasQuestionMark { + // If the origin has any nullability set, this will only be nullable if it + // is explicitly set to be. + if (origin.hasNonNull || origin.hasNullable) { + return hasNullable; + } + // Otherwise it is always nullable unless explicitly set to be + // non-nullable. + return !hasNonNull; + } factory TypeVar.fromJson(Map json) => _$TypeVarFromJson(json); @@ -437,11 +496,23 @@ class TypeVar extends ReferredType { @JsonSerializable(createToJson: false) class Wildcard extends ReferredType { - Wildcard({this.extendsBound, this.superBound}); + Wildcard({ + this.extendsBound, + this.superBound, + this.annotations, + }); TypeUsage? extendsBound, superBound; + @override + bool get isNullable => + super.isNullable && + // If the extends bound is non-null, this is non-null. + !(extendsBound?.type.hasNonNull ?? false); + @override String get name => '?'; + @override + List? annotations; factory Wildcard.fromJson(Map json) => _$WildcardFromJson(json); @@ -454,11 +525,16 @@ class Wildcard extends ReferredType { @JsonSerializable(createToJson: false) class ArrayType extends ReferredType { - ArrayType({required this.type}); - TypeUsage type; + ArrayType({ + required this.elementType, + this.annotations, + }); + TypeUsage elementType; @override - String get name => '[${type.name}'; + String get name => '[${elementType.name}'; + @override + List? annotations; factory ArrayType.fromJson(Map json) => _$ArrayTypeFromJson(json); @@ -469,7 +545,58 @@ class ArrayType extends ReferredType { } } -abstract class ClassMember { +mixin Annotated { + abstract List? annotations; + + static final nullableAnnotations = [ + // Taken from https://kotlinlang.org/docs/java-interop.html#nullability-annotations + 'org.jetbrains.annotations.Nullable', + 'org.jspecify.nullness.Nullable', + 'com.android.annotations.Nullable', + 'androidx.annotation.Nullable', + 'android.support.annotations.Nullable', + 'edu.umd.cs.findbugs.annotations.Nullable', + 'org.eclipse.jdt.annotation.Nullable', + 'lombok.Nullable', + 'io.reactivex.rxjava3.annotations.Nullable', + ]; + late final bool hasNullable = () { + return annotations?.any((annotation) => + nullableAnnotations.contains(annotation.binaryName) || + annotation.binaryName == 'javax.annotation.Nonnull' && + annotation.properties['when'] == 'ALWAYS') ?? + false; + }(); + + static final nonNullAnnotations = [ + // Taken from https://kotlinlang.org/docs/java-interop.html#nullability-annotations + 'org.jetbrains.annotations.NotNull', + 'org.jspecify.nullness.NonNull', + 'com.android.annotations.NonNull', + 'androidx.annotation.NonNull', + 'android.support.annotations.NonNull', + 'edu.umd.cs.findbugs.annotations.NonNull', + 'org.eclipse.jdt.annotation.NonNull', + 'lombok.NonNull', + 'io.reactivex.rxjava3.annotations.NonNull', + ]; + late final hasNonNull = () { + return annotations?.any((annotation) => + nonNullAnnotations.contains(annotation.binaryName) || + annotation.binaryName == 'javax.annotation.Nonnull' && + annotation.properties['when'] == 'ALWAYS') ?? + false; //FIXME + }(); + + late final bool isNullable = () { + if (hasNullable) { + return true; + } + return !hasNonNull; + }(); +} + +mixin ClassMember { String get name; ClassDecl get classDecl; Set get modifiers; @@ -485,9 +612,10 @@ abstract class ClassMember { } @JsonSerializable(createToJson: false) -class Method extends ClassMember implements Element { +class Method with ClassMember, Annotated implements Element { Method({ - this.annotations = const [], + this.isExcluded = false, + this.annotations, this.javadoc, this.modifiers = const {}, required this.name, @@ -497,12 +625,14 @@ class Method extends ClassMember implements Element { required this.returnType, }); + bool isExcluded; + @override final String name; @override final Set modifiers; - - final List annotations; + @override + List? annotations; final JavaDocComment? javadoc; final List typeParams; List params; @@ -549,17 +679,21 @@ class Method extends ClassMember implements Element { } @JsonSerializable(createToJson: false) -class Param implements Element { +class Param with Annotated implements Element { Param({ - this.annotations = const [], + this.annotations, this.javadoc, required this.name, required this.type, }); - final List annotations; + @override + List? annotations; final JavaDocComment? javadoc; + @override + bool get isNullable => type.type.isNullable || super.hasNullable; + // Synthetic methods might not have parameter names. @JsonKey(defaultValue: 'synthetic') final String name; @@ -583,9 +717,10 @@ class Param implements Element { } @JsonSerializable(createToJson: false) -class Field extends ClassMember implements Element { +class Field with ClassMember, Annotated implements Element { Field({ - this.annotations = const [], + this.isExcluded = false, + this.annotations, this.javadoc, this.modifiers = const {}, required this.name, @@ -593,12 +728,15 @@ class Field extends ClassMember implements Element { this.defaultValue, }); + bool isExcluded; + @override final String name; @override final Set modifiers; - final List annotations; + @override + List? annotations; final JavaDocComment? javadoc; final TypeUsage type; final Object? defaultValue; @@ -624,12 +762,24 @@ class Field extends ClassMember implements Element { } @JsonSerializable(createToJson: false) -class TypeParam implements Element { - TypeParam({required this.name, this.bounds = const []}); +class TypeParam with Annotated implements Element { + TypeParam({ + required this.name, + this.bounds = const [], + this.annotations, + }); final String name; final List bounds; + @override + List? annotations; + + @override + bool get hasNonNull => + // A type param with any non-null bound is non-null. + super.hasNonNull || bounds.any((bound) => !bound.type.isNullable); + /// Can either be a [ClassDecl] or a [Method]. /// /// Populated by [Linker]. @@ -663,16 +813,112 @@ class JavaDocComment implements Element { } } +@visibleForTesting +List typePathFromString(String? string) { + if (string == null) return const []; + const innerClass = 46; + assert(innerClass == '.'.codeUnitAt(0)); + const array = 91; + assert(array == '['.codeUnitAt(0)); + const wildcard = 42; + assert(wildcard == '*'.codeUnitAt(0)); + const digit0 = 48; + assert(digit0 == '0'.codeUnitAt(0)); + const digit9 = 57; + assert(digit9 == '9'.codeUnitAt(0)); + const semicolon = 59; + assert(semicolon == ';'.codeUnitAt(0)); + final typePaths = []; + var number = 0; + for (final codeUnit in string.codeUnits) { + switch (codeUnit) { + case array: + typePaths.add(const ToArrayElement()); + case wildcard: + typePaths.add(const ToWildcardBound()); + case innerClass: + typePaths.add(const ToInnerClass()); + case >= digit0 && <= digit9: + number = number * 10 + codeUnit - digit0; + case semicolon: + typePaths.add(ToTypeParam(number)); + number = 0; + default: + throw const FormatException('Invalid type path'); + } + } + return typePaths; +} + +sealed class TypePathStep { + const TypePathStep(); +} + +final class ToArrayElement extends TypePathStep { + const ToArrayElement(); + @override + String toString() { + return '['; + } +} + +final class ToInnerClass extends TypePathStep { + const ToInnerClass(); + @override + String toString() { + return '.'; + } +} + +final class ToWildcardBound extends TypePathStep { + const ToWildcardBound(); + @override + String toString() { + return '*'; + } +} + +final class ToTypeParam extends TypePathStep { + final int index; + const ToTypeParam(this.index); + @override + String toString() { + return '$index;'; + } + + @override + bool operator ==(Object other) { + return other is ToTypeParam && index == other.index; + } + + @override + int get hashCode => (ToTypeParam).hashCode ^ index.hashCode; +} + @JsonSerializable(createToJson: false) class Annotation implements Element { - Annotation({ + /// Specifies that this type can be null. + static const Annotation nullable = + // Any other valid `Nullable` annotation would work. + Annotation(binaryName: 'androidx.annotation.Nullable'); + + /// Specifies that this type cannot be null. + static const Annotation nonNull = + // Any other valid `NonNull` annotation would work. + Annotation(binaryName: 'androidx.annotation.NonNull'); + + const Annotation({ required this.binaryName, this.properties = const {}, + this.typePath = const [], }); final String binaryName; final Map properties; + @JsonKey(fromJson: typePathFromString) + final List typePath; + factory Annotation.fromJson(Map json) => _$AnnotationFromJson(json); @@ -686,11 +932,39 @@ class Annotation implements Element { class KotlinClass implements Element { KotlinClass({ required this.name, + required this.moduleName, this.functions = const [], + this.properties = const [], + this.constructors = const [], + this.typeParameters = const [], + this.contextReceiverTypes = const [], + this.superTypes = const [], + this.nestedClasses = const [], + this.enumEntries = const [], + this.sealedClasses = const [], + required this.companionObject, + required this.inlineClassUnderlyingPropertyName, + required this.inlineClassUnderlyingType, + required this.flags, + required this.jvmFlags, }); final String name; + final String moduleName; final List functions; + final List properties; + final List constructors; + final List typeParameters; + final List contextReceiverTypes; + final List superTypes; + final List nestedClasses; + final List enumEntries; + final List sealedClasses; + final String? companionObject; + final String? inlineClassUnderlyingPropertyName; + final KotlinType? inlineClassUnderlyingType; + final int flags; + final int jvmFlags; factory KotlinClass.fromJson(Map json) => _$KotlinClassFromJson(json); @@ -705,9 +979,11 @@ class KotlinClass implements Element { class KotlinPackage implements Element { KotlinPackage({ this.functions = const [], + this.properties = const [], }); final List functions; + final List properties; factory KotlinPackage.fromJson(Map json) => _$KotlinPackageFromJson(json); @@ -719,28 +995,216 @@ class KotlinPackage implements Element { } @JsonSerializable(createToJson: false) -class KotlinFunction implements Element { +class KotlinFunction { KotlinFunction({ required this.name, required this.descriptor, required this.kotlinName, + this.valueParameters = const [], + required this.returnType, + this.receiverParameterType, + this.contextReceiverTypes = const [], + this.typeParameters = const [], + required this.flags, required this.isSuspend, }); + /// Name in the byte code. final String name; - - /// Used to match with [Method]'s descriptor. - /// - /// Creates a unique signature in combination with [name]. final String descriptor; + + /// Name in the Kotlin's metadata. final String kotlinName; + + final List valueParameters; + final KotlinType returnType; + final KotlinType? receiverParameterType; + final List contextReceiverTypes; + final List typeParameters; + final int flags; final bool isSuspend; factory KotlinFunction.fromJson(Map json) => _$KotlinFunctionFromJson(json); +} + +@JsonSerializable(createToJson: false) +class KotlinConstructor implements Element { + KotlinConstructor({ + required this.name, + required this.descriptor, + this.valueParameters = const [], + required this.flags, + }); + + final String name; + final String descriptor; + final List valueParameters; + final int flags; + + factory KotlinConstructor.fromJson(Map json) => + _$KotlinConstructorFromJson(json); + + @override + R accept(Visitor v) { + return v.visit(this); + } +} + +@JsonSerializable(createToJson: false) +class KotlinProperty implements Element { + KotlinProperty({ + this.fieldName, + this.fieldDescriptor, + this.getterName, + this.getterDescriptor, + this.setterName, + this.setterDescriptor, + required this.kotlinName, + required this.returnType, + required this.receiverParameterType, + this.contextReceiverTypes = const [], + required this.jvmFlags, + required this.flags, + required this.setterFlags, + required this.getterFlags, + this.typeParameters = const [], + required this.setterParameter, + }); + + final String? fieldName; + final String? fieldDescriptor; + + /// Getter's name in the byte code. + final String? getterName; + final String? getterDescriptor; + + /// Setter's name in the byte code. + final String? setterName; + final String? setterDescriptor; + + /// Name in the Kotlin's metadata. + final String kotlinName; + + final KotlinType returnType; + final KotlinType? receiverParameterType; + final List contextReceiverTypes; + final int jvmFlags; + final int flags; + final int setterFlags; + final int getterFlags; + final List typeParameters; + final KotlinValueParameter? setterParameter; + + factory KotlinProperty.fromJson(Map json) => + _$KotlinPropertyFromJson(json); + + @override + R accept(Visitor v) { + return v.visit(this); + } +} + +@JsonSerializable(createToJson: false) +class KotlinType implements Element { + KotlinType({ + required this.flags, + required this.kind, + required this.name, + required this.id, + required this.isNullable, + this.arguments = const [], + }); + + final int flags; + final String kind; + final String? name; + final int id; + final List arguments; + final bool isNullable; + + factory KotlinType.fromJson(Map json) => + _$KotlinTypeFromJson(json); + + @override + R accept(Visitor v) { + return v.visit(this); + } +} + +@JsonEnum() +enum KmVariance { + @JsonValue('INVARIANT') + invariant, + @JsonValue('IN') + contravariant, + @JsonValue('OUT') + covariant, +} + +@JsonSerializable(createToJson: false) +class KotlinTypeParameter implements Element { + KotlinTypeParameter({ + required this.name, + required this.id, + required this.flags, + this.upperBounds = const [], + required this.variance, + }); + + final String name; + final int id; + final int flags; + final List upperBounds; + final KmVariance variance; + + factory KotlinTypeParameter.fromJson(Map json) => + _$KotlinTypeParameterFromJson(json); + + @override + R accept(Visitor v) { + return v.visit(this); + } +} + +@JsonSerializable(createToJson: false) +class KotlinValueParameter implements Element { + KotlinValueParameter({ + required this.name, + required this.flags, + required this.type, + required this.varargElementType, + }); + + final String name; + final int flags; + final KotlinType type; + final KotlinType? varargElementType; + + factory KotlinValueParameter.fromJson(Map json) => + _$KotlinValueParameterFromJson(json); + + @override + R accept(Visitor v) { + return v.visit(this); + } +} + +@JsonSerializable(createToJson: false) +class KotlinTypeProjection implements Element { + KotlinTypeProjection({ + required this.type, + required this.variance, + }); + + final KotlinType type; + final KmVariance variance; + + factory KotlinTypeProjection.fromJson(Map json) => + _$KotlinTypeProjectionFromJson(json); @override - R accept(Visitor v) { + R accept(Visitor v) { return v.visit(this); } } diff --git a/pkgs/jnigen/lib/src/elements/elements.g.dart b/pkgs/jnigen/lib/src/elements/elements.g.dart index cb400e729..180741d65 100644 --- a/pkgs/jnigen/lib/src/elements/elements.g.dart +++ b/pkgs/jnigen/lib/src/elements/elements.g.dart @@ -8,9 +8,8 @@ part of 'elements.dart'; ClassDecl _$ClassDeclFromJson(Map json) => ClassDecl( annotations: (json['annotations'] as List?) - ?.map((e) => Annotation.fromJson(e as Map)) - .toList() ?? - const [], + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), javadoc: json['javadoc'] == null ? null : JavaDocComment.fromJson(json['javadoc'] as Map), @@ -35,6 +34,7 @@ ClassDecl _$ClassDeclFromJson(Map json) => ClassDecl( superclass: json['superclass'] == null ? null : TypeUsage.fromJson(json['superclass'] as Map), + outerClassBinaryName: json['outerClassBinaryName'] as String?, interfaces: (json['interfaces'] as List?) ?.map((e) => TypeUsage.fromJson(e as Map)) .toList() ?? @@ -74,6 +74,9 @@ const _$KindEnumMap = { DeclaredType _$DeclaredTypeFromJson(Map json) => DeclaredType( binaryName: json['binaryName'] as String, + annotations: (json['annotations'] as List?) + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), params: (json['params'] as List?) ?.map((e) => TypeUsage.fromJson(e as Map)) .toList() ?? @@ -82,6 +85,9 @@ DeclaredType _$DeclaredTypeFromJson(Map json) => DeclaredType( TypeVar _$TypeVarFromJson(Map json) => TypeVar( name: json['name'] as String, + annotations: (json['annotations'] as List?) + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), ); Wildcard _$WildcardFromJson(Map json) => Wildcard( @@ -91,17 +97,23 @@ Wildcard _$WildcardFromJson(Map json) => Wildcard( superBound: json['superBound'] == null ? null : TypeUsage.fromJson(json['superBound'] as Map), + annotations: (json['annotations'] as List?) + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), ); ArrayType _$ArrayTypeFromJson(Map json) => ArrayType( - type: TypeUsage.fromJson(json['type'] as Map), + elementType: + TypeUsage.fromJson(json['elementType'] as Map), + annotations: (json['annotations'] as List?) + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), ); Method _$MethodFromJson(Map json) => Method( annotations: (json['annotations'] as List?) - ?.map((e) => Annotation.fromJson(e as Map)) - .toList() ?? - const [], + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), javadoc: json['javadoc'] == null ? null : JavaDocComment.fromJson(json['javadoc'] as Map), @@ -125,9 +137,8 @@ Method _$MethodFromJson(Map json) => Method( Param _$ParamFromJson(Map json) => Param( annotations: (json['annotations'] as List?) - ?.map((e) => Annotation.fromJson(e as Map)) - .toList() ?? - const [], + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), javadoc: json['javadoc'] == null ? null : JavaDocComment.fromJson(json['javadoc'] as Map), @@ -137,9 +148,8 @@ Param _$ParamFromJson(Map json) => Param( Field _$FieldFromJson(Map json) => Field( annotations: (json['annotations'] as List?) - ?.map((e) => Annotation.fromJson(e as Map)) - .toList() ?? - const [], + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), javadoc: json['javadoc'] == null ? null : JavaDocComment.fromJson(json['javadoc'] as Map), @@ -158,6 +168,9 @@ TypeParam _$TypeParamFromJson(Map json) => TypeParam( ?.map((e) => TypeUsage.fromJson(e as Map)) .toList() ?? const [], + annotations: (json['annotations'] as List?) + ?.map((e) => Annotation.fromJson(e as Map)) + .toList(), ); JavaDocComment _$JavaDocCommentFromJson(Map json) => @@ -171,14 +184,61 @@ Annotation _$AnnotationFromJson(Map json) => Annotation( (k, e) => MapEntry(k, e as Object), ) ?? const {}, + typePath: json['typePath'] == null + ? const [] + : typePathFromString(json['typePath'] as String?), ); KotlinClass _$KotlinClassFromJson(Map json) => KotlinClass( name: json['name'] as String, + moduleName: json['moduleName'] as String, functions: (json['functions'] as List?) ?.map((e) => KotlinFunction.fromJson(e as Map)) .toList() ?? const [], + properties: (json['properties'] as List?) + ?.map((e) => KotlinProperty.fromJson(e as Map)) + .toList() ?? + const [], + constructors: (json['constructors'] as List?) + ?.map( + (e) => KotlinConstructor.fromJson(e as Map)) + .toList() ?? + const [], + typeParameters: (json['typeParameters'] as List?) + ?.map((e) => + KotlinTypeParameter.fromJson(e as Map)) + .toList() ?? + const [], + contextReceiverTypes: (json['contextReceiverTypes'] as List?) + ?.map((e) => KotlinType.fromJson(e as Map)) + .toList() ?? + const [], + superTypes: (json['superTypes'] as List?) + ?.map((e) => KotlinType.fromJson(e as Map)) + .toList() ?? + const [], + nestedClasses: (json['nestedClasses'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + enumEntries: (json['enumEntries'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + sealedClasses: (json['sealedClasses'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + companionObject: json['companionObject'] as String?, + inlineClassUnderlyingPropertyName: + json['inlineClassUnderlyingPropertyName'] as String?, + inlineClassUnderlyingType: json['inlineClassUnderlyingType'] == null + ? null + : KotlinType.fromJson( + json['inlineClassUnderlyingType'] as Map), + flags: (json['flags'] as num).toInt(), + jvmFlags: (json['jvmFlags'] as num).toInt(), ); KotlinPackage _$KotlinPackageFromJson(Map json) => @@ -187,6 +247,10 @@ KotlinPackage _$KotlinPackageFromJson(Map json) => ?.map((e) => KotlinFunction.fromJson(e as Map)) .toList() ?? const [], + properties: (json['properties'] as List?) + ?.map((e) => KotlinProperty.fromJson(e as Map)) + .toList() ?? + const [], ); KotlinFunction _$KotlinFunctionFromJson(Map json) => @@ -194,5 +258,122 @@ KotlinFunction _$KotlinFunctionFromJson(Map json) => name: json['name'] as String, descriptor: json['descriptor'] as String, kotlinName: json['kotlinName'] as String, + valueParameters: (json['valueParameters'] as List?) + ?.map((e) => + KotlinValueParameter.fromJson(e as Map)) + .toList() ?? + const [], + returnType: + KotlinType.fromJson(json['returnType'] as Map), + receiverParameterType: json['receiverParameterType'] == null + ? null + : KotlinType.fromJson( + json['receiverParameterType'] as Map), + contextReceiverTypes: (json['contextReceiverTypes'] as List?) + ?.map((e) => KotlinType.fromJson(e as Map)) + .toList() ?? + const [], + typeParameters: (json['typeParameters'] as List?) + ?.map((e) => + KotlinTypeParameter.fromJson(e as Map)) + .toList() ?? + const [], + flags: (json['flags'] as num).toInt(), isSuspend: json['isSuspend'] as bool, ); + +KotlinConstructor _$KotlinConstructorFromJson(Map json) => + KotlinConstructor( + name: json['name'] as String, + descriptor: json['descriptor'] as String, + valueParameters: (json['valueParameters'] as List?) + ?.map((e) => + KotlinValueParameter.fromJson(e as Map)) + .toList() ?? + const [], + flags: (json['flags'] as num).toInt(), + ); + +KotlinProperty _$KotlinPropertyFromJson(Map json) => + KotlinProperty( + fieldName: json['fieldName'] as String?, + fieldDescriptor: json['fieldDescriptor'] as String?, + getterName: json['getterName'] as String?, + getterDescriptor: json['getterDescriptor'] as String?, + setterName: json['setterName'] as String?, + setterDescriptor: json['setterDescriptor'] as String?, + kotlinName: json['kotlinName'] as String, + returnType: + KotlinType.fromJson(json['returnType'] as Map), + receiverParameterType: json['receiverParameterType'] == null + ? null + : KotlinType.fromJson( + json['receiverParameterType'] as Map), + contextReceiverTypes: (json['contextReceiverTypes'] as List?) + ?.map((e) => KotlinType.fromJson(e as Map)) + .toList() ?? + const [], + jvmFlags: (json['jvmFlags'] as num).toInt(), + flags: (json['flags'] as num).toInt(), + setterFlags: (json['setterFlags'] as num).toInt(), + getterFlags: (json['getterFlags'] as num).toInt(), + typeParameters: (json['typeParameters'] as List?) + ?.map((e) => + KotlinTypeParameter.fromJson(e as Map)) + .toList() ?? + const [], + setterParameter: json['setterParameter'] == null + ? null + : KotlinValueParameter.fromJson( + json['setterParameter'] as Map), + ); + +KotlinType _$KotlinTypeFromJson(Map json) => KotlinType( + flags: (json['flags'] as num).toInt(), + kind: json['kind'] as String, + name: json['name'] as String?, + id: (json['id'] as num).toInt(), + isNullable: json['isNullable'] as bool, + arguments: (json['arguments'] as List?) + ?.map((e) => + KotlinTypeProjection.fromJson(e as Map)) + .toList() ?? + const [], + ); + +KotlinTypeParameter _$KotlinTypeParameterFromJson(Map json) => + KotlinTypeParameter( + name: json['name'] as String, + id: (json['id'] as num).toInt(), + flags: (json['flags'] as num).toInt(), + upperBounds: (json['upperBounds'] as List?) + ?.map((e) => KotlinType.fromJson(e as Map)) + .toList() ?? + const [], + variance: $enumDecode(_$KmVarianceEnumMap, json['variance']), + ); + +const _$KmVarianceEnumMap = { + KmVariance.invariant: 'INVARIANT', + KmVariance.contravariant: 'IN', + KmVariance.covariant: 'OUT', +}; + +KotlinValueParameter _$KotlinValueParameterFromJson( + Map json) => + KotlinValueParameter( + name: json['name'] as String, + flags: (json['flags'] as num).toInt(), + type: KotlinType.fromJson(json['type'] as Map), + varargElementType: json['varargElementType'] == null + ? null + : KotlinType.fromJson( + json['varargElementType'] as Map), + ); + +KotlinTypeProjection _$KotlinTypeProjectionFromJson( + Map json) => + KotlinTypeProjection( + type: KotlinType.fromJson(json['type'] as Map), + variance: $enumDecode(_$KmVarianceEnumMap, json['variance']), + ); diff --git a/pkgs/jnigen/lib/src/elements/j_elements.dart b/pkgs/jnigen/lib/src/elements/j_elements.dart new file mode 100644 index 000000000..883786aea --- /dev/null +++ b/pkgs/jnigen/lib/src/elements/j_elements.dart @@ -0,0 +1,85 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'elements.dart' as ast; + +abstract class Element { + void accept(Visitor visitor); +} + +abstract class Visitor { + void visitClass(ClassDecl c) {} + void visitMethod(Method method) {} + void visitField(Field field) {} +} + +class Classes implements Element { + Classes(this._classes); + final ast.Classes _classes; + + @override + void accept(Visitor visitor) { + for (final value in _classes.decls.values) { + final classDecl = ClassDecl(value); + classDecl.accept(visitor); + } + } + + void let(void Function(dynamic userClasses) param0) {} +} + +class ClassDecl implements Element { + ClassDecl(this._classDecl) : binaryName = _classDecl.binaryName; + final ast.ClassDecl _classDecl; + + // Ex: com.x.Foo. + final String binaryName; + + bool get isExcluded => _classDecl.isExcluded; + set isExcluded(bool value) => _classDecl.isExcluded = value; + + @override + void accept(Visitor visitor) { + visitor.visitClass(this); + if (_classDecl.isExcluded) return; + for (final method in _classDecl.methods) { + Method(method).accept(visitor); + } + for (var field in _classDecl.fields) { + Field(field).accept(visitor); + } + } +} + +class Method implements Element { + Method(this._method); + + final ast.Method _method; + + String get name => _method.name; + + bool get isExcluded => _method.isExcluded; + set isExcluded(bool value) => _method.isExcluded = value; + + @override + void accept(Visitor visitor) { + visitor.visitMethod(this); + } +} + +class Field implements Element { + Field(this._field); + + final ast.Field _field; + + String get name => _field.name; + + bool get isExcluded => _field.isExcluded; + set isExcluded(bool value) => _field.isExcluded = value; + + @override + void accept(Visitor visitor) { + visitor.visitField(this); + } +} diff --git a/pkgs/jnigen/lib/src/generate_bindings.dart b/pkgs/jnigen/lib/src/generate_bindings.dart index 89231ebab..6d185f242 100644 --- a/pkgs/jnigen/lib/src/generate_bindings.dart +++ b/pkgs/jnigen/lib/src/generate_bindings.dart @@ -13,6 +13,7 @@ import 'bindings/linker.dart'; import 'bindings/renamer.dart'; import 'config/config.dart'; import 'elements/elements.dart'; +import 'elements/j_elements.dart' as j_ast; import 'logging/logging.dart'; import 'summary/summary.dart'; import 'tools/tools.dart'; @@ -20,6 +21,9 @@ import 'tools/tools.dart'; void collectOutputStream(Stream> stream, StringBuffer buffer) => stream.transform(const Utf8Decoder()).forEach(buffer.write); Future generateJniBindings(Config config) async { + Annotated.nonNullAnnotations.addAll(config.nonNullAnnotations ?? []); + Annotated.nullableAnnotations.addAll(config.nullableAnnotations ?? []); + setLoggingLevel(config.logLevel); await buildSummarizerIfNotExists(); @@ -35,11 +39,15 @@ Future generateJniBindings(Config config) async { log.fatal(e.message); } + final userClasses = j_ast.Classes(classes); + config.visitors?.forEach(userClasses.accept); + classes.accept(Excluder(config)); classes.accept(KotlinProcessor()); await classes.accept(Linker(config)); classes.accept(const Descriptor()); classes.accept(Renamer(config)); + // classes.accept(const Printer()); try { await classes.accept(DartGenerator(config)); diff --git a/pkgs/jnigen/lib/src/tools/android_sdk_tools.dart b/pkgs/jnigen/lib/src/tools/android_sdk_tools.dart index f1ea1462d..a1016622e 100644 --- a/pkgs/jnigen/lib/src/tools/android_sdk_tools.dart +++ b/pkgs/jnigen/lib/src/tools/android_sdk_tools.dart @@ -203,11 +203,30 @@ task $_gradleGetSourcesTaskName(type: Copy) { } if (procRes.exitCode != 0) { final inAndroidProject = - (androidProject == '.') ? '' : ' in $androidProject'; - throw GradleException('\n\ngradle exited with status ' - '${procRes.exitCode}\n. This can be because the Android build is not ' - 'yet cached. Please run `flutter build apk`$inAndroidProject and try ' - 'again\n'); + (androidProject == '') ? '' : ' in $androidProject'; + throw GradleException('''\n\nGradle execution failed. + +1. The most likely cause is that the Android build is not yet cached. + +Run `flutter build apk`$inAndroidProject and try again. + +2. If the Gradle output includes text like this: + +* What went wrong: +Execution failed for task ':gradle:compileGroovy'. +> BUG! exception in phase 'semantic analysis' ... Unsupported class file major version + +Then the JDK versions used by jnigen and flutter are not compatible. Try +changing the default JDK version e.g. with `export JAVA_VERSION=11` on macOS and +`sudo update-alternatives --config java` on Ubuntu. + +GRADLE OUTPUT: +-------------------------------------------------------------------------------- + +${procRes.stderr} + +-------------------------------------------------------------------------------- +'''); } // Record both stdout and stderr of gradle. log.writeSectionToFile('Gradle logs ($stubName)', procRes.stderr); diff --git a/pkgs/jnigen/pubspec.yaml b/pkgs/jnigen/pubspec.yaml index ff495d62e..00accf350 100644 --- a/pkgs/jnigen/pubspec.yaml +++ b/pkgs/jnigen/pubspec.yaml @@ -4,8 +4,9 @@ name: jnigen description: A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine. -version: 0.12.2-wip +version: 0.13.0 repository: https://github.com/dart-lang/native/tree/main/pkgs/jnigen +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ajnigen environment: sdk: '>=3.3.0 <4.0.0' diff --git a/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart b/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart index 3920a2da5..df2aad4f5 100644 --- a/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart +++ b/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart @@ -17,11 +17,11 @@ void registerTests(String groupName, TestRunnerCallback test) { final json = JString.fromString('[1, true, false, 2, 4]'); JsonFactory factory; factory = JsonFactory(); - final parser = factory.createParser$6(json); + final parser = factory.createParser$6(json)!; final values = []; while (!parser.isClosed()) { final next = parser.nextToken(); - if (next.isNull) continue; + if (next == null) continue; values.add(next.isNumeric()); next.release(); } @@ -34,7 +34,7 @@ void registerTests(String groupName, TestRunnerCallback test) { using((arena) { final factory = JsonFactory()..releasedBy(arena); final erroneous = factory - .createParser$6(''.toJString()..releasedBy(arena)) + .createParser$6(''.toJString()..releasedBy(arena))! ..releasedBy(arena); expect(erroneous.nextToken, throwsA(isA())); }); diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart index 560a32074..65477c199 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart @@ -37,6 +37,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -46,55 +47,58 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; -import 'JsonParser.dart' as jsonparser_; +import 'JsonParser.dart' as jsonparser$_; /// from: `com.fasterxml.jackson.core.JsonFactory$Feature` /// /// Enumeration that defines all on/off features that can only be /// changed for JsonFactory. -class JsonFactory_Feature extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - JsonFactory_Feature.fromReference( - _$jni.JReference reference, +class JsonFactory$Feature extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JsonFactory$Feature.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/fasterxml/jackson/core/JsonFactory$Feature'); + jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonFactory$Feature'); /// The type which includes information such as the signature of this class. - static const type = $JsonFactory_Feature$Type(); + static const nullableType = $JsonFactory$Feature$NullableType(); + static const type = $JsonFactory$Feature$Type(); static final _id_values = _class.staticMethodId( r'values', r'()[Lcom/fasterxml/jackson/core/JsonFactory$Feature;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.fasterxml.jackson.core.JsonFactory.Feature[] values()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($JsonFactory_Feature$Type())); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $JsonFactory$Feature$NullableType())); } static final _id_valueOf = _class.staticMethodId( @@ -102,25 +106,27 @@ class JsonFactory_Feature extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonFactory$Feature;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public com.fasterxml.jackson.core.JsonFactory.Feature valueOf(java.lang.String name)` /// The returned object must be released after use, by calling the [release] method. - static JsonFactory_Feature valueOf( - _$jni.JString name, + static JsonFactory$Feature? valueOf( + jni$_.JString? name, ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - name.reference.pointer) - .object(const $JsonFactory_Feature$Type()); + final _$name = name?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$name.pointer) + .object( + const $JsonFactory$Feature$NullableType()); } static final _id_collectDefaults = _class.staticMethodId( @@ -128,16 +134,16 @@ class JsonFactory_Feature extends _$jni.JObject { r'()I', ); - static final _collectDefaults = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _collectDefaults = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public int collectDefaults()` @@ -147,7 +153,7 @@ class JsonFactory_Feature extends _$jni.JObject { ///@return Bit field of features enabled by default static int collectDefaults() { return _collectDefaults( - _class.reference.pointer, _id_collectDefaults as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_collectDefaults as jni$_.JMethodIDPtr) .integer; } @@ -156,22 +162,22 @@ class JsonFactory_Feature extends _$jni.JObject { r'()Z', ); - static final _enabledByDefault = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _enabledByDefault = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean enabledByDefault()` bool enabledByDefault() { return _enabledByDefault( - reference.pointer, _id_enabledByDefault as _$jni.JMethodIDPtr) + reference.pointer, _id_enabledByDefault as jni$_.JMethodIDPtr) .boolean; } @@ -180,23 +186,23 @@ class JsonFactory_Feature extends _$jni.JObject { r'(I)Z', ); - static final _enabledIn = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallBooleanMethod') + static final _enabledIn = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public boolean enabledIn(int flags)` bool enabledIn( int flags, ) { return _enabledIn( - reference.pointer, _id_enabledIn as _$jni.JMethodIDPtr, flags) + reference.pointer, _id_enabledIn as jni$_.JMethodIDPtr, flags) .boolean; } @@ -205,54 +211,99 @@ class JsonFactory_Feature extends _$jni.JObject { r'()I', ); - static final _getMask = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getMask = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getMask()` int getMask() { - return _getMask(reference.pointer, _id_getMask as _$jni.JMethodIDPtr) + return _getMask(reference.pointer, _id_getMask as jni$_.JMethodIDPtr) .integer; } } -final class $JsonFactory_Feature$Type - extends _$jni.JObjType { - @_$jni.internal - const $JsonFactory_Feature$Type(); +final class $JsonFactory$Feature$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JsonFactory$Feature$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/fasterxml/jackson/core/JsonFactory$Feature;'; - @_$jni.internal - @_$core.override - JsonFactory_Feature fromReference(_$jni.JReference reference) => - JsonFactory_Feature.fromReference(reference); + @jni$_.internal + @core$_.override + JsonFactory$Feature? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JsonFactory$Feature.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => ($JsonFactory$Feature$NullableType).hashCode; - @_$jni.internal - @_$core.override + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonFactory$Feature$NullableType) && + other is $JsonFactory$Feature$NullableType; + } +} + +final class $JsonFactory$Feature$Type + extends jni$_.JObjType { + @jni$_.internal + const $JsonFactory$Feature$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/fasterxml/jackson/core/JsonFactory$Feature;'; + + @jni$_.internal + @core$_.override + JsonFactory$Feature fromReference(jni$_.JReference reference) => + JsonFactory$Feature.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonFactory$Feature$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($JsonFactory_Feature$Type).hashCode; + @core$_.override + int get hashCode => ($JsonFactory$Feature$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($JsonFactory_Feature$Type) && - other is $JsonFactory_Feature$Type; + return other.runtimeType == ($JsonFactory$Feature$Type) && + other is $JsonFactory$Feature$Type; } } @@ -275,21 +326,22 @@ final class $JsonFactory_Feature$Type /// the default constructor is used for constructing factory /// instances. ///@author Tatu Saloranta -class JsonFactory extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class JsonFactory extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal JsonFactory.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/fasterxml/jackson/core/JsonFactory'); + jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonFactory'); /// The type which includes information such as the signature of this class. + static const nullableType = $JsonFactory$NullableType(); static const type = $JsonFactory$Type(); static final _id_FORMAT_NAME_JSON = _class.staticFieldId( r'FORMAT_NAME_JSON', @@ -301,8 +353,8 @@ class JsonFactory extends _$jni.JObject { /// /// Name used to identify JSON format /// (and returned by \#getFormatName() - static _$jni.JString get FORMAT_NAME_JSON => - _id_FORMAT_NAME_JSON.get(_class, const _$jni.JStringType()); + static jni$_.JString? get FORMAT_NAME_JSON => + _id_FORMAT_NAME_JSON.get(_class, const jni$_.JStringNullableType()); static final _id_DEFAULT_ROOT_VALUE_SEPARATOR = _class.staticFieldId( r'DEFAULT_ROOT_VALUE_SEPARATOR', @@ -311,8 +363,9 @@ class JsonFactory extends _$jni.JObject { /// from: `static public final com.fasterxml.jackson.core.SerializableString DEFAULT_ROOT_VALUE_SEPARATOR` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JObject get DEFAULT_ROOT_VALUE_SEPARATOR => - _id_DEFAULT_ROOT_VALUE_SEPARATOR.get(_class, const _$jni.JObjectType()); + static jni$_.JObject? get DEFAULT_ROOT_VALUE_SEPARATOR => + _id_DEFAULT_ROOT_VALUE_SEPARATOR.get( + _class, const jni$_.JObjectNullableType()); /// from: `static public final char DEFAULT_QUOTE_CHAR` /// @@ -322,16 +375,16 @@ class JsonFactory extends _$jni.JObject { r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` @@ -347,7 +400,7 @@ class JsonFactory extends _$jni.JObject { /// factory instance. factory JsonFactory() { return JsonFactory.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -355,24 +408,25 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/ObjectCodec;)V', ); - static final _new$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (com.fasterxml.jackson.core.ObjectCodec oc)` /// The returned object must be released after use, by calling the [release] method. factory JsonFactory.new$1( - _$jni.JObject oc, + jni$_.JObject? oc, ) { + final _$oc = oc?.reference ?? jni$_.jNullReference; return JsonFactory.fromReference(_new$1(_class.reference.pointer, - _id_new$1 as _$jni.JMethodIDPtr, oc.reference.pointer) + _id_new$1 as jni$_.JMethodIDPtr, _$oc.pointer) .reference); } @@ -380,16 +434,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonFactoryBuilder;)V', ); - static final _new$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void (com.fasterxml.jackson.core.JsonFactoryBuilder b)` /// The returned object must be released after use, by calling the [release] method. @@ -398,10 +452,11 @@ class JsonFactory extends _$jni.JObject { ///@param b Builder that contains settings to use ///@since 2.10 factory JsonFactory.new$2( - _$jni.JObject b, + jni$_.JObject? b, ) { + final _$b = b?.reference ?? jni$_.jNullReference; return JsonFactory.fromReference(_new$2(_class.reference.pointer, - _id_new$2 as _$jni.JMethodIDPtr, b.reference.pointer) + _id_new$2 as jni$_.JMethodIDPtr, _$b.pointer) .reference); } @@ -410,16 +465,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/TSFBuilder;', ); - static final _rebuild = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _rebuild = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.TSFBuilder rebuild()` @@ -429,9 +484,9 @@ class JsonFactory extends _$jni.JObject { /// with settings of this factory. ///@return Builder instance to use ///@since 2.10 - _$jni.JObject rebuild() { - return _rebuild(reference.pointer, _id_rebuild as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? rebuild() { + return _rebuild(reference.pointer, _id_rebuild as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_builder = _class.staticMethodId( @@ -439,16 +494,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/TSFBuilder;', ); - static final _builder = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _builder = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.fasterxml.jackson.core.TSFBuilder builder()` @@ -462,9 +517,9 @@ class JsonFactory extends _$jni.JObject { /// NOTE: signature unfortunately does not expose true implementation type; this /// will be fixed in 3.0. ///@return Builder instance to use - static _$jni.JObject builder() { - return _builder(_class.reference.pointer, _id_builder as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + static jni$_.JObject? builder() { + return _builder(_class.reference.pointer, _id_builder as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_copy = _class.instanceMethodId( @@ -472,16 +527,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _copy = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _copy = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.JsonFactory copy()` @@ -499,9 +554,9 @@ class JsonFactory extends _$jni.JObject { /// set codec after making the copy. ///@return Copy of this factory instance ///@since 2.1 - JsonFactory copy() { - return _copy(reference.pointer, _id_copy as _$jni.JMethodIDPtr) - .object(const $JsonFactory$Type()); + JsonFactory? copy() { + return _copy(reference.pointer, _id_copy as jni$_.JMethodIDPtr) + .object(const $JsonFactory$NullableType()); } static final _id_requiresPropertyOrdering = _class.instanceMethodId( @@ -509,16 +564,16 @@ class JsonFactory extends _$jni.JObject { r'()Z', ); - static final _requiresPropertyOrdering = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _requiresPropertyOrdering = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean requiresPropertyOrdering()` @@ -539,7 +594,7 @@ class JsonFactory extends _$jni.JObject { ///@since 2.3 bool requiresPropertyOrdering() { return _requiresPropertyOrdering(reference.pointer, - _id_requiresPropertyOrdering as _$jni.JMethodIDPtr) + _id_requiresPropertyOrdering as jni$_.JMethodIDPtr) .boolean; } @@ -548,16 +603,16 @@ class JsonFactory extends _$jni.JObject { r'()Z', ); - static final _canHandleBinaryNatively = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _canHandleBinaryNatively = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean canHandleBinaryNatively()` @@ -575,7 +630,7 @@ class JsonFactory extends _$jni.JObject { ///@since 2.3 bool canHandleBinaryNatively() { return _canHandleBinaryNatively(reference.pointer, - _id_canHandleBinaryNatively as _$jni.JMethodIDPtr) + _id_canHandleBinaryNatively as jni$_.JMethodIDPtr) .boolean; } @@ -584,16 +639,16 @@ class JsonFactory extends _$jni.JObject { r'()Z', ); - static final _canUseCharArrays = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _canUseCharArrays = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean canUseCharArrays()` @@ -611,7 +666,7 @@ class JsonFactory extends _$jni.JObject { ///@since 2.4 bool canUseCharArrays() { return _canUseCharArrays( - reference.pointer, _id_canUseCharArrays as _$jni.JMethodIDPtr) + reference.pointer, _id_canUseCharArrays as jni$_.JMethodIDPtr) .boolean; } @@ -620,16 +675,16 @@ class JsonFactory extends _$jni.JObject { r'()Z', ); - static final _canParseAsync = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _canParseAsync = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean canParseAsync()` @@ -643,7 +698,7 @@ class JsonFactory extends _$jni.JObject { ///@since 2.9 bool canParseAsync() { return _canParseAsync( - reference.pointer, _id_canParseAsync as _$jni.JMethodIDPtr) + reference.pointer, _id_canParseAsync as jni$_.JMethodIDPtr) .boolean; } @@ -652,24 +707,24 @@ class JsonFactory extends _$jni.JObject { r'()Ljava/lang/Class;', ); - static final _getFormatReadFeatureType = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFormatReadFeatureType = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Class getFormatReadFeatureType()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getFormatReadFeatureType() { + jni$_.JObject? getFormatReadFeatureType() { return _getFormatReadFeatureType(reference.pointer, - _id_getFormatReadFeatureType as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_getFormatReadFeatureType as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getFormatWriteFeatureType = _class.instanceMethodId( @@ -677,24 +732,24 @@ class JsonFactory extends _$jni.JObject { r'()Ljava/lang/Class;', ); - static final _getFormatWriteFeatureType = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFormatWriteFeatureType = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Class getFormatWriteFeatureType()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getFormatWriteFeatureType() { + jni$_.JObject? getFormatWriteFeatureType() { return _getFormatWriteFeatureType(reference.pointer, - _id_getFormatWriteFeatureType as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_getFormatWriteFeatureType as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_canUseSchema = _class.instanceMethodId( @@ -702,16 +757,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/FormatSchema;)Z', ); - static final _canUseSchema = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _canUseSchema = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)` /// @@ -725,10 +780,11 @@ class JsonFactory extends _$jni.JObject { ///@return Whether parsers and generators constructed by this factory /// can use specified format schema instance bool canUseSchema( - _$jni.JObject schema, + jni$_.JObject? schema, ) { + final _$schema = schema?.reference ?? jni$_.jNullReference; return _canUseSchema(reference.pointer, - _id_canUseSchema as _$jni.JMethodIDPtr, schema.reference.pointer) + _id_canUseSchema as jni$_.JMethodIDPtr, _$schema.pointer) .boolean; } @@ -737,16 +793,16 @@ class JsonFactory extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getFormatName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFormatName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getFormatName()` @@ -758,10 +814,10 @@ class JsonFactory extends _$jni.JObject { /// Note: sub-classes should override this method; default /// implementation will return null for all sub-classes ///@return Name of the format handled by parsers, generators this factory creates - _$jni.JString getFormatName() { + jni$_.JString? getFormatName() { return _getFormatName( - reference.pointer, _id_getFormatName as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getFormatName as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_hasFormat = _class.instanceMethodId( @@ -769,25 +825,26 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/format/InputAccessor;)Lcom/fasterxml/jackson/core/format/MatchStrength;', ); - static final _hasFormat = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _hasFormat = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject hasFormat( - _$jni.JObject acc, + jni$_.JObject? hasFormat( + jni$_.JObject? acc, ) { - return _hasFormat(reference.pointer, _id_hasFormat as _$jni.JMethodIDPtr, - acc.reference.pointer) - .object(const _$jni.JObjectType()); + final _$acc = acc?.reference ?? jni$_.jNullReference; + return _hasFormat(reference.pointer, _id_hasFormat as jni$_.JMethodIDPtr, + _$acc.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_requiresCustomCodec = _class.instanceMethodId( @@ -795,16 +852,16 @@ class JsonFactory extends _$jni.JObject { r'()Z', ); - static final _requiresCustomCodec = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _requiresCustomCodec = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean requiresCustomCodec()` @@ -820,7 +877,7 @@ class JsonFactory extends _$jni.JObject { ///@since 2.1 bool requiresCustomCodec() { return _requiresCustomCodec( - reference.pointer, _id_requiresCustomCodec as _$jni.JMethodIDPtr) + reference.pointer, _id_requiresCustomCodec as jni$_.JMethodIDPtr) .boolean; } @@ -829,23 +886,23 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/Version;', ); - static final _version = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _version = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.Version version()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject version() { - return _version(reference.pointer, _id_version as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? version() { + return _version(reference.pointer, _id_version as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_configure = _class.instanceMethodId( @@ -853,17 +910,17 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonFactory$Feature;Z)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _configure = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _configure = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonFactory.Feature f, boolean state)` /// The returned object must be released after use, by calling the [release] method. @@ -874,13 +931,14 @@ class JsonFactory extends _$jni.JObject { ///@param state Whether to enable or disable the feature ///@return This factory instance (to allow call chaining) ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory configure( - JsonFactory_Feature f, + JsonFactory? configure( + JsonFactory$Feature? f, bool state, ) { - return _configure(reference.pointer, _id_configure as _$jni.JMethodIDPtr, - f.reference.pointer, state ? 1 : 0) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _configure(reference.pointer, _id_configure as jni$_.JMethodIDPtr, + _$f.pointer, state ? 1 : 0) + .object(const $JsonFactory$NullableType()); } static final _id_enable = _class.instanceMethodId( @@ -888,16 +946,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _enable = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _enable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonFactory.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -907,12 +965,13 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to enable ///@return This factory instance (to allow call chaining) ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory enable( - JsonFactory_Feature f, + JsonFactory? enable( + JsonFactory$Feature? f, ) { - return _enable(reference.pointer, _id_enable as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _enable( + reference.pointer, _id_enable as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_disable = _class.instanceMethodId( @@ -920,16 +979,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _disable = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _disable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonFactory.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -939,12 +998,13 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to disable ///@return This factory instance (to allow call chaining) ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory disable( - JsonFactory_Feature f, + JsonFactory? disable( + JsonFactory$Feature? f, ) { - return _disable(reference.pointer, _id_disable as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _disable( + reference.pointer, _id_disable as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_isEnabled = _class.instanceMethodId( @@ -952,16 +1012,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Z', ); - static final _isEnabled = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final boolean isEnabled(com.fasterxml.jackson.core.JsonFactory.Feature f)` /// @@ -969,10 +1029,11 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to check ///@return True if the specified feature is enabled bool isEnabled( - JsonFactory_Feature f, + JsonFactory$Feature? f, ) { - return _isEnabled(reference.pointer, _id_isEnabled as _$jni.JMethodIDPtr, - f.reference.pointer) + final _$f = f?.reference ?? jni$_.jNullReference; + return _isEnabled( + reference.pointer, _id_isEnabled as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -981,22 +1042,22 @@ class JsonFactory extends _$jni.JObject { r'()I', ); - static final _getParserFeatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getParserFeatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final int getParserFeatures()` int getParserFeatures() { return _getParserFeatures( - reference.pointer, _id_getParserFeatures as _$jni.JMethodIDPtr) + reference.pointer, _id_getParserFeatures as jni$_.JMethodIDPtr) .integer; } @@ -1005,22 +1066,22 @@ class JsonFactory extends _$jni.JObject { r'()I', ); - static final _getGeneratorFeatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getGeneratorFeatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final int getGeneratorFeatures()` int getGeneratorFeatures() { return _getGeneratorFeatures( - reference.pointer, _id_getGeneratorFeatures as _$jni.JMethodIDPtr) + reference.pointer, _id_getGeneratorFeatures as jni$_.JMethodIDPtr) .integer; } @@ -1029,22 +1090,22 @@ class JsonFactory extends _$jni.JObject { r'()I', ); - static final _getFormatParserFeatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFormatParserFeatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getFormatParserFeatures()` int getFormatParserFeatures() { return _getFormatParserFeatures(reference.pointer, - _id_getFormatParserFeatures as _$jni.JMethodIDPtr) + _id_getFormatParserFeatures as jni$_.JMethodIDPtr) .integer; } @@ -1054,22 +1115,22 @@ class JsonFactory extends _$jni.JObject { ); static final _getFormatGeneratorFeatures = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getFormatGeneratorFeatures()` int getFormatGeneratorFeatures() { return _getFormatGeneratorFeatures(reference.pointer, - _id_getFormatGeneratorFeatures as _$jni.JMethodIDPtr) + _id_getFormatGeneratorFeatures as jni$_.JMethodIDPtr) .integer; } @@ -1078,17 +1139,17 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;Z)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _configure$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _configure$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state)` /// The returned object must be released after use, by calling the [release] method. @@ -1098,16 +1159,14 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to enable/disable ///@param state Whether to enable or disable the feature ///@return This factory instance (to allow call chaining) - JsonFactory configure$1( - jsonparser_.JsonParser_Feature f, + JsonFactory? configure$1( + jsonparser$_.JsonParser$Feature? f, bool state, ) { - return _configure$1( - reference.pointer, - _id_configure$1 as _$jni.JMethodIDPtr, - f.reference.pointer, - state ? 1 : 0) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _configure$1(reference.pointer, + _id_configure$1 as jni$_.JMethodIDPtr, _$f.pointer, state ? 1 : 0) + .object(const $JsonFactory$NullableType()); } static final _id_enable$1 = _class.instanceMethodId( @@ -1115,16 +1174,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _enable$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _enable$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonParser.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -1133,12 +1192,13 @@ class JsonFactory extends _$jni.JObject { /// (check JsonParser.Feature for list of features) ///@param f Feature to enable ///@return This factory instance (to allow call chaining) - JsonFactory enable$1( - jsonparser_.JsonParser_Feature f, + JsonFactory? enable$1( + jsonparser$_.JsonParser$Feature? f, ) { - return _enable$1(reference.pointer, _id_enable$1 as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _enable$1( + reference.pointer, _id_enable$1 as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_disable$1 = _class.instanceMethodId( @@ -1146,16 +1206,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _disable$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _disable$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonParser.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -1164,12 +1224,13 @@ class JsonFactory extends _$jni.JObject { /// (check JsonParser.Feature for list of features) ///@param f Feature to disable ///@return This factory instance (to allow call chaining) - JsonFactory disable$1( - jsonparser_.JsonParser_Feature f, + JsonFactory? disable$1( + jsonparser$_.JsonParser$Feature? f, ) { - return _disable$1(reference.pointer, _id_disable$1 as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _disable$1( + reference.pointer, _id_disable$1 as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_isEnabled$1 = _class.instanceMethodId( @@ -1177,16 +1238,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Z', ); - static final _isEnabled$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f)` /// @@ -1194,10 +1255,11 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to check ///@return True if specified feature is enabled bool isEnabled$1( - jsonparser_.JsonParser_Feature f, + jsonparser$_.JsonParser$Feature? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _isEnabled$1(reference.pointer, - _id_isEnabled$1 as _$jni.JMethodIDPtr, f.reference.pointer) + _id_isEnabled$1 as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -1206,16 +1268,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/StreamReadFeature;)Z', ); - static final _isEnabled$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f)` /// @@ -1224,10 +1286,11 @@ class JsonFactory extends _$jni.JObject { ///@return True if specified feature is enabled ///@since 2.10 bool isEnabled$2( - _$jni.JObject f, + jni$_.JObject? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _isEnabled$2(reference.pointer, - _id_isEnabled$2 as _$jni.JMethodIDPtr, f.reference.pointer) + _id_isEnabled$2 as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -1236,16 +1299,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/io/InputDecorator;', ); - static final _getInputDecorator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getInputDecorator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.io.InputDecorator getInputDecorator()` @@ -1254,10 +1317,10 @@ class JsonFactory extends _$jni.JObject { /// Method for getting currently configured input decorator (if any; /// there is no default decorator). ///@return InputDecorator configured, if any - _$jni.JObject getInputDecorator() { + jni$_.JObject? getInputDecorator() { return _getInputDecorator( - reference.pointer, _id_getInputDecorator as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getInputDecorator as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setInputDecorator = _class.instanceMethodId( @@ -1265,16 +1328,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/io/InputDecorator;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _setInputDecorator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setInputDecorator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory setInputDecorator(com.fasterxml.jackson.core.io.InputDecorator d)` /// The returned object must be released after use, by calling the [release] method. @@ -1283,12 +1346,13 @@ class JsonFactory extends _$jni.JObject { ///@param d Decorator to configure for this factory, if any ({@code null} if none) ///@return This factory instance (to allow call chaining) ///@deprecated Since 2.10 use JsonFactoryBuilder\#inputDecorator(InputDecorator) instead - JsonFactory setInputDecorator( - _$jni.JObject d, + JsonFactory? setInputDecorator( + jni$_.JObject? d, ) { + final _$d = d?.reference ?? jni$_.jNullReference; return _setInputDecorator(reference.pointer, - _id_setInputDecorator as _$jni.JMethodIDPtr, d.reference.pointer) - .object(const $JsonFactory$Type()); + _id_setInputDecorator as jni$_.JMethodIDPtr, _$d.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_configure$2 = _class.instanceMethodId( @@ -1296,17 +1360,17 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;Z)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _configure$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _configure$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonGenerator.Feature f, boolean state)` /// The returned object must be released after use, by calling the [release] method. @@ -1316,16 +1380,14 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to enable/disable ///@param state Whether to enable or disable the feature ///@return This factory instance (to allow call chaining) - JsonFactory configure$2( - _$jni.JObject f, + JsonFactory? configure$2( + jni$_.JObject? f, bool state, ) { - return _configure$2( - reference.pointer, - _id_configure$2 as _$jni.JMethodIDPtr, - f.reference.pointer, - state ? 1 : 0) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _configure$2(reference.pointer, + _id_configure$2 as jni$_.JMethodIDPtr, _$f.pointer, state ? 1 : 0) + .object(const $JsonFactory$NullableType()); } static final _id_enable$2 = _class.instanceMethodId( @@ -1333,16 +1395,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _enable$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _enable$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonGenerator.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -1351,12 +1413,13 @@ class JsonFactory extends _$jni.JObject { /// (check JsonGenerator.Feature for list of features) ///@param f Feature to enable ///@return This factory instance (to allow call chaining) - JsonFactory enable$2( - _$jni.JObject f, + JsonFactory? enable$2( + jni$_.JObject? f, ) { - return _enable$2(reference.pointer, _id_enable$2 as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _enable$2( + reference.pointer, _id_enable$2 as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_disable$2 = _class.instanceMethodId( @@ -1364,16 +1427,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _disable$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _disable$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonGenerator.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -1382,12 +1445,13 @@ class JsonFactory extends _$jni.JObject { /// (check JsonGenerator.Feature for list of features) ///@param f Feature to disable ///@return This factory instance (to allow call chaining) - JsonFactory disable$2( - _$jni.JObject f, + JsonFactory? disable$2( + jni$_.JObject? f, ) { - return _disable$2(reference.pointer, _id_disable$2 as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonFactory$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _disable$2( + reference.pointer, _id_disable$2 as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_isEnabled$3 = _class.instanceMethodId( @@ -1395,16 +1459,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Z', ); - static final _isEnabled$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f)` /// @@ -1412,10 +1476,11 @@ class JsonFactory extends _$jni.JObject { ///@param f Feature to check ///@return Whether specified feature is enabled bool isEnabled$3( - _$jni.JObject f, + jni$_.JObject? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _isEnabled$3(reference.pointer, - _id_isEnabled$3 as _$jni.JMethodIDPtr, f.reference.pointer) + _id_isEnabled$3 as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -1424,16 +1489,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/StreamWriteFeature;)Z', ); - static final _isEnabled$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final boolean isEnabled(com.fasterxml.jackson.core.StreamWriteFeature f)` /// @@ -1442,10 +1507,11 @@ class JsonFactory extends _$jni.JObject { ///@return Whether specified feature is enabled ///@since 2.10 bool isEnabled$4( - _$jni.JObject f, + jni$_.JObject? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _isEnabled$4(reference.pointer, - _id_isEnabled$4 as _$jni.JMethodIDPtr, f.reference.pointer) + _id_isEnabled$4 as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -1454,16 +1520,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/io/CharacterEscapes;', ); - static final _getCharacterEscapes = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCharacterEscapes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.io.CharacterEscapes getCharacterEscapes()` @@ -1472,10 +1538,10 @@ class JsonFactory extends _$jni.JObject { /// Method for accessing custom escapes factory uses for JsonGenerators /// it creates. ///@return Configured {@code CharacterEscapes}, if any; {@code null} if none - _$jni.JObject getCharacterEscapes() { + jni$_.JObject? getCharacterEscapes() { return _getCharacterEscapes( - reference.pointer, _id_getCharacterEscapes as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getCharacterEscapes as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setCharacterEscapes = _class.instanceMethodId( @@ -1483,16 +1549,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/io/CharacterEscapes;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _setCharacterEscapes = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCharacterEscapes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory setCharacterEscapes(com.fasterxml.jackson.core.io.CharacterEscapes esc)` /// The returned object must be released after use, by calling the [release] method. @@ -1501,14 +1567,13 @@ class JsonFactory extends _$jni.JObject { /// it creates. ///@param esc CharaterEscapes to set (or {@code null} for "none") ///@return This factory instance (to allow call chaining) - JsonFactory setCharacterEscapes( - _$jni.JObject esc, + JsonFactory? setCharacterEscapes( + jni$_.JObject? esc, ) { - return _setCharacterEscapes( - reference.pointer, - _id_setCharacterEscapes as _$jni.JMethodIDPtr, - esc.reference.pointer) - .object(const $JsonFactory$Type()); + final _$esc = esc?.reference ?? jni$_.jNullReference; + return _setCharacterEscapes(reference.pointer, + _id_setCharacterEscapes as jni$_.JMethodIDPtr, _$esc.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_getOutputDecorator = _class.instanceMethodId( @@ -1516,16 +1581,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/io/OutputDecorator;', ); - static final _getOutputDecorator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getOutputDecorator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.io.OutputDecorator getOutputDecorator()` @@ -1535,10 +1600,10 @@ class JsonFactory extends _$jni.JObject { /// there is no default decorator). ///@return OutputDecorator configured for generators factory creates, if any; /// {@code null} if none. - _$jni.JObject getOutputDecorator() { + jni$_.JObject? getOutputDecorator() { return _getOutputDecorator( - reference.pointer, _id_getOutputDecorator as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getOutputDecorator as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setOutputDecorator = _class.instanceMethodId( @@ -1546,16 +1611,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/io/OutputDecorator;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _setOutputDecorator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setOutputDecorator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory setOutputDecorator(com.fasterxml.jackson.core.io.OutputDecorator d)` /// The returned object must be released after use, by calling the [release] method. @@ -1564,12 +1629,13 @@ class JsonFactory extends _$jni.JObject { ///@return This factory instance (to allow call chaining) ///@param d Output decorator to use, if any ///@deprecated Since 2.10 use JsonFactoryBuilder\#outputDecorator(OutputDecorator) instead - JsonFactory setOutputDecorator( - _$jni.JObject d, + JsonFactory? setOutputDecorator( + jni$_.JObject? d, ) { + final _$d = d?.reference ?? jni$_.jNullReference; return _setOutputDecorator(reference.pointer, - _id_setOutputDecorator as _$jni.JMethodIDPtr, d.reference.pointer) - .object(const $JsonFactory$Type()); + _id_setOutputDecorator as jni$_.JMethodIDPtr, _$d.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_setRootValueSeparator = _class.instanceMethodId( @@ -1577,16 +1643,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _setRootValueSeparator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setRootValueSeparator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory setRootValueSeparator(java.lang.String sep)` /// The returned object must be released after use, by calling the [release] method. @@ -1596,14 +1662,13 @@ class JsonFactory extends _$jni.JObject { ///@param sep Separator to use, if any; null means that no separator is /// automatically added ///@return This factory instance (to allow call chaining) - JsonFactory setRootValueSeparator( - _$jni.JString sep, + JsonFactory? setRootValueSeparator( + jni$_.JString? sep, ) { - return _setRootValueSeparator( - reference.pointer, - _id_setRootValueSeparator as _$jni.JMethodIDPtr, - sep.reference.pointer) - .object(const $JsonFactory$Type()); + final _$sep = sep?.reference ?? jni$_.jNullReference; + return _setRootValueSeparator(reference.pointer, + _id_setRootValueSeparator as jni$_.JMethodIDPtr, _$sep.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_getRootValueSeparator = _class.instanceMethodId( @@ -1611,26 +1676,26 @@ class JsonFactory extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getRootValueSeparator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getRootValueSeparator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getRootValueSeparator()` /// The returned object must be released after use, by calling the [release] method. /// /// @return Root value separator configured, if any - _$jni.JString getRootValueSeparator() { + jni$_.JString? getRootValueSeparator() { return _getRootValueSeparator( - reference.pointer, _id_getRootValueSeparator as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getRootValueSeparator as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setCodec = _class.instanceMethodId( @@ -1638,16 +1703,16 @@ class JsonFactory extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/ObjectCodec;)Lcom/fasterxml/jackson/core/JsonFactory;', ); - static final _setCodec = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCodec = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonFactory setCodec(com.fasterxml.jackson.core.ObjectCodec oc)` /// The returned object must be released after use, by calling the [release] method. @@ -1659,12 +1724,13 @@ class JsonFactory extends _$jni.JObject { /// of JsonParser and JsonGenerator instances. ///@param oc Codec to use ///@return This factory instance (to allow call chaining) - JsonFactory setCodec( - _$jni.JObject oc, + JsonFactory? setCodec( + jni$_.JObject? oc, ) { - return _setCodec(reference.pointer, _id_setCodec as _$jni.JMethodIDPtr, - oc.reference.pointer) - .object(const $JsonFactory$Type()); + final _$oc = oc?.reference ?? jni$_.jNullReference; + return _setCodec( + reference.pointer, _id_setCodec as jni$_.JMethodIDPtr, _$oc.pointer) + .object(const $JsonFactory$NullableType()); } static final _id_getCodec = _class.instanceMethodId( @@ -1672,23 +1738,23 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/ObjectCodec;', ); - static final _getCodec = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCodec = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.ObjectCodec getCodec()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getCodec() { - return _getCodec(reference.pointer, _id_getCodec as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? getCodec() { + return _getCodec(reference.pointer, _id_getCodec as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_createParser = _class.instanceMethodId( @@ -1696,16 +1762,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/File;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(java.io.File f)` /// The returned object must be released after use, by calling the [release] method. @@ -1726,12 +1792,14 @@ class JsonFactory extends _$jni.JObject { /// the parser, since caller has no access to it. ///@param f File that contains JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser( - _$jni.JObject f, + jsonparser$_.JsonParser? createParser( + jni$_.JObject? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _createParser(reference.pointer, - _id_createParser as _$jni.JMethodIDPtr, f.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser as jni$_.JMethodIDPtr, _$f.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$1 = _class.instanceMethodId( @@ -1739,16 +1807,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/net/URL;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(java.net.URL url)` /// The returned object must be released after use, by calling the [release] method. @@ -1767,12 +1835,14 @@ class JsonFactory extends _$jni.JObject { /// the parser, since caller has no access to it. ///@param url URL pointing to resource that contains JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser$1( - _$jni.JObject url, + jsonparser$_.JsonParser? createParser$1( + jni$_.JObject? url, ) { + final _$url = url?.reference ?? jni$_.jNullReference; return _createParser$1(reference.pointer, - _id_createParser$1 as _$jni.JMethodIDPtr, url.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$1 as jni$_.JMethodIDPtr, _$url.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$2 = _class.instanceMethodId( @@ -1780,16 +1850,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/InputStream;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(java.io.InputStream in)` /// The returned object must be released after use, by calling the [release] method. @@ -1811,12 +1881,14 @@ class JsonFactory extends _$jni.JObject { /// For other charsets use \#createParser(java.io.Reader). ///@param in InputStream to use for reading JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser$2( - _$jni.JObject in$, + jsonparser$_.JsonParser? createParser$2( + jni$_.JObject? in$, ) { + final _$in$ = in$?.reference ?? jni$_.jNullReference; return _createParser$2(reference.pointer, - _id_createParser$2 as _$jni.JMethodIDPtr, in$.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$2 as jni$_.JMethodIDPtr, _$in$.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$3 = _class.instanceMethodId( @@ -1824,16 +1896,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/Reader;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(java.io.Reader r)` /// The returned object must be released after use, by calling the [release] method. @@ -1848,12 +1920,14 @@ class JsonFactory extends _$jni.JObject { /// is enabled. ///@param r Reader to use for reading JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser$3( - _$jni.JObject r, + jsonparser$_.JsonParser? createParser$3( + jni$_.JObject? r, ) { + final _$r = r?.reference ?? jni$_.jNullReference; return _createParser$3(reference.pointer, - _id_createParser$3 as _$jni.JMethodIDPtr, r.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$3 as jni$_.JMethodIDPtr, _$r.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$4 = _class.instanceMethodId( @@ -1861,16 +1935,16 @@ class JsonFactory extends _$jni.JObject { r'([B)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(byte[] data)` /// The returned object must be released after use, by calling the [release] method. @@ -1878,12 +1952,14 @@ class JsonFactory extends _$jni.JObject { /// Method for constructing parser for parsing /// the contents of given byte array. ///@since 2.1 - jsonparser_.JsonParser createParser$4( - _$jni.JArray<_$jni.jbyte> data, + jsonparser$_.JsonParser? createParser$4( + jni$_.JByteArray? data, ) { + final _$data = data?.reference ?? jni$_.jNullReference; return _createParser$4(reference.pointer, - _id_createParser$4 as _$jni.JMethodIDPtr, data.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$4 as jni$_.JMethodIDPtr, _$data.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$5 = _class.instanceMethodId( @@ -1891,20 +1967,20 @@ class JsonFactory extends _$jni.JObject { r'([BII)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$5 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createParser$5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(byte[] data, int offset, int len)` /// The returned object must be released after use, by calling the [release] method. @@ -1915,18 +1991,20 @@ class JsonFactory extends _$jni.JObject { ///@param offset Offset of the first data byte within buffer ///@param len Length of contents to parse within buffer ///@since 2.1 - jsonparser_.JsonParser createParser$5( - _$jni.JArray<_$jni.jbyte> data, + jsonparser$_.JsonParser? createParser$5( + jni$_.JByteArray? data, int offset, int len, ) { + final _$data = data?.reference ?? jni$_.jNullReference; return _createParser$5( reference.pointer, - _id_createParser$5 as _$jni.JMethodIDPtr, - data.reference.pointer, + _id_createParser$5 as jni$_.JMethodIDPtr, + _$data.pointer, offset, len) - .object(const jsonparser_.$JsonParser$Type()); + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$6 = _class.instanceMethodId( @@ -1934,16 +2012,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$6 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$6 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(java.lang.String content)` /// The returned object must be released after use, by calling the [release] method. @@ -1951,12 +2029,14 @@ class JsonFactory extends _$jni.JObject { /// Method for constructing parser for parsing /// contents of given String. ///@since 2.1 - jsonparser_.JsonParser createParser$6( - _$jni.JString content, + jsonparser$_.JsonParser? createParser$6( + jni$_.JString? content, ) { + final _$content = content?.reference ?? jni$_.jNullReference; return _createParser$6(reference.pointer, - _id_createParser$6 as _$jni.JMethodIDPtr, content.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$6 as jni$_.JMethodIDPtr, _$content.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$7 = _class.instanceMethodId( @@ -1964,16 +2044,16 @@ class JsonFactory extends _$jni.JObject { r'([C)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$7 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$7 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(char[] content)` /// The returned object must be released after use, by calling the [release] method. @@ -1981,12 +2061,14 @@ class JsonFactory extends _$jni.JObject { /// Method for constructing parser for parsing /// contents of given char array. ///@since 2.4 - jsonparser_.JsonParser createParser$7( - _$jni.JArray<_$jni.jchar> content, + jsonparser$_.JsonParser? createParser$7( + jni$_.JCharArray? content, ) { + final _$content = content?.reference ?? jni$_.jNullReference; return _createParser$7(reference.pointer, - _id_createParser$7 as _$jni.JMethodIDPtr, content.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$7 as jni$_.JMethodIDPtr, _$content.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$8 = _class.instanceMethodId( @@ -1994,38 +2076,40 @@ class JsonFactory extends _$jni.JObject { r'([CII)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$8 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createParser$8 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(char[] content, int offset, int len)` /// The returned object must be released after use, by calling the [release] method. /// /// Method for constructing parser for parsing contents of given char array. ///@since 2.4 - jsonparser_.JsonParser createParser$8( - _$jni.JArray<_$jni.jchar> content, + jsonparser$_.JsonParser? createParser$8( + jni$_.JCharArray? content, int offset, int len, ) { + final _$content = content?.reference ?? jni$_.jNullReference; return _createParser$8( reference.pointer, - _id_createParser$8 as _$jni.JMethodIDPtr, - content.reference.pointer, + _id_createParser$8 as jni$_.JMethodIDPtr, + _$content.pointer, offset, len) - .object(const jsonparser_.$JsonParser$Type()); + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createParser$9 = _class.instanceMethodId( @@ -2033,16 +2117,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/DataInput;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createParser$9 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createParser$9 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createParser(java.io.DataInput in)` /// The returned object must be released after use, by calling the [release] method. @@ -2053,12 +2137,14 @@ class JsonFactory extends _$jni.JObject { /// If this factory does not support DataInput as source, /// will throw UnsupportedOperationException ///@since 2.8 - jsonparser_.JsonParser createParser$9( - _$jni.JObject in$, + jsonparser$_.JsonParser? createParser$9( + jni$_.JObject? in$, ) { + final _$in$ = in$?.reference ?? jni$_.jNullReference; return _createParser$9(reference.pointer, - _id_createParser$9 as _$jni.JMethodIDPtr, in$.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createParser$9 as jni$_.JMethodIDPtr, _$in$.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createNonBlockingByteArrayParser = _class.instanceMethodId( @@ -2067,16 +2153,16 @@ class JsonFactory extends _$jni.JObject { ); static final _createNonBlockingByteArrayParser = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.JsonParser createNonBlockingByteArrayParser()` @@ -2095,10 +2181,11 @@ class JsonFactory extends _$jni.JObject { /// (and US-ASCII since it is proper subset); other encodings are not supported /// at this point. ///@since 2.9 - jsonparser_.JsonParser createNonBlockingByteArrayParser() { + jsonparser$_.JsonParser? createNonBlockingByteArrayParser() { return _createNonBlockingByteArrayParser(reference.pointer, - _id_createNonBlockingByteArrayParser as _$jni.JMethodIDPtr) - .object(const jsonparser_.$JsonParser$Type()); + _id_createNonBlockingByteArrayParser as jni$_.JMethodIDPtr) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createGenerator = _class.instanceMethodId( @@ -2106,22 +2193,22 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/OutputStream;Lcom/fasterxml/jackson/core/JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createGenerator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createGenerator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc)` /// The returned object must be released after use, by calling the [release] method. @@ -2144,16 +2231,18 @@ class JsonFactory extends _$jni.JObject { ///@param out OutputStream to use for writing JSON content ///@param enc Character encoding to use ///@since 2.1 - _$jni.JObject createGenerator( - _$jni.JObject out, - _$jni.JObject enc, + jni$_.JObject? createGenerator( + jni$_.JObject? out, + jni$_.JObject? enc, ) { + final _$out = out?.reference ?? jni$_.jNullReference; + final _$enc = enc?.reference ?? jni$_.jNullReference; return _createGenerator( reference.pointer, - _id_createGenerator as _$jni.JMethodIDPtr, - out.reference.pointer, - enc.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createGenerator as jni$_.JMethodIDPtr, + _$out.pointer, + _$enc.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createGenerator$1 = _class.instanceMethodId( @@ -2161,16 +2250,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/OutputStream;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createGenerator$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createGenerator$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out)` /// The returned object must be released after use, by calling the [release] method. @@ -2180,12 +2269,13 @@ class JsonFactory extends _$jni.JObject { /// /// Note: there are formats that use fixed encoding (like most binary data formats). ///@since 2.1 - _$jni.JObject createGenerator$1( - _$jni.JObject out, + jni$_.JObject? createGenerator$1( + jni$_.JObject? out, ) { + final _$out = out?.reference ?? jni$_.jNullReference; return _createGenerator$1(reference.pointer, - _id_createGenerator$1 as _$jni.JMethodIDPtr, out.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createGenerator$1 as jni$_.JMethodIDPtr, _$out.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createGenerator$2 = _class.instanceMethodId( @@ -2193,16 +2283,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/Writer;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createGenerator$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createGenerator$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.Writer w)` /// The returned object must be released after use, by calling the [release] method. @@ -2218,12 +2308,13 @@ class JsonFactory extends _$jni.JObject { /// Using application needs to close it explicitly. ///@since 2.1 ///@param w Writer to use for writing JSON content - _$jni.JObject createGenerator$2( - _$jni.JObject w, + jni$_.JObject? createGenerator$2( + jni$_.JObject? w, ) { + final _$w = w?.reference ?? jni$_.jNullReference; return _createGenerator$2(reference.pointer, - _id_createGenerator$2 as _$jni.JMethodIDPtr, w.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createGenerator$2 as jni$_.JMethodIDPtr, _$w.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createGenerator$3 = _class.instanceMethodId( @@ -2231,22 +2322,22 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/File;Lcom/fasterxml/jackson/core/JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createGenerator$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createGenerator$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.File f, com.fasterxml.jackson.core.JsonEncoding enc)` /// The returned object must be released after use, by calling the [release] method. @@ -2263,16 +2354,18 @@ class JsonFactory extends _$jni.JObject { ///@param f File to write contents to ///@param enc Character encoding to use ///@since 2.1 - _$jni.JObject createGenerator$3( - _$jni.JObject f, - _$jni.JObject enc, + jni$_.JObject? createGenerator$3( + jni$_.JObject? f, + jni$_.JObject? enc, ) { + final _$f = f?.reference ?? jni$_.jNullReference; + final _$enc = enc?.reference ?? jni$_.jNullReference; return _createGenerator$3( reference.pointer, - _id_createGenerator$3 as _$jni.JMethodIDPtr, - f.reference.pointer, - enc.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createGenerator$3 as jni$_.JMethodIDPtr, + _$f.pointer, + _$enc.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createGenerator$4 = _class.instanceMethodId( @@ -2280,22 +2373,22 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/DataOutput;Lcom/fasterxml/jackson/core/JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createGenerator$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createGenerator$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out, com.fasterxml.jackson.core.JsonEncoding enc)` /// The returned object must be released after use, by calling the [release] method. @@ -2303,16 +2396,18 @@ class JsonFactory extends _$jni.JObject { /// Method for constructing generator for writing content using specified /// DataOutput instance. ///@since 2.8 - _$jni.JObject createGenerator$4( - _$jni.JObject out, - _$jni.JObject enc, + jni$_.JObject? createGenerator$4( + jni$_.JObject? out, + jni$_.JObject? enc, ) { + final _$out = out?.reference ?? jni$_.jNullReference; + final _$enc = enc?.reference ?? jni$_.jNullReference; return _createGenerator$4( reference.pointer, - _id_createGenerator$4 as _$jni.JMethodIDPtr, - out.reference.pointer, - enc.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createGenerator$4 as jni$_.JMethodIDPtr, + _$out.pointer, + _$enc.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createGenerator$5 = _class.instanceMethodId( @@ -2320,16 +2415,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/DataOutput;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createGenerator$5 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createGenerator$5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out)` /// The returned object must be released after use, by calling the [release] method. @@ -2339,12 +2434,13 @@ class JsonFactory extends _$jni.JObject { /// /// Note: there are formats that use fixed encoding (like most binary data formats). ///@since 2.8 - _$jni.JObject createGenerator$5( - _$jni.JObject out, + jni$_.JObject? createGenerator$5( + jni$_.JObject? out, ) { + final _$out = out?.reference ?? jni$_.jNullReference; return _createGenerator$5(reference.pointer, - _id_createGenerator$5 as _$jni.JMethodIDPtr, out.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createGenerator$5 as jni$_.JMethodIDPtr, _$out.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createJsonParser = _class.instanceMethodId( @@ -2352,16 +2448,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/File;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonParser = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.File f)` /// The returned object must be released after use, by calling the [release] method. @@ -2384,12 +2480,14 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(File) instead. - jsonparser_.JsonParser createJsonParser( - _$jni.JObject f, + jsonparser$_.JsonParser? createJsonParser( + jni$_.JObject? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _createJsonParser(reference.pointer, - _id_createJsonParser as _$jni.JMethodIDPtr, f.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createJsonParser as jni$_.JMethodIDPtr, _$f.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonParser$1 = _class.instanceMethodId( @@ -2397,16 +2495,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/net/URL;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonParser$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(java.net.URL url)` /// The returned object must be released after use, by calling the [release] method. @@ -2428,12 +2526,14 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(URL) instead. - jsonparser_.JsonParser createJsonParser$1( - _$jni.JObject url, + jsonparser$_.JsonParser? createJsonParser$1( + jni$_.JObject? url, ) { + final _$url = url?.reference ?? jni$_.jNullReference; return _createJsonParser$1(reference.pointer, - _id_createJsonParser$1 as _$jni.JMethodIDPtr, url.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createJsonParser$1 as jni$_.JMethodIDPtr, _$url.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonParser$2 = _class.instanceMethodId( @@ -2441,16 +2541,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/InputStream;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonParser$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.InputStream in)` /// The returned object must be released after use, by calling the [release] method. @@ -2475,12 +2575,14 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(InputStream) instead. - jsonparser_.JsonParser createJsonParser$2( - _$jni.JObject in$, + jsonparser$_.JsonParser? createJsonParser$2( + jni$_.JObject? in$, ) { + final _$in$ = in$?.reference ?? jni$_.jNullReference; return _createJsonParser$2(reference.pointer, - _id_createJsonParser$2 as _$jni.JMethodIDPtr, in$.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createJsonParser$2 as jni$_.JMethodIDPtr, _$in$.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonParser$3 = _class.instanceMethodId( @@ -2488,16 +2590,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/Reader;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonParser$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.Reader r)` /// The returned object must be released after use, by calling the [release] method. @@ -2515,12 +2617,14 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(Reader) instead. - jsonparser_.JsonParser createJsonParser$3( - _$jni.JObject r, + jsonparser$_.JsonParser? createJsonParser$3( + jni$_.JObject? r, ) { + final _$r = r?.reference ?? jni$_.jNullReference; return _createJsonParser$3(reference.pointer, - _id_createJsonParser$3 as _$jni.JMethodIDPtr, r.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + _id_createJsonParser$3 as jni$_.JMethodIDPtr, _$r.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonParser$4 = _class.instanceMethodId( @@ -2528,16 +2632,16 @@ class JsonFactory extends _$jni.JObject { r'([B)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonParser$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data)` /// The returned object must be released after use, by calling the [release] method. @@ -2548,14 +2652,14 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(byte[]) instead. - jsonparser_.JsonParser createJsonParser$4( - _$jni.JArray<_$jni.jbyte> data, + jsonparser$_.JsonParser? createJsonParser$4( + jni$_.JByteArray? data, ) { - return _createJsonParser$4( - reference.pointer, - _id_createJsonParser$4 as _$jni.JMethodIDPtr, - data.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + final _$data = data?.reference ?? jni$_.jNullReference; + return _createJsonParser$4(reference.pointer, + _id_createJsonParser$4 as jni$_.JMethodIDPtr, _$data.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonParser$5 = _class.instanceMethodId( @@ -2563,20 +2667,20 @@ class JsonFactory extends _$jni.JObject { r'([BII)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser$5 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createJsonParser$5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32 + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data, int offset, int len)` /// The returned object must be released after use, by calling the [release] method. @@ -2590,18 +2694,20 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(byte[],int,int) instead. - jsonparser_.JsonParser createJsonParser$5( - _$jni.JArray<_$jni.jbyte> data, + jsonparser$_.JsonParser? createJsonParser$5( + jni$_.JByteArray? data, int offset, int len, ) { + final _$data = data?.reference ?? jni$_.jNullReference; return _createJsonParser$5( reference.pointer, - _id_createJsonParser$5 as _$jni.JMethodIDPtr, - data.reference.pointer, + _id_createJsonParser$5 as jni$_.JMethodIDPtr, + _$data.pointer, offset, len) - .object(const jsonparser_.$JsonParser$Type()); + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonParser$6 = _class.instanceMethodId( @@ -2609,16 +2715,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _createJsonParser$6 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonParser$6 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser createJsonParser(java.lang.String content)` /// The returned object must be released after use, by calling the [release] method. @@ -2630,14 +2736,14 @@ class JsonFactory extends _$jni.JObject { ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(String) instead. - jsonparser_.JsonParser createJsonParser$6( - _$jni.JString content, + jsonparser$_.JsonParser? createJsonParser$6( + jni$_.JString? content, ) { - return _createJsonParser$6( - reference.pointer, - _id_createJsonParser$6 as _$jni.JMethodIDPtr, - content.reference.pointer) - .object(const jsonparser_.$JsonParser$Type()); + final _$content = content?.reference ?? jni$_.jNullReference; + return _createJsonParser$6(reference.pointer, + _id_createJsonParser$6 as jni$_.JMethodIDPtr, _$content.pointer) + .object( + const jsonparser$_.$JsonParser$NullableType()); } static final _id_createJsonGenerator = _class.instanceMethodId( @@ -2645,22 +2751,22 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/OutputStream;Lcom/fasterxml/jackson/core/JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createJsonGenerator = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _createJsonGenerator = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc)` /// The returned object must be released after use, by calling the [release] method. @@ -2685,16 +2791,18 @@ class JsonFactory extends _$jni.JObject { ///@return Generator constructed ///@throws IOException if parser initialization fails due to I/O (write) problem ///@deprecated Since 2.2, use \#createGenerator(OutputStream, JsonEncoding) instead. - _$jni.JObject createJsonGenerator( - _$jni.JObject out, - _$jni.JObject enc, + jni$_.JObject? createJsonGenerator( + jni$_.JObject? out, + jni$_.JObject? enc, ) { + final _$out = out?.reference ?? jni$_.jNullReference; + final _$enc = enc?.reference ?? jni$_.jNullReference; return _createJsonGenerator( reference.pointer, - _id_createJsonGenerator as _$jni.JMethodIDPtr, - out.reference.pointer, - enc.reference.pointer) - .object(const _$jni.JObjectType()); + _id_createJsonGenerator as jni$_.JMethodIDPtr, + _$out.pointer, + _$enc.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createJsonGenerator$1 = _class.instanceMethodId( @@ -2702,16 +2810,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/Writer;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createJsonGenerator$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonGenerator$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.Writer out)` /// The returned object must be released after use, by calling the [release] method. @@ -2729,14 +2837,13 @@ class JsonFactory extends _$jni.JObject { ///@return Generator constructed ///@throws IOException if parser initialization fails due to I/O (write) problem ///@deprecated Since 2.2, use \#createGenerator(Writer) instead. - _$jni.JObject createJsonGenerator$1( - _$jni.JObject out, + jni$_.JObject? createJsonGenerator$1( + jni$_.JObject? out, ) { - return _createJsonGenerator$1( - reference.pointer, - _id_createJsonGenerator$1 as _$jni.JMethodIDPtr, - out.reference.pointer) - .object(const _$jni.JObjectType()); + final _$out = out?.reference ?? jni$_.jNullReference; + return _createJsonGenerator$1(reference.pointer, + _id_createJsonGenerator$1 as jni$_.JMethodIDPtr, _$out.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_createJsonGenerator$2 = _class.instanceMethodId( @@ -2744,16 +2851,16 @@ class JsonFactory extends _$jni.JObject { r'(Ljava/io/OutputStream;)Lcom/fasterxml/jackson/core/JsonGenerator;', ); - static final _createJsonGenerator$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _createJsonGenerator$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out)` /// The returned object must be released after use, by calling the [release] method. @@ -2766,14 +2873,13 @@ class JsonFactory extends _$jni.JObject { ///@return Generator constructed ///@throws IOException if parser initialization fails due to I/O (write) problem ///@deprecated Since 2.2, use \#createGenerator(OutputStream) instead. - _$jni.JObject createJsonGenerator$2( - _$jni.JObject out, + jni$_.JObject? createJsonGenerator$2( + jni$_.JObject? out, ) { - return _createJsonGenerator$2( - reference.pointer, - _id_createJsonGenerator$2 as _$jni.JMethodIDPtr, - out.reference.pointer) - .object(const _$jni.JObjectType()); + final _$out = out?.reference ?? jni$_.jNullReference; + return _createJsonGenerator$2(reference.pointer, + _id_createJsonGenerator$2 as jni$_.JMethodIDPtr, _$out.pointer) + .object(const jni$_.JObjectNullableType()); } static final _id_$_getBufferRecycler = _class.instanceMethodId( @@ -2781,16 +2887,16 @@ class JsonFactory extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/util/BufferRecycler;', ); - static final _$_getBufferRecycler = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _$_getBufferRecycler = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.util.BufferRecycler _getBufferRecycler()` @@ -2801,38 +2907,81 @@ class JsonFactory extends _$jni.JObject { /// /// Note: only public to give access for {@code ObjectMapper} ///@return Buffer recycler instance to use - _$jni.JObject $_getBufferRecycler() { + jni$_.JObject? $_getBufferRecycler() { return _$_getBufferRecycler( - reference.pointer, _id_$_getBufferRecycler as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_$_getBufferRecycler as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } } -final class $JsonFactory$Type extends _$jni.JObjType { - @_$jni.internal - const $JsonFactory$Type(); +final class $JsonFactory$NullableType extends jni$_.JObjType { + @jni$_.internal + const $JsonFactory$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/fasterxml/jackson/core/JsonFactory;'; - @_$jni.internal - @_$core.override - JsonFactory fromReference(_$jni.JReference reference) => - JsonFactory.fromReference(reference); + @jni$_.internal + @core$_.override + JsonFactory? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : JsonFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonFactory$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonFactory$NullableType) && + other is $JsonFactory$NullableType; + } +} + +final class $JsonFactory$Type extends jni$_.JObjType { + @jni$_.internal + const $JsonFactory$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/fasterxml/jackson/core/JsonFactory;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + JsonFactory fromReference(jni$_.JReference reference) => + JsonFactory.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonFactory$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($JsonFactory$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($JsonFactory$Type) && other is $JsonFactory$Type; diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart index 6062e6c3b..3f5e313c1 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart @@ -37,6 +37,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -46,54 +47,57 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; -import 'JsonToken.dart' as jsontoken_; +import 'JsonToken.dart' as jsontoken$_; /// from: `com.fasterxml.jackson.core.JsonParser$Feature` /// /// Enumeration that defines all on/off features for parsers. -class JsonParser_Feature extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - JsonParser_Feature.fromReference( - _$jni.JReference reference, +class JsonParser$Feature extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JsonParser$Feature.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/fasterxml/jackson/core/JsonParser$Feature'); + jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonParser$Feature'); /// The type which includes information such as the signature of this class. - static const type = $JsonParser_Feature$Type(); + static const nullableType = $JsonParser$Feature$NullableType(); + static const type = $JsonParser$Feature$Type(); static final _id_values = _class.staticMethodId( r'values', r'()[Lcom/fasterxml/jackson/core/JsonParser$Feature;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.fasterxml.jackson.core.JsonParser.Feature[] values()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($JsonParser_Feature$Type())); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $JsonParser$Feature$NullableType())); } static final _id_valueOf = _class.staticMethodId( @@ -101,25 +105,26 @@ class JsonParser_Feature extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser$Feature;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public com.fasterxml.jackson.core.JsonParser.Feature valueOf(java.lang.String name)` /// The returned object must be released after use, by calling the [release] method. - static JsonParser_Feature valueOf( - _$jni.JString name, + static JsonParser$Feature? valueOf( + jni$_.JString? name, ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - name.reference.pointer) - .object(const $JsonParser_Feature$Type()); + final _$name = name?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$name.pointer) + .object(const $JsonParser$Feature$NullableType()); } static final _id_collectDefaults = _class.staticMethodId( @@ -127,16 +132,16 @@ class JsonParser_Feature extends _$jni.JObject { r'()I', ); - static final _collectDefaults = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _collectDefaults = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public int collectDefaults()` @@ -146,7 +151,7 @@ class JsonParser_Feature extends _$jni.JObject { ///@return Bit mask of all features that are enabled by default static int collectDefaults() { return _collectDefaults( - _class.reference.pointer, _id_collectDefaults as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_collectDefaults as jni$_.JMethodIDPtr) .integer; } @@ -155,22 +160,22 @@ class JsonParser_Feature extends _$jni.JObject { r'()Z', ); - static final _enabledByDefault = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _enabledByDefault = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean enabledByDefault()` bool enabledByDefault() { return _enabledByDefault( - reference.pointer, _id_enabledByDefault as _$jni.JMethodIDPtr) + reference.pointer, _id_enabledByDefault as jni$_.JMethodIDPtr) .boolean; } @@ -179,23 +184,23 @@ class JsonParser_Feature extends _$jni.JObject { r'(I)Z', ); - static final _enabledIn = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallBooleanMethod') + static final _enabledIn = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public boolean enabledIn(int flags)` bool enabledIn( int flags, ) { return _enabledIn( - reference.pointer, _id_enabledIn as _$jni.JMethodIDPtr, flags) + reference.pointer, _id_enabledIn as jni$_.JMethodIDPtr, flags) .boolean; } @@ -204,54 +209,99 @@ class JsonParser_Feature extends _$jni.JObject { r'()I', ); - static final _getMask = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getMask = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getMask()` int getMask() { - return _getMask(reference.pointer, _id_getMask as _$jni.JMethodIDPtr) + return _getMask(reference.pointer, _id_getMask as jni$_.JMethodIDPtr) .integer; } } -final class $JsonParser_Feature$Type - extends _$jni.JObjType { - @_$jni.internal - const $JsonParser_Feature$Type(); +final class $JsonParser$Feature$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JsonParser$Feature$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/fasterxml/jackson/core/JsonParser$Feature;'; - @_$jni.internal - @_$core.override - JsonParser_Feature fromReference(_$jni.JReference reference) => - JsonParser_Feature.fromReference(reference); + @jni$_.internal + @core$_.override + JsonParser$Feature? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JsonParser$Feature.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonParser$Feature$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonParser$Feature$NullableType) && + other is $JsonParser$Feature$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $JsonParser$Feature$Type + extends jni$_.JObjType { + @jni$_.internal + const $JsonParser$Feature$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/fasterxml/jackson/core/JsonParser$Feature;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + JsonParser$Feature fromReference(jni$_.JReference reference) => + JsonParser$Feature.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonParser$Feature$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($JsonParser_Feature$Type).hashCode; + @core$_.override + int get hashCode => ($JsonParser$Feature$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($JsonParser_Feature$Type) && - other is $JsonParser_Feature$Type; + return other.runtimeType == ($JsonParser$Feature$Type) && + other is $JsonParser$Feature$Type; } } @@ -259,44 +309,47 @@ final class $JsonParser_Feature$Type /// /// Enumeration of possible "native" (optimal) types that can be /// used for numbers. -class JsonParser_NumberType extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - JsonParser_NumberType.fromReference( - _$jni.JReference reference, +class JsonParser$NumberType extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JsonParser$NumberType.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/fasterxml/jackson/core/JsonParser$NumberType'); + jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonParser$NumberType'); /// The type which includes information such as the signature of this class. - static const type = $JsonParser_NumberType$Type(); + static const nullableType = $JsonParser$NumberType$NullableType(); + static const type = $JsonParser$NumberType$Type(); static final _id_values = _class.staticMethodId( r'values', r'()[Lcom/fasterxml/jackson/core/JsonParser$NumberType;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.fasterxml.jackson.core.JsonParser.NumberType[] values()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($JsonParser_NumberType$Type())); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $JsonParser$NumberType$NullableType())); } static final _id_valueOf = _class.staticMethodId( @@ -304,57 +357,104 @@ class JsonParser_NumberType extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser$NumberType;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public com.fasterxml.jackson.core.JsonParser.NumberType valueOf(java.lang.String name)` /// The returned object must be released after use, by calling the [release] method. - static JsonParser_NumberType valueOf( - _$jni.JString name, + static JsonParser$NumberType? valueOf( + jni$_.JString? name, ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - name.reference.pointer) - .object(const $JsonParser_NumberType$Type()); + final _$name = name?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$name.pointer) + .object( + const $JsonParser$NumberType$NullableType()); } } -final class $JsonParser_NumberType$Type - extends _$jni.JObjType { - @_$jni.internal - const $JsonParser_NumberType$Type(); +final class $JsonParser$NumberType$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JsonParser$NumberType$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/fasterxml/jackson/core/JsonParser$NumberType;'; - @_$jni.internal - @_$core.override - JsonParser_NumberType fromReference(_$jni.JReference reference) => - JsonParser_NumberType.fromReference(reference); + @jni$_.internal + @core$_.override + JsonParser$NumberType? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JsonParser$NumberType.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + int get hashCode => ($JsonParser$NumberType$NullableType).hashCode; - @_$jni.internal - @_$core.override + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonParser$NumberType$NullableType) && + other is $JsonParser$NumberType$NullableType; + } +} + +final class $JsonParser$NumberType$Type + extends jni$_.JObjType { + @jni$_.internal + const $JsonParser$NumberType$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/fasterxml/jackson/core/JsonParser$NumberType;'; + + @jni$_.internal + @core$_.override + JsonParser$NumberType fromReference(jni$_.JReference reference) => + JsonParser$NumberType.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonParser$NumberType$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($JsonParser_NumberType$Type).hashCode; + @core$_.override + int get hashCode => ($JsonParser$NumberType$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($JsonParser_NumberType$Type) && - other is $JsonParser_NumberType$Type; + return other.runtimeType == ($JsonParser$NumberType$Type) && + other is $JsonParser$NumberType$Type; } } @@ -364,37 +464,38 @@ final class $JsonParser_NumberType$Type /// Instances are created using factory methods of /// a JsonFactory instance. ///@author Tatu Saloranta -class JsonParser extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class JsonParser extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal JsonParser.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/fasterxml/jackson/core/JsonParser'); + jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonParser'); /// The type which includes information such as the signature of this class. + static const nullableType = $JsonParser$NullableType(); static const type = $JsonParser$Type(); static final _id_getCodec = _class.instanceMethodId( r'getCodec', r'()Lcom/fasterxml/jackson/core/ObjectCodec;', ); - static final _getCodec = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCodec = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.ObjectCodec getCodec()` @@ -404,9 +505,9 @@ class JsonParser extends _$jni.JObject { /// parser, if any. Codec is used by \#readValueAs(Class) /// method (and its variants). ///@return Codec assigned to this parser, if any; {@code null} if none - _$jni.JObject getCodec() { - return _getCodec(reference.pointer, _id_getCodec as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? getCodec() { + return _getCodec(reference.pointer, _id_getCodec as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setCodec = _class.instanceMethodId( @@ -414,16 +515,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/ObjectCodec;)V', ); - static final _setCodec = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCodec = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract void setCodec(com.fasterxml.jackson.core.ObjectCodec oc)` /// @@ -432,10 +533,11 @@ class JsonParser extends _$jni.JObject { /// method (and its variants). ///@param oc Codec to assign, if any; {@code null} if none void setCodec( - _$jni.JObject oc, + jni$_.JObject? oc, ) { - _setCodec(reference.pointer, _id_setCodec as _$jni.JMethodIDPtr, - oc.reference.pointer) + final _$oc = oc?.reference ?? jni$_.jNullReference; + _setCodec( + reference.pointer, _id_setCodec as jni$_.JMethodIDPtr, _$oc.pointer) .check(); } @@ -444,16 +546,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _getInputSource = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getInputSource = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object getInputSource()` @@ -473,10 +575,10 @@ class JsonParser extends _$jni.JObject { /// In general use of this accessor should be considered as /// "last effort", i.e. only used if no other mechanism is applicable. ///@return Input source this parser was configured with - _$jni.JObject getInputSource() { + jni$_.JObject? getInputSource() { return _getInputSource( - reference.pointer, _id_getInputSource as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getInputSource as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setRequestPayloadOnError = _class.instanceMethodId( @@ -484,16 +586,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/util/RequestPayload;)V', ); - static final _setRequestPayloadOnError = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setRequestPayloadOnError = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setRequestPayloadOnError(com.fasterxml.jackson.core.util.RequestPayload payload)` /// @@ -501,12 +603,13 @@ class JsonParser extends _$jni.JObject { ///@param payload Payload to pass ///@since 2.8 void setRequestPayloadOnError( - _$jni.JObject payload, + jni$_.JObject? payload, ) { + final _$payload = payload?.reference ?? jni$_.jNullReference; _setRequestPayloadOnError( reference.pointer, - _id_setRequestPayloadOnError as _$jni.JMethodIDPtr, - payload.reference.pointer) + _id_setRequestPayloadOnError as jni$_.JMethodIDPtr, + _$payload.pointer) .check(); } @@ -516,22 +619,22 @@ class JsonParser extends _$jni.JObject { ); static final _setRequestPayloadOnError$1 = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public void setRequestPayloadOnError(byte[] payload, java.lang.String charset)` /// @@ -540,14 +643,16 @@ class JsonParser extends _$jni.JObject { ///@param charset Character encoding for (lazily) decoding payload ///@since 2.8 void setRequestPayloadOnError$1( - _$jni.JArray<_$jni.jbyte> payload, - _$jni.JString charset, + jni$_.JByteArray? payload, + jni$_.JString? charset, ) { + final _$payload = payload?.reference ?? jni$_.jNullReference; + final _$charset = charset?.reference ?? jni$_.jNullReference; _setRequestPayloadOnError$1( reference.pointer, - _id_setRequestPayloadOnError$1 as _$jni.JMethodIDPtr, - payload.reference.pointer, - charset.reference.pointer) + _id_setRequestPayloadOnError$1 as jni$_.JMethodIDPtr, + _$payload.pointer, + _$charset.pointer) .check(); } @@ -557,16 +662,16 @@ class JsonParser extends _$jni.JObject { ); static final _setRequestPayloadOnError$2 = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setRequestPayloadOnError(java.lang.String payload)` /// @@ -574,12 +679,13 @@ class JsonParser extends _$jni.JObject { ///@param payload Payload to pass ///@since 2.8 void setRequestPayloadOnError$2( - _$jni.JString payload, + jni$_.JString? payload, ) { + final _$payload = payload?.reference ?? jni$_.jNullReference; _setRequestPayloadOnError$2( reference.pointer, - _id_setRequestPayloadOnError$2 as _$jni.JMethodIDPtr, - payload.reference.pointer) + _id_setRequestPayloadOnError$2 as jni$_.JMethodIDPtr, + _$payload.pointer) .check(); } @@ -588,16 +694,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/FormatSchema;)V', ); - static final _setSchema = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setSchema = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setSchema(com.fasterxml.jackson.core.FormatSchema schema)` /// @@ -612,10 +718,11 @@ class JsonParser extends _$jni.JObject { ///@param schema Schema to use ///@throws UnsupportedOperationException if parser does not support schema void setSchema( - _$jni.JObject schema, + jni$_.JObject? schema, ) { - _setSchema(reference.pointer, _id_setSchema as _$jni.JMethodIDPtr, - schema.reference.pointer) + final _$schema = schema?.reference ?? jni$_.jNullReference; + _setSchema(reference.pointer, _id_setSchema as jni$_.JMethodIDPtr, + _$schema.pointer) .check(); } @@ -624,16 +731,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/FormatSchema;', ); - static final _getSchema = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSchema = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.FormatSchema getSchema()` @@ -643,9 +750,9 @@ class JsonParser extends _$jni.JObject { /// Default implementation returns null. ///@return Schema in use by this parser, if any; {@code null} if none ///@since 2.1 - _$jni.JObject getSchema() { - return _getSchema(reference.pointer, _id_getSchema as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? getSchema() { + return _getSchema(reference.pointer, _id_getSchema as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_canUseSchema = _class.instanceMethodId( @@ -653,16 +760,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/FormatSchema;)Z', ); - static final _canUseSchema = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _canUseSchema = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)` /// @@ -671,10 +778,11 @@ class JsonParser extends _$jni.JObject { ///@param schema Schema to check ///@return True if this parser can use given schema; false if not bool canUseSchema( - _$jni.JObject schema, + jni$_.JObject? schema, ) { + final _$schema = schema?.reference ?? jni$_.jNullReference; return _canUseSchema(reference.pointer, - _id_canUseSchema as _$jni.JMethodIDPtr, schema.reference.pointer) + _id_canUseSchema as jni$_.JMethodIDPtr, _$schema.pointer) .boolean; } @@ -683,16 +791,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _requiresCustomCodec = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _requiresCustomCodec = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean requiresCustomCodec()` @@ -707,7 +815,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.1 bool requiresCustomCodec() { return _requiresCustomCodec( - reference.pointer, _id_requiresCustomCodec as _$jni.JMethodIDPtr) + reference.pointer, _id_requiresCustomCodec as jni$_.JMethodIDPtr) .boolean; } @@ -716,16 +824,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _canParseAsync = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _canParseAsync = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean canParseAsync()` @@ -743,7 +851,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.9 bool canParseAsync() { return _canParseAsync( - reference.pointer, _id_canParseAsync as _$jni.JMethodIDPtr) + reference.pointer, _id_canParseAsync as jni$_.JMethodIDPtr) .boolean; } @@ -752,16 +860,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/async/NonBlockingInputFeeder;', ); - static final _getNonBlockingInputFeeder = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNonBlockingInputFeeder = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.async.NonBlockingInputFeeder getNonBlockingInputFeeder()` @@ -772,10 +880,10 @@ class JsonParser extends _$jni.JObject { /// parsers that use blocking I/O. ///@return Input feeder to use with non-blocking (async) parsing ///@since 2.9 - _$jni.JObject getNonBlockingInputFeeder() { + jni$_.JObject? getNonBlockingInputFeeder() { return _getNonBlockingInputFeeder(reference.pointer, - _id_getNonBlockingInputFeeder as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_getNonBlockingInputFeeder as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getReadCapabilities = _class.instanceMethodId( @@ -783,16 +891,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/util/JacksonFeatureSet;', ); - static final _getReadCapabilities = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getReadCapabilities = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.util.JacksonFeatureSet getReadCapabilities()` @@ -802,10 +910,10 @@ class JsonParser extends _$jni.JObject { /// underlying data format being read (directly or indirectly). ///@return Set of read capabilities for content to read via this parser ///@since 2.12 - _$jni.JObject getReadCapabilities() { + jni$_.JObject? getReadCapabilities() { return _getReadCapabilities( - reference.pointer, _id_getReadCapabilities as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getReadCapabilities as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_version = _class.instanceMethodId( @@ -813,16 +921,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/Version;', ); - static final _version = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _version = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.Version version()` @@ -832,9 +940,9 @@ class JsonParser extends _$jni.JObject { /// Left for sub-classes to implement. ///@return Version of this generator (derived from version declared for /// {@code jackson-core} jar that contains the class - _$jni.JObject version() { - return _version(reference.pointer, _id_version as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? version() { + return _version(reference.pointer, _id_version as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_close = _class.instanceMethodId( @@ -842,16 +950,16 @@ class JsonParser extends _$jni.JObject { r'()V', ); - static final _close = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _close = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract void close()` @@ -871,7 +979,7 @@ class JsonParser extends _$jni.JObject { /// stream or reader it does own them. ///@throws IOException if there is either an underlying I/O problem void close() { - _close(reference.pointer, _id_close as _$jni.JMethodIDPtr).check(); + _close(reference.pointer, _id_close as jni$_.JMethodIDPtr).check(); } static final _id_isClosed = _class.instanceMethodId( @@ -879,16 +987,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _isClosed = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isClosed = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract boolean isClosed()` @@ -901,7 +1009,7 @@ class JsonParser extends _$jni.JObject { /// end of input. ///@return {@code True} if this parser instance has been closed bool isClosed() { - return _isClosed(reference.pointer, _id_isClosed as _$jni.JMethodIDPtr) + return _isClosed(reference.pointer, _id_isClosed as jni$_.JMethodIDPtr) .boolean; } @@ -910,16 +1018,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonStreamContext;', ); - static final _getParsingContext = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getParsingContext = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonStreamContext getParsingContext()` @@ -934,10 +1042,10 @@ class JsonParser extends _$jni.JObject { /// Contexts can also be used for simple xpath-like matching of /// input, if so desired. ///@return Stream input context (JsonStreamContext) associated with this parser - _$jni.JObject getParsingContext() { + jni$_.JObject? getParsingContext() { return _getParsingContext( - reference.pointer, _id_getParsingContext as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getParsingContext as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_currentLocation = _class.instanceMethodId( @@ -945,16 +1053,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonLocation;', ); - static final _currentLocation = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _currentLocation = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.JsonLocation currentLocation()` @@ -972,10 +1080,10 @@ class JsonParser extends _$jni.JObject { /// to other library) ///@return Location of the last processed input unit (byte or character) ///@since 2.13 - _$jni.JObject currentLocation() { + jni$_.JObject? currentLocation() { return _currentLocation( - reference.pointer, _id_currentLocation as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_currentLocation as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_currentTokenLocation = _class.instanceMethodId( @@ -983,16 +1091,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonLocation;', ); - static final _currentTokenLocation = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _currentTokenLocation = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.JsonLocation currentTokenLocation()` @@ -1010,10 +1118,10 @@ class JsonParser extends _$jni.JObject { /// to other library) ///@return Starting location of the token parser currently points to ///@since 2.13 (will eventually replace \#getTokenLocation) - _$jni.JObject currentTokenLocation() { + jni$_.JObject? currentTokenLocation() { return _currentTokenLocation( - reference.pointer, _id_currentTokenLocation as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_currentTokenLocation as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getCurrentLocation = _class.instanceMethodId( @@ -1021,16 +1129,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonLocation;', ); - static final _getCurrentLocation = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCurrentLocation = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonLocation getCurrentLocation()` @@ -1039,10 +1147,10 @@ class JsonParser extends _$jni.JObject { /// Alias for \#currentLocation(), to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@return Location of the last processed input unit (byte or character) - _$jni.JObject getCurrentLocation() { + jni$_.JObject? getCurrentLocation() { return _getCurrentLocation( - reference.pointer, _id_getCurrentLocation as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getCurrentLocation as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getTokenLocation = _class.instanceMethodId( @@ -1050,16 +1158,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonLocation;', ); - static final _getTokenLocation = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTokenLocation = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonLocation getTokenLocation()` @@ -1068,10 +1176,10 @@ class JsonParser extends _$jni.JObject { /// Alias for \#currentTokenLocation(), to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@return Starting location of the token parser currently points to - _$jni.JObject getTokenLocation() { + jni$_.JObject? getTokenLocation() { return _getTokenLocation( - reference.pointer, _id_getTokenLocation as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getTokenLocation as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_currentValue = _class.instanceMethodId( @@ -1079,16 +1187,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _currentValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _currentValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object currentValue()` @@ -1105,10 +1213,10 @@ class JsonParser extends _$jni.JObject { /// and gets passed through data-binding. ///@return "Current value" associated with the current input context (state) of this parser ///@since 2.13 (added as replacement for older \#getCurrentValue() - _$jni.JObject currentValue() { + jni$_.JObject? currentValue() { return _currentValue( - reference.pointer, _id_currentValue as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_currentValue as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_assignCurrentValue = _class.instanceMethodId( @@ -1116,16 +1224,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/lang/Object;)V', ); - static final _assignCurrentValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _assignCurrentValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void assignCurrentValue(java.lang.Object v)` /// @@ -1136,10 +1244,11 @@ class JsonParser extends _$jni.JObject { ///@param v Current value to assign for the current input context of this parser ///@since 2.13 (added as replacement for older \#setCurrentValue void assignCurrentValue( - _$jni.JObject v, + jni$_.JObject? v, ) { + final _$v = v?.reference ?? jni$_.jNullReference; _assignCurrentValue(reference.pointer, - _id_assignCurrentValue as _$jni.JMethodIDPtr, v.reference.pointer) + _id_assignCurrentValue as jni$_.JMethodIDPtr, _$v.pointer) .check(); } @@ -1148,16 +1257,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _getCurrentValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCurrentValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object getCurrentValue()` @@ -1166,10 +1275,10 @@ class JsonParser extends _$jni.JObject { /// Alias for \#currentValue(), to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@return Location of the last processed input unit (byte or character) - _$jni.JObject getCurrentValue() { + jni$_.JObject? getCurrentValue() { return _getCurrentValue( - reference.pointer, _id_getCurrentValue as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getCurrentValue as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setCurrentValue = _class.instanceMethodId( @@ -1177,16 +1286,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/lang/Object;)V', ); - static final _setCurrentValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCurrentValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setCurrentValue(java.lang.Object v)` /// @@ -1194,10 +1303,11 @@ class JsonParser extends _$jni.JObject { /// Jackson 2.x versions (and removed from Jackson 3.0). ///@param v Current value to assign for the current input context of this parser void setCurrentValue( - _$jni.JObject v, + jni$_.JObject? v, ) { + final _$v = v?.reference ?? jni$_.jNullReference; _setCurrentValue(reference.pointer, - _id_setCurrentValue as _$jni.JMethodIDPtr, v.reference.pointer) + _id_setCurrentValue as jni$_.JMethodIDPtr, _$v.pointer) .check(); } @@ -1206,16 +1316,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/io/OutputStream;)I', ); - static final _releaseBuffered = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _releaseBuffered = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public int releaseBuffered(java.io.OutputStream out)` /// @@ -1231,10 +1341,11 @@ class JsonParser extends _$jni.JObject { /// otherwise number of bytes released (0 if there was nothing to release) ///@throws IOException if write to stream threw exception int releaseBuffered( - _$jni.JObject out, + jni$_.JObject? out, ) { + final _$out = out?.reference ?? jni$_.jNullReference; return _releaseBuffered(reference.pointer, - _id_releaseBuffered as _$jni.JMethodIDPtr, out.reference.pointer) + _id_releaseBuffered as jni$_.JMethodIDPtr, _$out.pointer) .integer; } @@ -1243,16 +1354,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/io/Writer;)I', ); - static final _releaseBuffered$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _releaseBuffered$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public int releaseBuffered(java.io.Writer w)` /// @@ -1269,10 +1380,11 @@ class JsonParser extends _$jni.JObject { /// otherwise number of chars released (0 if there was nothing to release) ///@throws IOException if write using Writer threw exception int releaseBuffered$1( - _$jni.JObject w, + jni$_.JObject? w, ) { + final _$w = w?.reference ?? jni$_.jNullReference; return _releaseBuffered$1(reference.pointer, - _id_releaseBuffered$1 as _$jni.JMethodIDPtr, w.reference.pointer) + _id_releaseBuffered$1 as jni$_.JMethodIDPtr, _$w.pointer) .integer; } @@ -1281,16 +1393,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _enable = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _enable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser enable(com.fasterxml.jackson.core.JsonParser.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -1299,12 +1411,13 @@ class JsonParser extends _$jni.JObject { /// (check Feature for list of features) ///@param f Feature to enable ///@return This parser, to allow call chaining - JsonParser enable( - JsonParser_Feature f, + JsonParser? enable( + JsonParser$Feature? f, ) { - return _enable(reference.pointer, _id_enable as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonParser$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _enable( + reference.pointer, _id_enable as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonParser$NullableType()); } static final _id_disable = _class.instanceMethodId( @@ -1312,16 +1425,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _disable = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _disable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public com.fasterxml.jackson.core.JsonParser disable(com.fasterxml.jackson.core.JsonParser.Feature f)` /// The returned object must be released after use, by calling the [release] method. @@ -1330,12 +1443,13 @@ class JsonParser extends _$jni.JObject { /// (check Feature for list of features) ///@param f Feature to disable ///@return This parser, to allow call chaining - JsonParser disable( - JsonParser_Feature f, + JsonParser? disable( + JsonParser$Feature? f, ) { - return _disable(reference.pointer, _id_disable as _$jni.JMethodIDPtr, - f.reference.pointer) - .object(const $JsonParser$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _disable( + reference.pointer, _id_disable as jni$_.JMethodIDPtr, _$f.pointer) + .object(const $JsonParser$NullableType()); } static final _id_configure = _class.instanceMethodId( @@ -1343,17 +1457,17 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;Z)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _configure = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + static final _configure = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state)` /// The returned object must be released after use, by calling the [release] method. @@ -1363,13 +1477,14 @@ class JsonParser extends _$jni.JObject { ///@param f Feature to enable or disable ///@param state Whether to enable feature ({@code true}) or disable ({@code false}) ///@return This parser, to allow call chaining - JsonParser configure( - JsonParser_Feature f, + JsonParser? configure( + JsonParser$Feature? f, bool state, ) { - return _configure(reference.pointer, _id_configure as _$jni.JMethodIDPtr, - f.reference.pointer, state ? 1 : 0) - .object(const $JsonParser$Type()); + final _$f = f?.reference ?? jni$_.jNullReference; + return _configure(reference.pointer, _id_configure as jni$_.JMethodIDPtr, + _$f.pointer, state ? 1 : 0) + .object(const $JsonParser$NullableType()); } static final _id_isEnabled = _class.instanceMethodId( @@ -1377,16 +1492,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Z', ); - static final _isEnabled = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f)` /// @@ -1394,10 +1509,11 @@ class JsonParser extends _$jni.JObject { ///@param f Feature to check ///@return {@code True} if feature is enabled; {@code false} otherwise bool isEnabled( - JsonParser_Feature f, + JsonParser$Feature? f, ) { - return _isEnabled(reference.pointer, _id_isEnabled as _$jni.JMethodIDPtr, - f.reference.pointer) + final _$f = f?.reference ?? jni$_.jNullReference; + return _isEnabled( + reference.pointer, _id_isEnabled as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -1406,16 +1522,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/StreamReadFeature;)Z', ); - static final _isEnabled$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _isEnabled$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f)` /// @@ -1424,10 +1540,11 @@ class JsonParser extends _$jni.JObject { ///@return {@code True} if feature is enabled; {@code false} otherwise ///@since 2.10 bool isEnabled$1( - _$jni.JObject f, + jni$_.JObject? f, ) { + final _$f = f?.reference ?? jni$_.jNullReference; return _isEnabled$1(reference.pointer, - _id_isEnabled$1 as _$jni.JMethodIDPtr, f.reference.pointer) + _id_isEnabled$1 as jni$_.JMethodIDPtr, _$f.pointer) .boolean; } @@ -1436,16 +1553,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getFeatureMask = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFeatureMask = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getFeatureMask()` @@ -1455,7 +1572,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.3 int getFeatureMask() { return _getFeatureMask( - reference.pointer, _id_getFeatureMask as _$jni.JMethodIDPtr) + reference.pointer, _id_getFeatureMask as jni$_.JMethodIDPtr) .integer; } @@ -1464,15 +1581,15 @@ class JsonParser extends _$jni.JObject { r'(I)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _setFeatureMask = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + static final _setFeatureMask = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser setFeatureMask(int mask)` /// The returned object must be released after use, by calling the [release] method. @@ -1482,12 +1599,12 @@ class JsonParser extends _$jni.JObject { ///@return This parser, to allow call chaining ///@since 2.3 ///@deprecated Since 2.7, use \#overrideStdFeatures(int, int) instead - JsonParser setFeatureMask( + JsonParser? setFeatureMask( int mask, ) { return _setFeatureMask( - reference.pointer, _id_setFeatureMask as _$jni.JMethodIDPtr, mask) - .object(const $JsonParser$Type()); + reference.pointer, _id_setFeatureMask as jni$_.JMethodIDPtr, mask) + .object(const $JsonParser$NullableType()); } static final _id_overrideStdFeatures = _class.instanceMethodId( @@ -1495,16 +1612,16 @@ class JsonParser extends _$jni.JObject { r'(II)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _overrideStdFeatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32, _$jni.Int32)>)>>( + static final _overrideStdFeatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser overrideStdFeatures(int values, int mask)` /// The returned object must be released after use, by calling the [release] method. @@ -1521,13 +1638,13 @@ class JsonParser extends _$jni.JObject { ///@param mask Bit mask of features to change ///@return This parser, to allow call chaining ///@since 2.6 - JsonParser overrideStdFeatures( + JsonParser? overrideStdFeatures( int values, int mask, ) { return _overrideStdFeatures(reference.pointer, - _id_overrideStdFeatures as _$jni.JMethodIDPtr, values, mask) - .object(const $JsonParser$Type()); + _id_overrideStdFeatures as jni$_.JMethodIDPtr, values, mask) + .object(const $JsonParser$NullableType()); } static final _id_getFormatFeatures = _class.instanceMethodId( @@ -1535,16 +1652,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getFormatFeatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFormatFeatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getFormatFeatures()` @@ -1555,7 +1672,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.6 int getFormatFeatures() { return _getFormatFeatures( - reference.pointer, _id_getFormatFeatures as _$jni.JMethodIDPtr) + reference.pointer, _id_getFormatFeatures as jni$_.JMethodIDPtr) .integer; } @@ -1564,16 +1681,16 @@ class JsonParser extends _$jni.JObject { r'(II)Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _overrideFormatFeatures = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32, _$jni.Int32)>)>>( + static final _overrideFormatFeatures = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); /// from: `public com.fasterxml.jackson.core.JsonParser overrideFormatFeatures(int values, int mask)` /// The returned object must be released after use, by calling the [release] method. @@ -1588,13 +1705,13 @@ class JsonParser extends _$jni.JObject { ///@param mask Bit mask of features to change ///@return This parser, to allow call chaining ///@since 2.6 - JsonParser overrideFormatFeatures( + JsonParser? overrideFormatFeatures( int values, int mask, ) { return _overrideFormatFeatures(reference.pointer, - _id_overrideFormatFeatures as _$jni.JMethodIDPtr, values, mask) - .object(const $JsonParser$Type()); + _id_overrideFormatFeatures as jni$_.JMethodIDPtr, values, mask) + .object(const $JsonParser$NullableType()); } static final _id_nextToken = _class.instanceMethodId( @@ -1602,16 +1719,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _nextToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _nextToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonToken nextToken()` @@ -1625,9 +1742,10 @@ class JsonParser extends _$jni.JObject { /// to indicate end-of-input ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jsontoken_.JsonToken nextToken() { - return _nextToken(reference.pointer, _id_nextToken as _$jni.JMethodIDPtr) - .object(const jsontoken_.$JsonToken$Type()); + jsontoken$_.JsonToken? nextToken() { + return _nextToken(reference.pointer, _id_nextToken as jni$_.JMethodIDPtr) + .object( + const jsontoken$_.$JsonToken$NullableType()); } static final _id_nextValue = _class.instanceMethodId( @@ -1635,16 +1753,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _nextValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _nextValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonToken nextValue()` @@ -1666,9 +1784,10 @@ class JsonParser extends _$jni.JObject { /// available yet) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jsontoken_.JsonToken nextValue() { - return _nextValue(reference.pointer, _id_nextValue as _$jni.JMethodIDPtr) - .object(const jsontoken_.$JsonToken$Type()); + jsontoken$_.JsonToken? nextValue() { + return _nextValue(reference.pointer, _id_nextValue as jni$_.JMethodIDPtr) + .object( + const jsontoken$_.$JsonToken$NullableType()); } static final _id_nextFieldName = _class.instanceMethodId( @@ -1676,16 +1795,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/SerializableString;)Z', ); - static final _nextFieldName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _nextFieldName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean nextFieldName(com.fasterxml.jackson.core.SerializableString str)` /// @@ -1705,10 +1824,11 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems bool nextFieldName( - _$jni.JObject str, + jni$_.JObject? str, ) { + final _$str = str?.reference ?? jni$_.jNullReference; return _nextFieldName(reference.pointer, - _id_nextFieldName as _$jni.JMethodIDPtr, str.reference.pointer) + _id_nextFieldName as jni$_.JMethodIDPtr, _$str.pointer) .boolean; } @@ -1717,16 +1837,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _nextFieldName$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _nextFieldName$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String nextFieldName()` @@ -1740,10 +1860,10 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.5 - _$jni.JString nextFieldName$1() { + jni$_.JString? nextFieldName$1() { return _nextFieldName$1( - reference.pointer, _id_nextFieldName$1 as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_nextFieldName$1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_nextTextValue = _class.instanceMethodId( @@ -1751,16 +1871,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _nextTextValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _nextTextValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String nextTextValue()` @@ -1779,10 +1899,10 @@ class JsonParser extends _$jni.JObject { /// to; or {@code null} if next token is of some other type ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JString nextTextValue() { + jni$_.JString? nextTextValue() { return _nextTextValue( - reference.pointer, _id_nextTextValue as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_nextTextValue as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_nextIntValue = _class.instanceMethodId( @@ -1790,15 +1910,15 @@ class JsonParser extends _$jni.JObject { r'(I)I', ); - static final _nextIntValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallIntMethod') + static final _nextIntValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public int nextIntValue(int defaultValue)` /// @@ -1823,7 +1943,7 @@ class JsonParser extends _$jni.JObject { int defaultValue, ) { return _nextIntValue(reference.pointer, - _id_nextIntValue as _$jni.JMethodIDPtr, defaultValue) + _id_nextIntValue as jni$_.JMethodIDPtr, defaultValue) .integer; } @@ -1832,15 +1952,15 @@ class JsonParser extends _$jni.JObject { r'(J)J', ); - static final _nextLongValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + static final _nextLongValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public long nextLongValue(long defaultValue)` /// @@ -1865,7 +1985,7 @@ class JsonParser extends _$jni.JObject { int defaultValue, ) { return _nextLongValue(reference.pointer, - _id_nextLongValue as _$jni.JMethodIDPtr, defaultValue) + _id_nextLongValue as jni$_.JMethodIDPtr, defaultValue) .long; } @@ -1874,16 +1994,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Boolean;', ); - static final _nextBooleanValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _nextBooleanValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Boolean nextBooleanValue()` @@ -1905,10 +2025,10 @@ class JsonParser extends _$jni.JObject { /// token parser advanced to; or {@code null} if next token is of some other type ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JBoolean nextBooleanValue() { + jni$_.JBoolean? nextBooleanValue() { return _nextBooleanValue( - reference.pointer, _id_nextBooleanValue as _$jni.JMethodIDPtr) - .object(const _$jni.JBooleanType()); + reference.pointer, _id_nextBooleanValue as jni$_.JMethodIDPtr) + .object(const jni$_.JBooleanNullableType()); } static final _id_skipChildren = _class.instanceMethodId( @@ -1916,16 +2036,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonParser;', ); - static final _skipChildren = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _skipChildren = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonParser skipChildren()` @@ -1946,10 +2066,10 @@ class JsonParser extends _$jni.JObject { ///@return This parser, to allow call chaining ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - JsonParser skipChildren() { + JsonParser? skipChildren() { return _skipChildren( - reference.pointer, _id_skipChildren as _$jni.JMethodIDPtr) - .object(const $JsonParser$Type()); + reference.pointer, _id_skipChildren as jni$_.JMethodIDPtr) + .object(const $JsonParser$NullableType()); } static final _id_finishToken = _class.instanceMethodId( @@ -1957,16 +2077,16 @@ class JsonParser extends _$jni.JObject { r'()V', ); - static final _finishToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _finishToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void finishToken()` @@ -1985,7 +2105,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems ///@since 2.8 void finishToken() { - _finishToken(reference.pointer, _id_finishToken as _$jni.JMethodIDPtr) + _finishToken(reference.pointer, _id_finishToken as jni$_.JMethodIDPtr) .check(); } @@ -1994,16 +2114,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _currentToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _currentToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.fasterxml.jackson.core.JsonToken currentToken()` @@ -2018,10 +2138,11 @@ class JsonParser extends _$jni.JObject { /// after end-of-input has been encountered, as well as /// if the current token has been explicitly cleared. ///@since 2.8 - jsontoken_.JsonToken currentToken() { + jsontoken$_.JsonToken? currentToken() { return _currentToken( - reference.pointer, _id_currentToken as _$jni.JMethodIDPtr) - .object(const jsontoken_.$JsonToken$Type()); + reference.pointer, _id_currentToken as jni$_.JMethodIDPtr) + .object( + const jsontoken$_.$JsonToken$NullableType()); } static final _id_currentTokenId = _class.instanceMethodId( @@ -2029,16 +2150,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _currentTokenId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _currentTokenId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int currentTokenId()` @@ -2054,7 +2175,7 @@ class JsonParser extends _$jni.JObject { ///@return {@code int} matching one of constants from JsonTokenId. int currentTokenId() { return _currentTokenId( - reference.pointer, _id_currentTokenId as _$jni.JMethodIDPtr) + reference.pointer, _id_currentTokenId as jni$_.JMethodIDPtr) .integer; } @@ -2063,16 +2184,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _getCurrentToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCurrentToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonToken getCurrentToken()` @@ -2082,10 +2203,11 @@ class JsonParser extends _$jni.JObject { /// Jackson 2.13 (will be removed from 3.0). ///@return Type of the token this parser currently points to, /// if any: null before any tokens have been read, and - jsontoken_.JsonToken getCurrentToken() { + jsontoken$_.JsonToken? getCurrentToken() { return _getCurrentToken( - reference.pointer, _id_getCurrentToken as _$jni.JMethodIDPtr) - .object(const jsontoken_.$JsonToken$Type()); + reference.pointer, _id_getCurrentToken as jni$_.JMethodIDPtr) + .object( + const jsontoken$_.$JsonToken$NullableType()); } static final _id_getCurrentTokenId = _class.instanceMethodId( @@ -2093,16 +2215,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getCurrentTokenId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCurrentTokenId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract int getCurrentTokenId()` @@ -2112,7 +2234,7 @@ class JsonParser extends _$jni.JObject { ///@deprecated Since 2.12 use \#currentTokenId instead int getCurrentTokenId() { return _getCurrentTokenId( - reference.pointer, _id_getCurrentTokenId as _$jni.JMethodIDPtr) + reference.pointer, _id_getCurrentTokenId as jni$_.JMethodIDPtr) .integer; } @@ -2121,16 +2243,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _hasCurrentToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _hasCurrentToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract boolean hasCurrentToken()` @@ -2145,7 +2267,7 @@ class JsonParser extends _$jni.JObject { /// has been consumed) bool hasCurrentToken() { return _hasCurrentToken( - reference.pointer, _id_hasCurrentToken as _$jni.JMethodIDPtr) + reference.pointer, _id_hasCurrentToken as jni$_.JMethodIDPtr) .boolean; } @@ -2154,16 +2276,16 @@ class JsonParser extends _$jni.JObject { r'(I)Z', ); - static final _hasTokenId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallBooleanMethod') + static final _hasTokenId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public abstract boolean hasTokenId(int id)` /// @@ -2183,7 +2305,7 @@ class JsonParser extends _$jni.JObject { int id, ) { return _hasTokenId( - reference.pointer, _id_hasTokenId as _$jni.JMethodIDPtr, id) + reference.pointer, _id_hasTokenId as jni$_.JMethodIDPtr, id) .boolean; } @@ -2192,16 +2314,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/JsonToken;)Z', ); - static final _hasToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _hasToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract boolean hasToken(com.fasterxml.jackson.core.JsonToken t)` /// @@ -2218,10 +2340,11 @@ class JsonParser extends _$jni.JObject { ///@return {@code True} if the parser current points to specified token ///@since 2.6 bool hasToken( - jsontoken_.JsonToken t, + jsontoken$_.JsonToken? t, ) { - return _hasToken(reference.pointer, _id_hasToken as _$jni.JMethodIDPtr, - t.reference.pointer) + final _$t = t?.reference ?? jni$_.jNullReference; + return _hasToken( + reference.pointer, _id_hasToken as jni$_.JMethodIDPtr, _$t.pointer) .boolean; } @@ -2230,16 +2353,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _isExpectedStartArrayToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isExpectedStartArrayToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isExpectedStartArrayToken()` @@ -2262,7 +2385,7 @@ class JsonParser extends _$jni.JObject { /// {@code false} if not bool isExpectedStartArrayToken() { return _isExpectedStartArrayToken(reference.pointer, - _id_isExpectedStartArrayToken as _$jni.JMethodIDPtr) + _id_isExpectedStartArrayToken as jni$_.JMethodIDPtr) .boolean; } @@ -2272,16 +2395,16 @@ class JsonParser extends _$jni.JObject { ); static final _isExpectedStartObjectToken = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isExpectedStartObjectToken()` @@ -2294,7 +2417,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.5 bool isExpectedStartObjectToken() { return _isExpectedStartObjectToken(reference.pointer, - _id_isExpectedStartObjectToken as _$jni.JMethodIDPtr) + _id_isExpectedStartObjectToken as jni$_.JMethodIDPtr) .boolean; } @@ -2303,16 +2426,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _isExpectedNumberIntToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isExpectedNumberIntToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isExpectedNumberIntToken()` @@ -2328,7 +2451,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.12 bool isExpectedNumberIntToken() { return _isExpectedNumberIntToken(reference.pointer, - _id_isExpectedNumberIntToken as _$jni.JMethodIDPtr) + _id_isExpectedNumberIntToken as jni$_.JMethodIDPtr) .boolean; } @@ -2337,16 +2460,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _isNaN = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isNaN = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean isNaN()` @@ -2364,7 +2487,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems ///@since 2.9 bool isNaN() { - return _isNaN(reference.pointer, _id_isNaN as _$jni.JMethodIDPtr).boolean; + return _isNaN(reference.pointer, _id_isNaN as jni$_.JMethodIDPtr).boolean; } static final _id_clearCurrentToken = _class.instanceMethodId( @@ -2372,16 +2495,16 @@ class JsonParser extends _$jni.JObject { r'()V', ); - static final _clearCurrentToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _clearCurrentToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract void clearCurrentToken()` @@ -2398,7 +2521,7 @@ class JsonParser extends _$jni.JObject { /// it will not be used again). void clearCurrentToken() { _clearCurrentToken( - reference.pointer, _id_clearCurrentToken as _$jni.JMethodIDPtr) + reference.pointer, _id_clearCurrentToken as jni$_.JMethodIDPtr) .check(); } @@ -2407,16 +2530,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _getLastClearedToken = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getLastClearedToken = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonToken getLastClearedToken()` @@ -2428,10 +2551,11 @@ class JsonParser extends _$jni.JObject { /// Will return null if no tokens have been cleared, /// or if parser has been closed. ///@return Last cleared token, if any; {@code null} otherwise - jsontoken_.JsonToken getLastClearedToken() { + jsontoken$_.JsonToken? getLastClearedToken() { return _getLastClearedToken( - reference.pointer, _id_getLastClearedToken as _$jni.JMethodIDPtr) - .object(const jsontoken_.$JsonToken$Type()); + reference.pointer, _id_getLastClearedToken as jni$_.JMethodIDPtr) + .object( + const jsontoken$_.$JsonToken$NullableType()); } static final _id_overrideCurrentName = _class.instanceMethodId( @@ -2439,16 +2563,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _overrideCurrentName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _overrideCurrentName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract void overrideCurrentName(java.lang.String name)` /// @@ -2461,12 +2585,11 @@ class JsonParser extends _$jni.JObject { /// resort, as it is a work-around for regular operation. ///@param name Name to use as the current name; may be null. void overrideCurrentName( - _$jni.JString name, + jni$_.JString? name, ) { - _overrideCurrentName( - reference.pointer, - _id_overrideCurrentName as _$jni.JMethodIDPtr, - name.reference.pointer) + final _$name = name?.reference ?? jni$_.jNullReference; + _overrideCurrentName(reference.pointer, + _id_overrideCurrentName as jni$_.JMethodIDPtr, _$name.pointer) .check(); } @@ -2475,16 +2598,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getCurrentName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCurrentName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract java.lang.String getCurrentName()` @@ -2494,10 +2617,10 @@ class JsonParser extends _$jni.JObject { ///@return Name of the current field in the parsing context ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JString getCurrentName() { + jni$_.JString? getCurrentName() { return _getCurrentName( - reference.pointer, _id_getCurrentName as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getCurrentName as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_currentName = _class.instanceMethodId( @@ -2505,16 +2628,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _currentName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _currentName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String currentName()` @@ -2529,10 +2652,10 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.10 - _$jni.JString currentName() { + jni$_.JString? currentName() { return _currentName( - reference.pointer, _id_currentName as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_currentName as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getText = _class.instanceMethodId( @@ -2540,16 +2663,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getText = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getText = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract java.lang.String getText()` @@ -2563,9 +2686,9 @@ class JsonParser extends _$jni.JObject { /// by \#nextToken() or other iteration methods) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JString getText() { - return _getText(reference.pointer, _id_getText as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? getText() { + return _getText(reference.pointer, _id_getText as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getText$1 = _class.instanceMethodId( @@ -2573,16 +2696,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/io/Writer;)I', ); - static final _getText$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getText$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public int getText(java.io.Writer writer)` /// @@ -2602,10 +2725,11 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems ///@since 2.8 int getText$1( - _$jni.JObject writer, + jni$_.JObject? writer, ) { - return _getText$1(reference.pointer, _id_getText$1 as _$jni.JMethodIDPtr, - writer.reference.pointer) + final _$writer = writer?.reference ?? jni$_.jNullReference; + return _getText$1(reference.pointer, _id_getText$1 as jni$_.JMethodIDPtr, + _$writer.pointer) .integer; } @@ -2614,16 +2738,16 @@ class JsonParser extends _$jni.JObject { r'()[C', ); - static final _getTextCharacters = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTextCharacters = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract char[] getTextCharacters()` @@ -2656,10 +2780,10 @@ class JsonParser extends _$jni.JObject { /// at offset 0, and not necessarily until the end of buffer) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JArray<_$jni.jchar> getTextCharacters() { + jni$_.JCharArray? getTextCharacters() { return _getTextCharacters( - reference.pointer, _id_getTextCharacters as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jcharType())); + reference.pointer, _id_getTextCharacters as jni$_.JMethodIDPtr) + .object(const jni$_.JCharArrayNullableType()); } static final _id_getTextLength = _class.instanceMethodId( @@ -2667,16 +2791,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getTextLength = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTextLength = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract int getTextLength()` @@ -2690,7 +2814,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getTextLength() { return _getTextLength( - reference.pointer, _id_getTextLength as _$jni.JMethodIDPtr) + reference.pointer, _id_getTextLength as jni$_.JMethodIDPtr) .integer; } @@ -2699,16 +2823,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getTextOffset = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTextOffset = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract int getTextOffset()` @@ -2722,7 +2846,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getTextOffset() { return _getTextOffset( - reference.pointer, _id_getTextOffset as _$jni.JMethodIDPtr) + reference.pointer, _id_getTextOffset as jni$_.JMethodIDPtr) .integer; } @@ -2731,16 +2855,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _hasTextCharacters = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _hasTextCharacters = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract boolean hasTextCharacters()` @@ -2761,7 +2885,7 @@ class JsonParser extends _$jni.JObject { /// means that it may or may not exist bool hasTextCharacters() { return _hasTextCharacters( - reference.pointer, _id_hasTextCharacters as _$jni.JMethodIDPtr) + reference.pointer, _id_hasTextCharacters as jni$_.JMethodIDPtr) .boolean; } @@ -2770,16 +2894,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Number;', ); - static final _getNumberValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNumberValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract java.lang.Number getNumberValue()` @@ -2795,10 +2919,10 @@ class JsonParser extends _$jni.JObject { /// the current token is not numeric, or if decoding of the value fails /// (invalid format for numbers); plain IOException if underlying /// content read fails (possible if values are extracted lazily) - _$jni.JNumber getNumberValue() { + jni$_.JNumber? getNumberValue() { return _getNumberValue( - reference.pointer, _id_getNumberValue as _$jni.JMethodIDPtr) - .object(const _$jni.JNumberType()); + reference.pointer, _id_getNumberValue as jni$_.JMethodIDPtr) + .object(const jni$_.JNumberNullableType()); } static final _id_getNumberValueExact = _class.instanceMethodId( @@ -2806,16 +2930,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Number;', ); - static final _getNumberValueExact = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNumberValueExact = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Number getNumberValueExact()` @@ -2835,10 +2959,10 @@ class JsonParser extends _$jni.JObject { /// (invalid format for numbers); plain IOException if underlying /// content read fails (possible if values are extracted lazily) ///@since 2.12 - _$jni.JNumber getNumberValueExact() { + jni$_.JNumber? getNumberValueExact() { return _getNumberValueExact( - reference.pointer, _id_getNumberValueExact as _$jni.JMethodIDPtr) - .object(const _$jni.JNumberType()); + reference.pointer, _id_getNumberValueExact as jni$_.JMethodIDPtr) + .object(const jni$_.JNumberNullableType()); } static final _id_getNumberType = _class.instanceMethodId( @@ -2846,16 +2970,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/JsonParser$NumberType;', ); - static final _getNumberType = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNumberType = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract com.fasterxml.jackson.core.JsonParser.NumberType getNumberType()` @@ -2868,10 +2992,11 @@ class JsonParser extends _$jni.JObject { ///@return Type of current number, if parser points to numeric token; {@code null} otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - JsonParser_NumberType getNumberType() { + JsonParser$NumberType? getNumberType() { return _getNumberType( - reference.pointer, _id_getNumberType as _$jni.JMethodIDPtr) - .object(const $JsonParser_NumberType$Type()); + reference.pointer, _id_getNumberType as jni$_.JMethodIDPtr) + .object( + const $JsonParser$NumberType$NullableType()); } static final _id_getByteValue = _class.instanceMethodId( @@ -2879,16 +3004,16 @@ class JsonParser extends _$jni.JObject { r'()B', ); - static final _getByteValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getByteValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallByteMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public byte getByteValue()` @@ -2916,7 +3041,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getByteValue() { return _getByteValue( - reference.pointer, _id_getByteValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getByteValue as jni$_.JMethodIDPtr) .byte; } @@ -2925,16 +3050,16 @@ class JsonParser extends _$jni.JObject { r'()S', ); - static final _getShortValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getShortValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallShortMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public short getShortValue()` @@ -2956,7 +3081,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getShortValue() { return _getShortValue( - reference.pointer, _id_getShortValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getShortValue as jni$_.JMethodIDPtr) .short; } @@ -2965,16 +3090,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getIntValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getIntValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract int getIntValue()` @@ -2996,7 +3121,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getIntValue() { return _getIntValue( - reference.pointer, _id_getIntValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getIntValue as jni$_.JMethodIDPtr) .integer; } @@ -3005,16 +3130,16 @@ class JsonParser extends _$jni.JObject { r'()J', ); - static final _getLongValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getLongValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract long getLongValue()` @@ -3036,7 +3161,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getLongValue() { return _getLongValue( - reference.pointer, _id_getLongValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getLongValue as jni$_.JMethodIDPtr) .long; } @@ -3045,16 +3170,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/math/BigInteger;', ); - static final _getBigIntegerValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getBigIntegerValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract java.math.BigInteger getBigIntegerValue()` @@ -3071,10 +3196,10 @@ class JsonParser extends _$jni.JObject { /// otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JObject getBigIntegerValue() { + jni$_.JObject? getBigIntegerValue() { return _getBigIntegerValue( - reference.pointer, _id_getBigIntegerValue as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getBigIntegerValue as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getFloatValue = _class.instanceMethodId( @@ -3082,16 +3207,16 @@ class JsonParser extends _$jni.JObject { r'()F', ); - static final _getFloatValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getFloatValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract float getFloatValue()` @@ -3113,7 +3238,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems double getFloatValue() { return _getFloatValue( - reference.pointer, _id_getFloatValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getFloatValue as jni$_.JMethodIDPtr) .float; } @@ -3122,16 +3247,16 @@ class JsonParser extends _$jni.JObject { r'()D', ); - static final _getDoubleValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDoubleValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallDoubleMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract double getDoubleValue()` @@ -3153,7 +3278,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems double getDoubleValue() { return _getDoubleValue( - reference.pointer, _id_getDoubleValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getDoubleValue as jni$_.JMethodIDPtr) .doubleFloat; } @@ -3162,16 +3287,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/math/BigDecimal;', ); - static final _getDecimalValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getDecimalValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract java.math.BigDecimal getDecimalValue()` @@ -3185,10 +3310,10 @@ class JsonParser extends _$jni.JObject { /// otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JObject getDecimalValue() { + jni$_.JObject? getDecimalValue() { return _getDecimalValue( - reference.pointer, _id_getDecimalValue as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getDecimalValue as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getBooleanValue = _class.instanceMethodId( @@ -3196,16 +3321,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _getBooleanValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getBooleanValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getBooleanValue()` @@ -3223,7 +3348,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems bool getBooleanValue() { return _getBooleanValue( - reference.pointer, _id_getBooleanValue as _$jni.JMethodIDPtr) + reference.pointer, _id_getBooleanValue as jni$_.JMethodIDPtr) .boolean; } @@ -3232,16 +3357,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _getEmbeddedObject = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getEmbeddedObject = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object getEmbeddedObject()` @@ -3261,10 +3386,10 @@ class JsonParser extends _$jni.JObject { /// for the current token, if any; {@code null otherwise} ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JObject getEmbeddedObject() { + jni$_.JObject? getEmbeddedObject() { return _getEmbeddedObject( - reference.pointer, _id_getEmbeddedObject as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getEmbeddedObject as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getBinaryValue = _class.instanceMethodId( @@ -3272,16 +3397,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/Base64Variant;)[B', ); - static final _getBinaryValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getBinaryValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant bv)` /// The returned object must be released after use, by calling the [release] method. @@ -3306,12 +3431,13 @@ class JsonParser extends _$jni.JObject { ///@return Decoded binary data ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JArray<_$jni.jbyte> getBinaryValue( - _$jni.JObject bv, + jni$_.JByteArray? getBinaryValue( + jni$_.JObject? bv, ) { + final _$bv = bv?.reference ?? jni$_.jNullReference; return _getBinaryValue(reference.pointer, - _id_getBinaryValue as _$jni.JMethodIDPtr, bv.reference.pointer) - .object(const _$jni.JArrayType(_$jni.jbyteType())); + _id_getBinaryValue as jni$_.JMethodIDPtr, _$bv.pointer) + .object(const jni$_.JByteArrayNullableType()); } static final _id_getBinaryValue$1 = _class.instanceMethodId( @@ -3319,16 +3445,16 @@ class JsonParser extends _$jni.JObject { r'()[B', ); - static final _getBinaryValue$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getBinaryValue$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public byte[] getBinaryValue()` @@ -3340,10 +3466,10 @@ class JsonParser extends _$jni.JObject { ///@return Decoded binary data ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - _$jni.JArray<_$jni.jbyte> getBinaryValue$1() { + jni$_.JByteArray? getBinaryValue$1() { return _getBinaryValue$1( - reference.pointer, _id_getBinaryValue$1 as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jbyteType())); + reference.pointer, _id_getBinaryValue$1 as jni$_.JMethodIDPtr) + .object(const jni$_.JByteArrayNullableType()); } static final _id_readBinaryValue = _class.instanceMethodId( @@ -3351,16 +3477,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/io/OutputStream;)I', ); - static final _readBinaryValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _readBinaryValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public int readBinaryValue(java.io.OutputStream out)` /// @@ -3376,10 +3502,11 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems ///@since 2.1 int readBinaryValue( - _$jni.JObject out, + jni$_.JObject? out, ) { + final _$out = out?.reference ?? jni$_.jNullReference; return _readBinaryValue(reference.pointer, - _id_readBinaryValue as _$jni.JMethodIDPtr, out.reference.pointer) + _id_readBinaryValue as jni$_.JMethodIDPtr, _$out.pointer) .integer; } @@ -3388,22 +3515,22 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/Base64Variant;Ljava/io/OutputStream;)I', ); - static final _readBinaryValue$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _readBinaryValue$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public int readBinaryValue(com.fasterxml.jackson.core.Base64Variant bv, java.io.OutputStream out)` /// @@ -3416,14 +3543,16 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems ///@since 2.1 int readBinaryValue$1( - _$jni.JObject bv, - _$jni.JObject out, + jni$_.JObject? bv, + jni$_.JObject? out, ) { + final _$bv = bv?.reference ?? jni$_.jNullReference; + final _$out = out?.reference ?? jni$_.jNullReference; return _readBinaryValue$1( reference.pointer, - _id_readBinaryValue$1 as _$jni.JMethodIDPtr, - bv.reference.pointer, - out.reference.pointer) + _id_readBinaryValue$1 as jni$_.JMethodIDPtr, + _$bv.pointer, + _$out.pointer) .integer; } @@ -3432,16 +3561,16 @@ class JsonParser extends _$jni.JObject { r'()I', ); - static final _getValueAsInt = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValueAsInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getValueAsInt()` @@ -3461,7 +3590,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getValueAsInt() { return _getValueAsInt( - reference.pointer, _id_getValueAsInt as _$jni.JMethodIDPtr) + reference.pointer, _id_getValueAsInt as jni$_.JMethodIDPtr) .integer; } @@ -3470,15 +3599,15 @@ class JsonParser extends _$jni.JObject { r'(I)I', ); - static final _getValueAsInt$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallIntMethod') + static final _getValueAsInt$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public int getValueAsInt(int def)` /// @@ -3499,7 +3628,7 @@ class JsonParser extends _$jni.JObject { int def, ) { return _getValueAsInt$1( - reference.pointer, _id_getValueAsInt$1 as _$jni.JMethodIDPtr, def) + reference.pointer, _id_getValueAsInt$1 as jni$_.JMethodIDPtr, def) .integer; } @@ -3508,16 +3637,16 @@ class JsonParser extends _$jni.JObject { r'()J', ); - static final _getValueAsLong = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValueAsLong = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public long getValueAsLong()` @@ -3537,7 +3666,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems int getValueAsLong() { return _getValueAsLong( - reference.pointer, _id_getValueAsLong as _$jni.JMethodIDPtr) + reference.pointer, _id_getValueAsLong as jni$_.JMethodIDPtr) .long; } @@ -3546,15 +3675,15 @@ class JsonParser extends _$jni.JObject { r'(J)J', ); - static final _getValueAsLong$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + static final _getValueAsLong$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public long getValueAsLong(long def)` /// @@ -3575,7 +3704,7 @@ class JsonParser extends _$jni.JObject { int def, ) { return _getValueAsLong$1( - reference.pointer, _id_getValueAsLong$1 as _$jni.JMethodIDPtr, def) + reference.pointer, _id_getValueAsLong$1 as jni$_.JMethodIDPtr, def) .long; } @@ -3584,16 +3713,16 @@ class JsonParser extends _$jni.JObject { r'()D', ); - static final _getValueAsDouble = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValueAsDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallDoubleMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public double getValueAsDouble()` @@ -3613,7 +3742,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems double getValueAsDouble() { return _getValueAsDouble( - reference.pointer, _id_getValueAsDouble as _$jni.JMethodIDPtr) + reference.pointer, _id_getValueAsDouble as jni$_.JMethodIDPtr) .doubleFloat; } @@ -3622,16 +3751,16 @@ class JsonParser extends _$jni.JObject { r'(D)D', ); - static final _getValueAsDouble$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Double,)>)>>('globalEnv_CallDoubleMethod') + static final _getValueAsDouble$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Double,)>)>>('globalEnv_CallDoubleMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); /// from: `public double getValueAsDouble(double def)` /// @@ -3652,7 +3781,7 @@ class JsonParser extends _$jni.JObject { double def, ) { return _getValueAsDouble$1(reference.pointer, - _id_getValueAsDouble$1 as _$jni.JMethodIDPtr, def) + _id_getValueAsDouble$1 as jni$_.JMethodIDPtr, def) .doubleFloat; } @@ -3661,16 +3790,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _getValueAsBoolean = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValueAsBoolean = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getValueAsBoolean()` @@ -3690,7 +3819,7 @@ class JsonParser extends _$jni.JObject { /// JsonParseException for decoding problems bool getValueAsBoolean() { return _getValueAsBoolean( - reference.pointer, _id_getValueAsBoolean as _$jni.JMethodIDPtr) + reference.pointer, _id_getValueAsBoolean as jni$_.JMethodIDPtr) .boolean; } @@ -3699,16 +3828,16 @@ class JsonParser extends _$jni.JObject { r'(Z)Z', ); - static final _getValueAsBoolean$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallBooleanMethod') + static final _getValueAsBoolean$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `public boolean getValueAsBoolean(boolean def)` /// @@ -3729,7 +3858,7 @@ class JsonParser extends _$jni.JObject { bool def, ) { return _getValueAsBoolean$1(reference.pointer, - _id_getValueAsBoolean$1 as _$jni.JMethodIDPtr, def ? 1 : 0) + _id_getValueAsBoolean$1 as jni$_.JMethodIDPtr, def ? 1 : 0) .boolean; } @@ -3738,16 +3867,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getValueAsString = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValueAsString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getValueAsString()` @@ -3764,10 +3893,10 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.1 - _$jni.JString getValueAsString() { + jni$_.JString? getValueAsString() { return _getValueAsString( - reference.pointer, _id_getValueAsString as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getValueAsString as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getValueAsString$1 = _class.instanceMethodId( @@ -3775,16 +3904,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/lang/String;)Ljava/lang/String;', ); - static final _getValueAsString$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getValueAsString$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public abstract java.lang.String getValueAsString(java.lang.String def)` /// The returned object must be released after use, by calling the [release] method. @@ -3801,12 +3930,13 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.1 - _$jni.JString getValueAsString$1( - _$jni.JString def, + jni$_.JString? getValueAsString$1( + jni$_.JString? def, ) { + final _$def = def?.reference ?? jni$_.jNullReference; return _getValueAsString$1(reference.pointer, - _id_getValueAsString$1 as _$jni.JMethodIDPtr, def.reference.pointer) - .object(const _$jni.JStringType()); + _id_getValueAsString$1 as jni$_.JMethodIDPtr, _$def.pointer) + .object(const jni$_.JStringNullableType()); } static final _id_canReadObjectId = _class.instanceMethodId( @@ -3814,16 +3944,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _canReadObjectId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _canReadObjectId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean canReadObjectId()` @@ -3841,7 +3971,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.3 bool canReadObjectId() { return _canReadObjectId( - reference.pointer, _id_canReadObjectId as _$jni.JMethodIDPtr) + reference.pointer, _id_canReadObjectId as jni$_.JMethodIDPtr) .boolean; } @@ -3850,16 +3980,16 @@ class JsonParser extends _$jni.JObject { r'()Z', ); - static final _canReadTypeId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _canReadTypeId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean canReadTypeId()` @@ -3877,7 +4007,7 @@ class JsonParser extends _$jni.JObject { ///@since 2.3 bool canReadTypeId() { return _canReadTypeId( - reference.pointer, _id_canReadTypeId as _$jni.JMethodIDPtr) + reference.pointer, _id_canReadTypeId as jni$_.JMethodIDPtr) .boolean; } @@ -3886,16 +4016,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _getObjectId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getObjectId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object getObjectId()` @@ -3914,10 +4044,10 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.3 - _$jni.JObject getObjectId() { + jni$_.JObject? getObjectId() { return _getObjectId( - reference.pointer, _id_getObjectId as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_getObjectId as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_getTypeId = _class.instanceMethodId( @@ -3925,16 +4055,16 @@ class JsonParser extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _getTypeId = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getTypeId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object getTypeId()` @@ -3953,9 +4083,9 @@ class JsonParser extends _$jni.JObject { ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.3 - _$jni.JObject getTypeId() { - return _getTypeId(reference.pointer, _id_getTypeId as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? getTypeId() { + return _getTypeId(reference.pointer, _id_getTypeId as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_readValueAs = _class.instanceMethodId( @@ -3963,16 +4093,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/lang/Class;)Ljava/lang/Object;', ); - static final _readValueAs = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _readValueAs = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public T readValueAs(java.lang.Class valueType)` /// The returned object must be released after use, by calling the [release] method. @@ -4002,13 +4132,14 @@ class JsonParser extends _$jni.JObject { ///@return Java value read from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - $T readValueAs<$T extends _$jni.JObject>( - _$jni.JObject valueType, { - required _$jni.JObjType<$T> T, + $T? readValueAs<$T extends jni$_.JObject?>( + jni$_.JObject? valueType, { + required jni$_.JObjType<$T> T, }) { + final _$valueType = valueType?.reference ?? jni$_.jNullReference; return _readValueAs(reference.pointer, - _id_readValueAs as _$jni.JMethodIDPtr, valueType.reference.pointer) - .object(T); + _id_readValueAs as jni$_.JMethodIDPtr, _$valueType.pointer) + .object<$T?>(T.nullableType); } static final _id_readValueAs$1 = _class.instanceMethodId( @@ -4016,16 +4147,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/type/TypeReference;)Ljava/lang/Object;', ); - static final _readValueAs$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _readValueAs$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public T readValueAs(com.fasterxml.jackson.core.type.TypeReference valueTypeRef)` /// The returned object must be released after use, by calling the [release] method. @@ -4052,15 +4183,14 @@ class JsonParser extends _$jni.JObject { ///@return Java value read from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - $T readValueAs$1<$T extends _$jni.JObject>( - _$jni.JObject valueTypeRef, { - required _$jni.JObjType<$T> T, + $T? readValueAs$1<$T extends jni$_.JObject?>( + jni$_.JObject? valueTypeRef, { + required jni$_.JObjType<$T> T, }) { - return _readValueAs$1( - reference.pointer, - _id_readValueAs$1 as _$jni.JMethodIDPtr, - valueTypeRef.reference.pointer) - .object(T); + final _$valueTypeRef = valueTypeRef?.reference ?? jni$_.jNullReference; + return _readValueAs$1(reference.pointer, + _id_readValueAs$1 as jni$_.JMethodIDPtr, _$valueTypeRef.pointer) + .object<$T?>(T.nullableType); } static final _id_readValuesAs = _class.instanceMethodId( @@ -4068,16 +4198,16 @@ class JsonParser extends _$jni.JObject { r'(Ljava/lang/Class;)Ljava/util/Iterator;', ); - static final _readValuesAs = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _readValuesAs = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.util.Iterator readValuesAs(java.lang.Class valueType)` /// The returned object must be released after use, by calling the [release] method. @@ -4090,13 +4220,15 @@ class JsonParser extends _$jni.JObject { ///@return Iterator for reading multiple Java values from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - _$jni.JIterator<$T> readValuesAs<$T extends _$jni.JObject>( - _$jni.JObject valueType, { - required _$jni.JObjType<$T> T, + jni$_.JIterator<$T?>? readValuesAs<$T extends jni$_.JObject?>( + jni$_.JObject? valueType, { + required jni$_.JObjType<$T> T, }) { + final _$valueType = valueType?.reference ?? jni$_.jNullReference; return _readValuesAs(reference.pointer, - _id_readValuesAs as _$jni.JMethodIDPtr, valueType.reference.pointer) - .object(_$jni.JIteratorType(T)); + _id_readValuesAs as jni$_.JMethodIDPtr, _$valueType.pointer) + .object?>( + jni$_.JIteratorNullableType<$T?>(T.nullableType)); } static final _id_readValuesAs$1 = _class.instanceMethodId( @@ -4104,16 +4236,16 @@ class JsonParser extends _$jni.JObject { r'(Lcom/fasterxml/jackson/core/type/TypeReference;)Ljava/util/Iterator;', ); - static final _readValuesAs$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _readValuesAs$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.util.Iterator readValuesAs(com.fasterxml.jackson.core.type.TypeReference valueTypeRef)` /// The returned object must be released after use, by calling the [release] method. @@ -4126,15 +4258,15 @@ class JsonParser extends _$jni.JObject { ///@return Iterator for reading multiple Java values from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - _$jni.JIterator<$T> readValuesAs$1<$T extends _$jni.JObject>( - _$jni.JObject valueTypeRef, { - required _$jni.JObjType<$T> T, + jni$_.JIterator<$T?>? readValuesAs$1<$T extends jni$_.JObject?>( + jni$_.JObject? valueTypeRef, { + required jni$_.JObjType<$T> T, }) { - return _readValuesAs$1( - reference.pointer, - _id_readValuesAs$1 as _$jni.JMethodIDPtr, - valueTypeRef.reference.pointer) - .object(_$jni.JIteratorType(T)); + final _$valueTypeRef = valueTypeRef?.reference ?? jni$_.jNullReference; + return _readValuesAs$1(reference.pointer, + _id_readValuesAs$1 as jni$_.JMethodIDPtr, _$valueTypeRef.pointer) + .object?>( + jni$_.JIteratorNullableType<$T?>(T.nullableType)); } static final _id_readValueAsTree = _class.instanceMethodId( @@ -4142,16 +4274,16 @@ class JsonParser extends _$jni.JObject { r'()Lcom/fasterxml/jackson/core/TreeNode;', ); - static final _readValueAsTree = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _readValueAsTree = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public T readValueAsTree()` @@ -4166,40 +4298,83 @@ class JsonParser extends _$jni.JObject { ///@return root of the document, or null if empty or whitespace. ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - $T readValueAsTree<$T extends _$jni.JObject>({ - required _$jni.JObjType<$T> T, + $T? readValueAsTree<$T extends jni$_.JObject?>({ + required jni$_.JObjType<$T> T, }) { return _readValueAsTree( - reference.pointer, _id_readValueAsTree as _$jni.JMethodIDPtr) - .object(T); + reference.pointer, _id_readValueAsTree as jni$_.JMethodIDPtr) + .object<$T?>(T.nullableType); } } -final class $JsonParser$Type extends _$jni.JObjType { - @_$jni.internal - const $JsonParser$Type(); +final class $JsonParser$NullableType extends jni$_.JObjType { + @jni$_.internal + const $JsonParser$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/fasterxml/jackson/core/JsonParser;'; - @_$jni.internal - @_$core.override - JsonParser fromReference(_$jni.JReference reference) => - JsonParser.fromReference(reference); + @jni$_.internal + @core$_.override + JsonParser? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : JsonParser.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonParser$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonParser$NullableType) && + other is $JsonParser$NullableType; + } +} + +final class $JsonParser$Type extends jni$_.JObjType { + @jni$_.internal + const $JsonParser$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/fasterxml/jackson/core/JsonParser;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + JsonParser fromReference(jni$_.JReference reference) => + JsonParser.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonParser$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($JsonParser$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($JsonParser$Type) && other is $JsonParser$Type; } diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart index 9a62b8eb7..45e61549d 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart @@ -37,6 +37,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -46,53 +47,56 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `com.fasterxml.jackson.core.JsonToken` /// /// Enumeration for basic token types used for returning results /// of parsing JSON content. -class JsonToken extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class JsonToken extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal JsonToken.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/fasterxml/jackson/core/JsonToken'); + jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonToken'); /// The type which includes information such as the signature of this class. + static const nullableType = $JsonToken$NullableType(); static const type = $JsonToken$Type(); static final _id_values = _class.staticMethodId( r'values', r'()[Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.fasterxml.jackson.core.JsonToken[] values()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($JsonToken$Type())); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $JsonToken$NullableType())); } static final _id_valueOf = _class.staticMethodId( @@ -100,25 +104,26 @@ class JsonToken extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonToken;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public com.fasterxml.jackson.core.JsonToken valueOf(java.lang.String name)` /// The returned object must be released after use, by calling the [release] method. - static JsonToken valueOf( - _$jni.JString name, + static JsonToken? valueOf( + jni$_.JString? name, ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - name.reference.pointer) - .object(const $JsonToken$Type()); + final _$name = name?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$name.pointer) + .object(const $JsonToken$NullableType()); } static final _id_id = _class.instanceMethodId( @@ -126,21 +131,21 @@ class JsonToken extends _$jni.JObject { r'()I', ); - static final _id = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _id = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final int id()` int id() { - return _id(reference.pointer, _id_id as _$jni.JMethodIDPtr).integer; + return _id(reference.pointer, _id_id as jni$_.JMethodIDPtr).integer; } static final _id_asString = _class.instanceMethodId( @@ -148,23 +153,23 @@ class JsonToken extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _asString = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _asString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final java.lang.String asString()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString asString() { - return _asString(reference.pointer, _id_asString as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString? asString() { + return _asString(reference.pointer, _id_asString as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_asCharArray = _class.instanceMethodId( @@ -172,24 +177,24 @@ class JsonToken extends _$jni.JObject { r'()[C', ); - static final _asCharArray = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _asCharArray = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final char[] asCharArray()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<_$jni.jchar> asCharArray() { + jni$_.JCharArray? asCharArray() { return _asCharArray( - reference.pointer, _id_asCharArray as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jcharType())); + reference.pointer, _id_asCharArray as jni$_.JMethodIDPtr) + .object(const jni$_.JCharArrayNullableType()); } static final _id_asByteArray = _class.instanceMethodId( @@ -197,24 +202,24 @@ class JsonToken extends _$jni.JObject { r'()[B', ); - static final _asByteArray = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _asByteArray = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final byte[] asByteArray()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<_$jni.jbyte> asByteArray() { + jni$_.JByteArray? asByteArray() { return _asByteArray( - reference.pointer, _id_asByteArray as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jbyteType())); + reference.pointer, _id_asByteArray as jni$_.JMethodIDPtr) + .object(const jni$_.JByteArrayNullableType()); } static final _id_isNumeric = _class.instanceMethodId( @@ -222,16 +227,16 @@ class JsonToken extends _$jni.JObject { r'()Z', ); - static final _isNumeric = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isNumeric = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final boolean isNumeric()` @@ -239,7 +244,7 @@ class JsonToken extends _$jni.JObject { /// @return {@code True} if this token is {@code VALUE_NUMBER_INT} or {@code VALUE_NUMBER_FLOAT}, /// {@code false} otherwise bool isNumeric() { - return _isNumeric(reference.pointer, _id_isNumeric as _$jni.JMethodIDPtr) + return _isNumeric(reference.pointer, _id_isNumeric as jni$_.JMethodIDPtr) .boolean; } @@ -248,16 +253,16 @@ class JsonToken extends _$jni.JObject { r'()Z', ); - static final _isStructStart = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isStructStart = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final boolean isStructStart()` @@ -271,7 +276,7 @@ class JsonToken extends _$jni.JObject { ///@since 2.3 bool isStructStart() { return _isStructStart( - reference.pointer, _id_isStructStart as _$jni.JMethodIDPtr) + reference.pointer, _id_isStructStart as jni$_.JMethodIDPtr) .boolean; } @@ -280,16 +285,16 @@ class JsonToken extends _$jni.JObject { r'()Z', ); - static final _isStructEnd = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isStructEnd = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final boolean isStructEnd()` @@ -303,7 +308,7 @@ class JsonToken extends _$jni.JObject { ///@since 2.3 bool isStructEnd() { return _isStructEnd( - reference.pointer, _id_isStructEnd as _$jni.JMethodIDPtr) + reference.pointer, _id_isStructEnd as jni$_.JMethodIDPtr) .boolean; } @@ -312,16 +317,16 @@ class JsonToken extends _$jni.JObject { r'()Z', ); - static final _isScalarValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isScalarValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final boolean isScalarValue()` @@ -334,7 +339,7 @@ class JsonToken extends _$jni.JObject { /// {@code VALUE_xxx} tokens), {@code false} otherwise bool isScalarValue() { return _isScalarValue( - reference.pointer, _id_isScalarValue as _$jni.JMethodIDPtr) + reference.pointer, _id_isScalarValue as jni$_.JMethodIDPtr) .boolean; } @@ -343,16 +348,16 @@ class JsonToken extends _$jni.JObject { r'()Z', ); - static final _isBoolean = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _isBoolean = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final boolean isBoolean()` @@ -360,36 +365,79 @@ class JsonToken extends _$jni.JObject { /// @return {@code True} if this token is {@code VALUE_TRUE} or {@code VALUE_FALSE}, /// {@code false} otherwise bool isBoolean() { - return _isBoolean(reference.pointer, _id_isBoolean as _$jni.JMethodIDPtr) + return _isBoolean(reference.pointer, _id_isBoolean as jni$_.JMethodIDPtr) .boolean; } } -final class $JsonToken$Type extends _$jni.JObjType { - @_$jni.internal - const $JsonToken$Type(); +final class $JsonToken$NullableType extends jni$_.JObjType { + @jni$_.internal + const $JsonToken$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/fasterxml/jackson/core/JsonToken;'; - @_$jni.internal - @_$core.override - JsonToken fromReference(_$jni.JReference reference) => - JsonToken.fromReference(reference); + @jni$_.internal + @core$_.override + JsonToken? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : JsonToken.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonToken$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonToken$NullableType) && + other is $JsonToken$NullableType; + } +} + +final class $JsonToken$Type extends jni$_.JObjType { + @jni$_.internal + const $JsonToken$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/fasterxml/jackson/core/JsonToken;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + JsonToken fromReference(jni$_.JReference reference) => + JsonToken.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonToken$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($JsonToken$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($JsonToken$Type) && other is $JsonToken$Type; } diff --git a/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart b/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart index 9209bad65..6b1ab86c6 100644 --- a/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart +++ b/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart @@ -24,6 +24,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -33,35 +34,43 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `com.github.dart_lang.jnigen.Measure` -class Measure<$T extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class Measure<$T extends jni$_.JObject> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal Measure.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), + jni$_.JReference reference, + ) : $type = type<$T>(T), super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/Measure'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Measure'); /// The type which includes information such as the signature of this class. - static $Measure$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $Measure$NullableType<$T> nullableType<$T extends jni$_.JObject>( + jni$_.JObjType<$T> T, ) { - return $Measure$Type( + return $Measure$NullableType<$T>( + T, + ); + } + + static $Measure$Type<$T> type<$T extends jni$_.JObject>( + jni$_.JObjType<$T> T, + ) { + return $Measure$Type<$T>( T, ); } @@ -71,21 +80,21 @@ class Measure<$T extends _$jni.JObject> extends _$jni.JObject { r'()F', ); - static final _getValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getValue()` double getValue() { - return _getValue(reference.pointer, _id_getValue as _$jni.JMethodIDPtr) + return _getValue(reference.pointer, _id_getValue as jni$_.JMethodIDPtr) .float; } @@ -94,23 +103,23 @@ class Measure<$T extends _$jni.JObject> extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/MeasureUnit;', ); - static final _getUnit = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getUnit = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public T getUnit()` /// The returned object must be released after use, by calling the [release] method. $T getUnit() { - return _getUnit(reference.pointer, _id_getUnit as _$jni.JMethodIDPtr) - .object(T); + return _getUnit(reference.pointer, _id_getUnit as jni$_.JMethodIDPtr) + .object<$T>(T); } static final _id_convertValue = _class.instanceMethodId( @@ -118,60 +127,110 @@ class Measure<$T extends _$jni.JObject> extends _$jni.JObject { r'(Lcom/github/dart_lang/jnigen/MeasureUnit;)F', ); - static final _convertValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _convertValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final float convertValue(T measureUnit)` double convertValue( $T measureUnit, ) { - return _convertValue( - reference.pointer, - _id_convertValue as _$jni.JMethodIDPtr, - measureUnit.reference.pointer) + final _$measureUnit = measureUnit.reference; + return _convertValue(reference.pointer, + _id_convertValue as jni$_.JMethodIDPtr, _$measureUnit.pointer) .float; } } -final class $Measure$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $Measure$NullableType<$T extends jni$_.JObject> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $Measure$Type( + @jni$_.internal + const $Measure$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/Measure;'; - @_$jni.internal - @_$core.override - Measure<$T> fromReference(_$jni.JReference reference) => - Measure.fromReference(T, reference); + @jni$_.internal + @core$_.override + Measure<$T>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Measure<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Measure$NullableType, T); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Measure$NullableType<$T>) && + other is $Measure$NullableType<$T> && + T == other.T; + } +} - @_$jni.internal - @_$core.override +final class $Measure$Type<$T extends jni$_.JObject> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + const $Measure$Type( + this.T, + ); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/Measure;'; + + @jni$_.internal + @core$_.override + Measure<$T> fromReference(jni$_.JReference reference) => + Measure<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => $Measure$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($Measure$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Measure$Type<$T>) && other is $Measure$Type<$T> && @@ -180,44 +239,45 @@ final class $Measure$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.MeasureUnit` -class MeasureUnit extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class MeasureUnit extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal MeasureUnit.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/MeasureUnit'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/MeasureUnit'); /// The type which includes information such as the signature of this class. + static const nullableType = $MeasureUnit$NullableType(); static const type = $MeasureUnit$Type(); static final _id_getSign = _class.instanceMethodId( r'getSign', r'()Ljava/lang/String;', ); - static final _getSign = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSign = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract java.lang.String getSign()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getSign() { - return _getSign(reference.pointer, _id_getSign as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString getSign() { + return _getSign(reference.pointer, _id_getSign as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); } static final _id_getCoefficient = _class.instanceMethodId( @@ -225,35 +285,35 @@ class MeasureUnit extends _$jni.JObject { r'()F', ); - static final _getCoefficient = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCoefficient = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract float getCoefficient()` double getCoefficient() { return _getCoefficient( - reference.pointer, _id_getCoefficient as _$jni.JMethodIDPtr) + reference.pointer, _id_getCoefficient as jni$_.JMethodIDPtr) .float; } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -261,50 +321,51 @@ class MeasureUnit extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'getSign()Ljava/lang/String;') { final $r = _$impls[$p]!.getSign(); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'getCoefficient()F') { final $r = _$impls[$p]!.getCoefficient(); - return _$jni.JFloat($r).reference.toPointer(); + return jni$_.JFloat($r).reference.toPointer(); } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, + jni$_.JImplementer implementer, $MeasureUnit $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'com.github.dart_lang.jnigen.MeasureUnit', @@ -319,7 +380,7 @@ class MeasureUnit extends _$jni.JObject { factory MeasureUnit.implement( $MeasureUnit $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); return MeasureUnit.fromReference( $i.implementReference(), @@ -329,25 +390,25 @@ class MeasureUnit extends _$jni.JObject { abstract base mixin class $MeasureUnit { factory $MeasureUnit({ - required _$jni.JString Function() getSign, + required jni$_.JString Function() getSign, required double Function() getCoefficient, }) = _$MeasureUnit; - _$jni.JString getSign(); + jni$_.JString getSign(); double getCoefficient(); } final class _$MeasureUnit with $MeasureUnit { _$MeasureUnit({ - required _$jni.JString Function() getSign, + required jni$_.JString Function() getSign, required double Function() getCoefficient, }) : _getSign = getSign, _getCoefficient = getCoefficient; - final _$jni.JString Function() _getSign; + final jni$_.JString Function() _getSign; final double Function() _getCoefficient; - _$jni.JString getSign() { + jni$_.JString getSign() { return _getSign(); } @@ -356,71 +417,1190 @@ final class _$MeasureUnit with $MeasureUnit { } } -final class $MeasureUnit$Type extends _$jni.JObjType { - @_$jni.internal - const $MeasureUnit$Type(); +final class $MeasureUnit$NullableType extends jni$_.JObjType { + @jni$_.internal + const $MeasureUnit$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/MeasureUnit;'; - @_$jni.internal - @_$core.override - MeasureUnit fromReference(_$jni.JReference reference) => - MeasureUnit.fromReference(reference); + @jni$_.internal + @core$_.override + MeasureUnit? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : MeasureUnit.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($MeasureUnit$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MeasureUnit$NullableType) && + other is $MeasureUnit$NullableType; + } +} + +final class $MeasureUnit$Type extends jni$_.JObjType { + @jni$_.internal + const $MeasureUnit$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/MeasureUnit;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MeasureUnit fromReference(jni$_.JReference reference) => + MeasureUnit.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $MeasureUnit$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($MeasureUnit$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MeasureUnit$Type) && other is $MeasureUnit$Type; } } +/// from: `com.github.dart_lang.jnigen.Nullability$InnerClass` +class Nullability$InnerClass<$T extends jni$_.JObject?, + $U extends jni$_.JObject, $V extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; + + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + Nullability$InnerClass.fromReference( + this.T, + this.U, + this.V, + jni$_.JReference reference, + ) : $type = type<$T, $U, $V>(T, U, V), + super.fromReference(reference); + + static final _class = jni$_.JClass.forName( + r'com/github/dart_lang/jnigen/Nullability$InnerClass'); + + /// The type which includes information such as the signature of this class. + static $Nullability$InnerClass$NullableType<$T, $U, $V> nullableType< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $V extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + jni$_.JObjType<$V> V, + ) { + return $Nullability$InnerClass$NullableType<$T, $U, $V>( + T, + U, + V, + ); + } + + static $Nullability$InnerClass$Type<$T, $U, $V> type< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $V extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + jni$_.JObjType<$V> V, + ) { + return $Nullability$InnerClass$Type<$T, $U, $V>( + T, + U, + V, + ); + } + + static final _id_new$ = _class.constructorId( + r'(Lcom/github/dart_lang/jnigen/Nullability;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void (com.github.dart_lang.jnigen.Nullability $outerClass)` + /// The returned object must be released after use, by calling the [release] method. + factory Nullability$InnerClass( + Nullability<$T?, $U> $outerClass, { + jni$_.JObjType<$T>? T, + jni$_.JObjType<$U>? U, + required jni$_.JObjType<$V> V, + }) { + T ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $Nullability$Type) + .T, + ]) as jni$_.JObjType<$T>; + U ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $Nullability$Type) + .U, + ]) as jni$_.JObjType<$U>; + final _$$outerClass = $outerClass.reference; + return Nullability$InnerClass<$T, $U, $V>.fromReference( + T, + U, + V, + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$$outerClass.pointer) + .reference); + } + + static final _id_f = _class.instanceMethodId( + r'f', + r'(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V', + ); + + static final _f = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final void f(T object, U object1, V object2)` + void f( + $T object, + $U object1, + $V object2, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1.reference; + final _$object2 = object2?.reference ?? jni$_.jNullReference; + _f(reference.pointer, _id_f as jni$_.JMethodIDPtr, _$object.pointer, + _$object1.pointer, _$object2.pointer) + .check(); + } +} + +final class $Nullability$InnerClass$NullableType<$T extends jni$_.JObject?, + $U extends jni$_.JObject, $V extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $Nullability$InnerClass$NullableType( + this.T, + this.U, + this.V, + ); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/Nullability$InnerClass;'; + + @jni$_.internal + @core$_.override + Nullability$InnerClass<$T, $U, $V>? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : Nullability$InnerClass<$T, $U, $V>.fromReference( + T, + U, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => + Object.hash($Nullability$InnerClass$NullableType, T, U, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($Nullability$InnerClass$NullableType<$T, $U, $V>) && + other is $Nullability$InnerClass$NullableType<$T, $U, $V> && + T == other.T && + U == other.U && + V == other.V; + } +} + +final class $Nullability$InnerClass$Type<$T extends jni$_.JObject?, + $U extends jni$_.JObject, $V extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $Nullability$InnerClass$Type( + this.T, + this.U, + this.V, + ); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/Nullability$InnerClass;'; + + @jni$_.internal + @core$_.override + Nullability$InnerClass<$T, $U, $V> fromReference( + jni$_.JReference reference) => + Nullability$InnerClass<$T, $U, $V>.fromReference( + T, + U, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $Nullability$InnerClass$NullableType<$T, $U, $V>(T, U, V); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Nullability$InnerClass$Type, T, U, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Nullability$InnerClass$Type<$T, $U, $V>) && + other is $Nullability$InnerClass$Type<$T, $U, $V> && + T == other.T && + U == other.U && + V == other.V; + } +} + +/// from: `com.github.dart_lang.jnigen.Nullability` +class Nullability<$T extends jni$_.JObject?, $U extends jni$_.JObject> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; + + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + Nullability.fromReference( + this.T, + this.U, + jni$_.JReference reference, + ) : $type = type<$T, $U>(T, U), + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Nullability'); + + /// The type which includes information such as the signature of this class. + static $Nullability$NullableType<$T, $U> + nullableType<$T extends jni$_.JObject?, $U extends jni$_.JObject>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + ) { + return $Nullability$NullableType<$T, $U>( + T, + U, + ); + } + + static $Nullability$Type<$T, $U> + type<$T extends jni$_.JObject?, $U extends jni$_.JObject>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + ) { + return $Nullability$Type<$T, $U>( + T, + U, + ); + } + + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (T object, U object1, U object2)` + /// The returned object must be released after use, by calling the [release] method. + factory Nullability( + $T object, + $U object1, + $U? object2, { + required jni$_.JObjType<$T> T, + jni$_.JObjType<$U>? U, + }) { + U ??= jni$_.lowestCommonSuperType([ + object1.$type, + ]) as jni$_.JObjType<$U>; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1.reference; + final _$object2 = object2?.reference ?? jni$_.jNullReference; + return Nullability<$T, $U>.fromReference( + T, + U, + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer, _$object2.pointer) + .reference); + } + + static final _id_getT = _class.instanceMethodId( + r'getT', + r'()Ljava/lang/Object;', + ); + + static final _getT = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final T getT()` + /// The returned object must be released after use, by calling the [release] method. + $T getT() { + return _getT(reference.pointer, _id_getT as jni$_.JMethodIDPtr) + .object<$T>(T); + } + + static final _id_getU = _class.instanceMethodId( + r'getU', + r'()Ljava/lang/Object;', + ); + + static final _getU = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final U getU()` + /// The returned object must be released after use, by calling the [release] method. + $U getU() { + return _getU(reference.pointer, _id_getU as jni$_.JMethodIDPtr) + .object<$U>(U); + } + + static final _id_getNullableU = _class.instanceMethodId( + r'getNullableU', + r'()Ljava/lang/Object;', + ); + + static final _getNullableU = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final U getNullableU()` + /// The returned object must be released after use, by calling the [release] method. + $U? getNullableU() { + return _getNullableU( + reference.pointer, _id_getNullableU as jni$_.JMethodIDPtr) + .object<$U?>(U.nullableType); + } + + static final _id_setNullableU = _class.instanceMethodId( + r'setNullableU', + r'(Ljava/lang/Object;)V', + ); + + static final _setNullableU = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final void setNullableU(U object)` + void setNullableU( + $U? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + _setNullableU(reference.pointer, _id_setNullableU as jni$_.JMethodIDPtr, + _$object.pointer) + .check(); + } + + static final _id_hello = _class.instanceMethodId( + r'hello', + r'()Ljava/lang/String;', + ); + + static final _hello = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String hello()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString hello() { + return _hello(reference.pointer, _id_hello as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); + } + + static final _id_nullableHello = _class.instanceMethodId( + r'nullableHello', + r'(Z)Ljava/lang/String;', + ); + + static final _nullableHello = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public final java.lang.String nullableHello(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? nullableHello( + bool z, + ) { + return _nullableHello(reference.pointer, + _id_nullableHello as jni$_.JMethodIDPtr, z ? 1 : 0) + .object(const jni$_.JStringNullableType()); + } + + static final _id_methodGenericEcho = _class.instanceMethodId( + r'methodGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _methodGenericEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final V methodGenericEcho(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericEcho<$V extends jni$_.JObject>( + $V object, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + object.$type, + ]) as jni$_.JObjType<$V>; + final _$object = object.reference; + return _methodGenericEcho(reference.pointer, + _id_methodGenericEcho as jni$_.JMethodIDPtr, _$object.pointer) + .object<$V>(V); + } + + static final _id_methodGenericNullableEcho = _class.instanceMethodId( + r'methodGenericNullableEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _methodGenericNullableEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final V methodGenericNullableEcho(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericNullableEcho<$V extends jni$_.JObject?>( + $V object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _methodGenericNullableEcho( + reference.pointer, + _id_methodGenericNullableEcho as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$V>(V); + } + + static final _id_classGenericEcho = _class.instanceMethodId( + r'classGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _classGenericEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final U classGenericEcho(U object)` + /// The returned object must be released after use, by calling the [release] method. + $U classGenericEcho( + $U object, + ) { + final _$object = object.reference; + return _classGenericEcho(reference.pointer, + _id_classGenericEcho as jni$_.JMethodIDPtr, _$object.pointer) + .object<$U>(U); + } + + static final _id_classGenericNullableEcho = _class.instanceMethodId( + r'classGenericNullableEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _classGenericNullableEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final T classGenericNullableEcho(T object)` + /// The returned object must be released after use, by calling the [release] method. + $T classGenericNullableEcho( + $T object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _classGenericNullableEcho( + reference.pointer, + _id_classGenericNullableEcho as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$T>(T); + } + + static final _id_firstOf = _class.instanceMethodId( + r'firstOf', + r'(Ljava/util/List;)Ljava/lang/String;', + ); + + static final _firstOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.lang.String firstOf(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString firstOf( + jni$_.JList list, + ) { + final _$list = list.reference; + return _firstOf(reference.pointer, _id_firstOf as jni$_.JMethodIDPtr, + _$list.pointer) + .object(const jni$_.JStringType()); + } + + static final _id_firstOfNullable = _class.instanceMethodId( + r'firstOfNullable', + r'(Ljava/util/List;)Ljava/lang/String;', + ); + + static final _firstOfNullable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.lang.String firstOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? firstOfNullable( + jni$_.JList list, + ) { + final _$list = list.reference; + return _firstOfNullable(reference.pointer, + _id_firstOfNullable as jni$_.JMethodIDPtr, _$list.pointer) + .object(const jni$_.JStringNullableType()); + } + + static final _id_classGenericFirstOf = _class.instanceMethodId( + r'classGenericFirstOf', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _classGenericFirstOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final U classGenericFirstOf(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $U classGenericFirstOf( + jni$_.JList<$U> list, + ) { + final _$list = list.reference; + return _classGenericFirstOf(reference.pointer, + _id_classGenericFirstOf as jni$_.JMethodIDPtr, _$list.pointer) + .object<$U>(U); + } + + static final _id_classGenericFirstOfNullable = _class.instanceMethodId( + r'classGenericFirstOfNullable', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _classGenericFirstOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final T classGenericFirstOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $T classGenericFirstOfNullable( + jni$_.JList<$T> list, + ) { + final _$list = list.reference; + return _classGenericFirstOfNullable( + reference.pointer, + _id_classGenericFirstOfNullable as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$T>(T); + } + + static final _id_methodGenericFirstOf = _class.instanceMethodId( + r'methodGenericFirstOf', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _methodGenericFirstOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final V methodGenericFirstOf(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericFirstOf<$V extends jni$_.JObject>( + jni$_.JList<$V> list, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (list.$type as jni$_.JListType).E, + ]) as jni$_.JObjType<$V>; + final _$list = list.reference; + return _methodGenericFirstOf(reference.pointer, + _id_methodGenericFirstOf as jni$_.JMethodIDPtr, _$list.pointer) + .object<$V>(V); + } + + static final _id_methodGenericFirstOfNullable = _class.instanceMethodId( + r'methodGenericFirstOfNullable', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _methodGenericFirstOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final V methodGenericFirstOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericFirstOfNullable<$V extends jni$_.JObject?>( + jni$_.JList<$V> list, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (list.$type as jni$_.JListType).E, + ]) as jni$_.JObjType<$V>; + final _$list = list.reference; + return _methodGenericFirstOfNullable( + reference.pointer, + _id_methodGenericFirstOfNullable as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$V>(V); + } + + static final _id_stringListOf = _class.instanceMethodId( + r'stringListOf', + r'(Ljava/lang/String;)Ljava/util/List;', + ); + + static final _stringListOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.util.List stringListOf(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList stringListOf( + jni$_.JString string, + ) { + final _$string = string.reference; + return _stringListOf(reference.pointer, + _id_stringListOf as jni$_.JMethodIDPtr, _$string.pointer) + .object>( + const jni$_.JListType(jni$_.JStringType())); + } + + static final _id_nullableListOf = _class.instanceMethodId( + r'nullableListOf', + r'(Ljava/lang/String;)Ljava/util/List;', + ); + + static final _nullableListOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.util.List nullableListOf(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList nullableListOf( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _nullableListOf(reference.pointer, + _id_nullableListOf as jni$_.JMethodIDPtr, _$string.pointer) + .object>( + const jni$_.JListType(jni$_.JStringNullableType())); + } + + static final _id_classGenericListOf = _class.instanceMethodId( + r'classGenericListOf', + r'(Ljava/lang/Object;)Ljava/util/List;', + ); + + static final _classGenericListOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.util.List classGenericListOf(U object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$U> classGenericListOf( + $U object, + ) { + final _$object = object.reference; + return _classGenericListOf(reference.pointer, + _id_classGenericListOf as jni$_.JMethodIDPtr, _$object.pointer) + .object>(jni$_.JListType<$U>(U)); + } + + static final _id_classGenericNullableListOf = _class.instanceMethodId( + r'classGenericNullableListOf', + r'(Ljava/lang/Object;)Ljava/util/List;', + ); + + static final _classGenericNullableListOf = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.util.List classGenericNullableListOf(T object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$T> classGenericNullableListOf( + $T object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _classGenericNullableListOf( + reference.pointer, + _id_classGenericNullableListOf as jni$_.JMethodIDPtr, + _$object.pointer) + .object>(jni$_.JListType<$T>(T)); + } + + static final _id_methodGenericListOf = _class.instanceMethodId( + r'methodGenericListOf', + r'(Ljava/lang/Object;)Ljava/util/List;', + ); + + static final _methodGenericListOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.util.List methodGenericListOf(V object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$V> methodGenericListOf<$V extends jni$_.JObject>( + $V object, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + object.$type, + ]) as jni$_.JObjType<$V>; + final _$object = object.reference; + return _methodGenericListOf(reference.pointer, + _id_methodGenericListOf as jni$_.JMethodIDPtr, _$object.pointer) + .object>(jni$_.JListType<$V>(V)); + } + + static final _id_methodGenericNullableListOf = _class.instanceMethodId( + r'methodGenericNullableListOf', + r'(Ljava/lang/Object;)Ljava/util/List;', + ); + + static final _methodGenericNullableListOf = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final java.util.List methodGenericNullableListOf(V object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$V> methodGenericNullableListOf<$V extends jni$_.JObject?>( + $V object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _methodGenericNullableListOf( + reference.pointer, + _id_methodGenericNullableListOf as jni$_.JMethodIDPtr, + _$object.pointer) + .object>(jni$_.JListType<$V>(V)); + } +} + +final class $Nullability$NullableType<$T extends jni$_.JObject?, + $U extends jni$_.JObject> extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + const $Nullability$NullableType( + this.T, + this.U, + ); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/Nullability;'; + + @jni$_.internal + @core$_.override + Nullability<$T, $U>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Nullability<$T, $U>.fromReference( + T, + U, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Nullability$NullableType, T, U); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Nullability$NullableType<$T, $U>) && + other is $Nullability$NullableType<$T, $U> && + T == other.T && + U == other.U; + } +} + +final class $Nullability$Type<$T extends jni$_.JObject?, + $U extends jni$_.JObject> extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + const $Nullability$Type( + this.T, + this.U, + ); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/Nullability;'; + + @jni$_.internal + @core$_.override + Nullability<$T, $U> fromReference(jni$_.JReference reference) => + Nullability<$T, $U>.fromReference( + T, + U, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $Nullability$NullableType<$T, $U>(T, U); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Nullability$Type, T, U); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Nullability$Type<$T, $U>) && + other is $Nullability$Type<$T, $U> && + T == other.T && + U == other.U; + } +} + /// from: `com.github.dart_lang.jnigen.Speed` class Speed extends Measure { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Speed.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(const $SpeedUnit$Type(), reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/Speed'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Speed'); /// The type which includes information such as the signature of this class. + static const nullableType = $Speed$NullableType(); static const type = $Speed$Type(); static final _id_new$ = _class.constructorId( r'(FLcom/github/dart_lang/jnigen/SpeedUnit;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Double, - _$jni.Pointer<_$jni.Void> + jni$_.Double, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, double, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, double, jni$_.Pointer)>(); /// from: `public void (float f, com.github.dart_lang.jnigen.SpeedUnit speedUnit)` /// The returned object must be released after use, by calling the [release] method. @@ -428,8 +1608,9 @@ class Speed extends Measure { double f, SpeedUnit speedUnit, ) { + final _$speedUnit = speedUnit.reference; return Speed.fromReference(_new$(_class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, f, speedUnit.reference.pointer) + _id_new$ as jni$_.JMethodIDPtr, f, _$speedUnit.pointer) .reference); } @@ -438,21 +1619,21 @@ class Speed extends Measure { r'()F', ); - static final _getValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getValue()` double getValue() { - return _getValue(reference.pointer, _id_getValue as _$jni.JMethodIDPtr) + return _getValue(reference.pointer, _id_getValue as jni$_.JMethodIDPtr) .float; } @@ -461,23 +1642,23 @@ class Speed extends Measure { r'()Lcom/github/dart_lang/jnigen/SpeedUnit;', ); - static final _getUnit$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getUnit$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.github.dart_lang.jnigen.SpeedUnit getUnit()` /// The returned object must be released after use, by calling the [release] method. SpeedUnit getUnit$1() { - return _getUnit$1(reference.pointer, _id_getUnit$1 as _$jni.JMethodIDPtr) - .object(const $SpeedUnit$Type()); + return _getUnit$1(reference.pointer, _id_getUnit$1 as jni$_.JMethodIDPtr) + .object(const $SpeedUnit$Type()); } static final _id_toString$1 = _class.instanceMethodId( @@ -485,23 +1666,23 @@ class Speed extends Measure { r'()Ljava/lang/String;', ); - static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _toString$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String toString()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString toString$1() { - return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); } static final _id_component1 = _class.instanceMethodId( @@ -509,21 +1690,21 @@ class Speed extends Measure { r'()F', ); - static final _component1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _component1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final float component1()` double component1() { - return _component1(reference.pointer, _id_component1 as _$jni.JMethodIDPtr) + return _component1(reference.pointer, _id_component1 as jni$_.JMethodIDPtr) .float; } @@ -532,23 +1713,23 @@ class Speed extends Measure { r'()Lcom/github/dart_lang/jnigen/SpeedUnit;', ); - static final _component2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _component2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final com.github.dart_lang.jnigen.SpeedUnit component2()` /// The returned object must be released after use, by calling the [release] method. SpeedUnit component2() { - return _component2(reference.pointer, _id_component2 as _$jni.JMethodIDPtr) - .object(const $SpeedUnit$Type()); + return _component2(reference.pointer, _id_component2 as jni$_.JMethodIDPtr) + .object(const $SpeedUnit$Type()); } static final _id_copy = _class.instanceMethodId( @@ -556,19 +1737,19 @@ class Speed extends Measure { r'(FLcom/github/dart_lang/jnigen/SpeedUnit;)Lcom/github/dart_lang/jnigen/Speed;', ); - static final _copy = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _copy = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Double, - _$jni.Pointer<_$jni.Void> + jni$_.Double, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, double, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, double, jni$_.Pointer)>(); /// from: `public final com.github.dart_lang.jnigen.Speed copy(float f, com.github.dart_lang.jnigen.SpeedUnit speedUnit)` /// The returned object must be released after use, by calling the [release] method. @@ -576,9 +1757,10 @@ class Speed extends Measure { double f, SpeedUnit speedUnit, ) { - return _copy(reference.pointer, _id_copy as _$jni.JMethodIDPtr, f, - speedUnit.reference.pointer) - .object(const $Speed$Type()); + final _$speedUnit = speedUnit.reference; + return _copy(reference.pointer, _id_copy as jni$_.JMethodIDPtr, f, + _$speedUnit.pointer) + .object(const $Speed$Type()); } static final _id_hashCode$1 = _class.instanceMethodId( @@ -586,21 +1768,21 @@ class Speed extends Measure { r'()I', ); - static final _hashCode$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _hashCode$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int hashCode()` int hashCode$1() { - return _hashCode$1(reference.pointer, _id_hashCode$1 as _$jni.JMethodIDPtr) + return _hashCode$1(reference.pointer, _id_hashCode$1 as jni$_.JMethodIDPtr) .integer; } @@ -609,73 +1791,118 @@ class Speed extends Measure { r'(Ljava/lang/Object;)Z', ); - static final _equals = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _equals = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public boolean equals(java.lang.Object object)` bool equals( - _$jni.JObject object, + jni$_.JObject? object, ) { - return _equals(reference.pointer, _id_equals as _$jni.JMethodIDPtr, - object.reference.pointer) + final _$object = object?.reference ?? jni$_.jNullReference; + return _equals(reference.pointer, _id_equals as jni$_.JMethodIDPtr, + _$object.pointer) .boolean; } } -final class $Speed$Type extends _$jni.JObjType { - @_$jni.internal - const $Speed$Type(); +final class $Speed$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Speed$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/Speed;'; - @_$jni.internal - @_$core.override - Speed fromReference(_$jni.JReference reference) => - Speed.fromReference(reference); + @jni$_.internal + @core$_.override + Speed? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Speed.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $Measure$Type($SpeedUnit$Type()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($Speed$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const $Measure$Type($SpeedUnit$Type()); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Speed$NullableType) && + other is $Speed$NullableType; + } +} - @_$jni.internal - @_$core.override +final class $Speed$Type extends jni$_.JObjType { + @jni$_.internal + const $Speed$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/Speed;'; + + @jni$_.internal + @core$_.override + Speed fromReference(jni$_.JReference reference) => Speed.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $Measure$Type($SpeedUnit$Type()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Speed$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => ($Speed$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Speed$Type) && other is $Speed$Type; } } /// from: `com.github.dart_lang.jnigen.SpeedUnit` -class SpeedUnit extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class SpeedUnit extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal SpeedUnit.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/SpeedUnit'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/SpeedUnit'); /// The type which includes information such as the signature of this class. + static const nullableType = $SpeedUnit$NullableType(); static const type = $SpeedUnit$Type(); static final _id_KmPerHour = _class.staticFieldId( r'KmPerHour', @@ -684,8 +1911,8 @@ class SpeedUnit extends _$jni.JObject { /// from: `static public final com.github.dart_lang.jnigen.SpeedUnit KmPerHour` /// The returned object must be released after use, by calling the [release] method. - static SpeedUnit get KmPerHour => - _id_KmPerHour.get(_class, const $SpeedUnit$Type()); + static SpeedUnit? get KmPerHour => + _id_KmPerHour.get(_class, const $SpeedUnit$NullableType()); static final _id_MetrePerSec = _class.staticFieldId( r'MetrePerSec', @@ -694,31 +1921,31 @@ class SpeedUnit extends _$jni.JObject { /// from: `static public final com.github.dart_lang.jnigen.SpeedUnit MetrePerSec` /// The returned object must be released after use, by calling the [release] method. - static SpeedUnit get MetrePerSec => - _id_MetrePerSec.get(_class, const $SpeedUnit$Type()); + static SpeedUnit? get MetrePerSec => + _id_MetrePerSec.get(_class, const $SpeedUnit$NullableType()); static final _id_getSign = _class.instanceMethodId( r'getSign', r'()Ljava/lang/String;', ); - static final _getSign = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSign = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getSign()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getSign() { - return _getSign(reference.pointer, _id_getSign as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + jni$_.JString getSign() { + return _getSign(reference.pointer, _id_getSign as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); } static final _id_getCoefficient = _class.instanceMethodId( @@ -726,22 +1953,22 @@ class SpeedUnit extends _$jni.JObject { r'()F', ); - static final _getCoefficient = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCoefficient = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallFloatMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public float getCoefficient()` double getCoefficient() { return _getCoefficient( - reference.pointer, _id_getCoefficient as _$jni.JMethodIDPtr) + reference.pointer, _id_getCoefficient as jni$_.JMethodIDPtr) .float; } @@ -750,23 +1977,25 @@ class SpeedUnit extends _$jni.JObject { r'()[Lcom/github/dart_lang/jnigen/SpeedUnit;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.github.dart_lang.jnigen.SpeedUnit[] values()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($SpeedUnit$Type())); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $SpeedUnit$NullableType())); } static final _id_valueOf = _class.staticMethodId( @@ -774,96 +2003,141 @@ class SpeedUnit extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/SpeedUnit;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `static public com.github.dart_lang.jnigen.SpeedUnit valueOf(java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - static SpeedUnit valueOf( - _$jni.JString string, + static SpeedUnit? valueOf( + jni$_.JString? string, ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - string.reference.pointer) - .object(const $SpeedUnit$Type()); + final _$string = string?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const $SpeedUnit$NullableType()); } } -final class $SpeedUnit$Type extends _$jni.JObjType { - @_$jni.internal - const $SpeedUnit$Type(); +final class $SpeedUnit$NullableType extends jni$_.JObjType { + @jni$_.internal + const $SpeedUnit$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/SpeedUnit;'; - @_$jni.internal - @_$core.override - SpeedUnit fromReference(_$jni.JReference reference) => - SpeedUnit.fromReference(reference); + @jni$_.internal + @core$_.override + SpeedUnit? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : SpeedUnit.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SpeedUnit$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SpeedUnit$NullableType) && + other is $SpeedUnit$NullableType; + } +} - @_$jni.internal - @_$core.override +final class $SpeedUnit$Type extends jni$_.JObjType { + @jni$_.internal + const $SpeedUnit$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/SpeedUnit;'; + + @jni$_.internal + @core$_.override + SpeedUnit fromReference(jni$_.JReference reference) => + SpeedUnit.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SpeedUnit$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($SpeedUnit$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($SpeedUnit$Type) && other is $SpeedUnit$Type; } } /// from: `com.github.dart_lang.jnigen.SuspendFun` -class SuspendFun extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class SuspendFun extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal SuspendFun.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/SuspendFun'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/SuspendFun'); /// The type which includes information such as the signature of this class. + static const nullableType = $SuspendFun$NullableType(); static const type = $SuspendFun$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory SuspendFun() { return SuspendFun.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -872,33 +2146,36 @@ class SuspendFun extends _$jni.JObject { r'(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', ); - static final _sayHello = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _sayHello = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public final java.lang.Object sayHello(kotlin.coroutines.Continuation continuation)` /// The returned object must be released after use, by calling the [release] method. - _$core.Future<_$jni.JString> sayHello() async { - final $p = _$jni.ReceivePort(); - final $c = _$jni.JObject.fromReference( - _$jni.ProtectedJniExtensions.newPortContinuation($p)); - _sayHello(reference.pointer, _id_sayHello as _$jni.JMethodIDPtr, - $c.reference.pointer) - .object(const _$jni.JObjectType()); + core$_.Future sayHello() async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + _sayHello(reference.pointer, _id_sayHello as jni$_.JMethodIDPtr, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); final $o = - _$jni.JGlobalReference(_$jni.JObjectPtr.fromAddress(await $p.first)); - final $k = const _$jni.JStringType().jClass.reference.pointer; - if (!_$jni.Jni.env.IsInstanceOf($o.pointer, $k)) { + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress(await $p.first)); + final $k = const jni$_.JStringType().jClass.reference; + if (!jni$_.Jni.env.IsInstanceOf($o.pointer, $k.pointer)) { + $k.release(); throw 'Failed'; } - return const _$jni.JStringType().fromReference($o); + $k.release(); + return const jni$_.JStringType().fromReference($o); } static final _id_sayHello$1 = _class.instanceMethodId( @@ -906,98 +2183,144 @@ class SuspendFun extends _$jni.JObject { r'(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', ); - static final _sayHello$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _sayHello$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); /// from: `public final java.lang.Object sayHello(java.lang.String string, kotlin.coroutines.Continuation continuation)` /// The returned object must be released after use, by calling the [release] method. - _$core.Future<_$jni.JString> sayHello$1( - _$jni.JString string, + core$_.Future sayHello$1( + jni$_.JString? string, ) async { - final $p = _$jni.ReceivePort(); - final $c = _$jni.JObject.fromReference( - _$jni.ProtectedJniExtensions.newPortContinuation($p)); - _sayHello$1(reference.pointer, _id_sayHello$1 as _$jni.JMethodIDPtr, - string.reference.pointer, $c.reference.pointer) - .object(const _$jni.JObjectType()); + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$string = string?.reference ?? jni$_.jNullReference; + _sayHello$1(reference.pointer, _id_sayHello$1 as jni$_.JMethodIDPtr, + _$string.pointer, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); final $o = - _$jni.JGlobalReference(_$jni.JObjectPtr.fromAddress(await $p.first)); - final $k = const _$jni.JStringType().jClass.reference.pointer; - if (!_$jni.Jni.env.IsInstanceOf($o.pointer, $k)) { + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress(await $p.first)); + final $k = const jni$_.JStringType().jClass.reference; + if (!jni$_.Jni.env.IsInstanceOf($o.pointer, $k.pointer)) { + $k.release(); throw 'Failed'; } - return const _$jni.JStringType().fromReference($o); + $k.release(); + return const jni$_.JStringType().fromReference($o); } } -final class $SuspendFun$Type extends _$jni.JObjType { - @_$jni.internal - const $SuspendFun$Type(); +final class $SuspendFun$NullableType extends jni$_.JObjType { + @jni$_.internal + const $SuspendFun$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/SuspendFun;'; - @_$jni.internal - @_$core.override - SuspendFun fromReference(_$jni.JReference reference) => - SuspendFun.fromReference(reference); + @jni$_.internal + @core$_.override + SuspendFun? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : SuspendFun.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SuspendFun$NullableType).hashCode; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SuspendFun$NullableType) && + other is $SuspendFun$NullableType; + } +} - @_$jni.internal - @_$core.override +final class $SuspendFun$Type extends jni$_.JObjType { + @jni$_.internal + const $SuspendFun$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/SuspendFun;'; + + @jni$_.internal + @core$_.override + SuspendFun fromReference(jni$_.JReference reference) => + SuspendFun.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SuspendFun$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($SuspendFun$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($SuspendFun$Type) && other is $SuspendFun$Type; } } final _TopLevelKtClass = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/TopLevelKt'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/TopLevelKt'); final _id_getTopLevelField = _TopLevelKtClass.staticMethodId( r'getTopLevelField', r'()I', ); -final _getTopLevelField = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, +final _getTopLevelField = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public final int getTopLevelField()` int getTopLevelField() { return _getTopLevelField(_TopLevelKtClass.reference.pointer, - _id_getTopLevelField as _$jni.JMethodIDPtr) + _id_getTopLevelField as jni$_.JMethodIDPtr) .integer; } @@ -1006,21 +2329,21 @@ final _id_setTopLevelField = _TopLevelKtClass.staticMethodId( r'(I)V', ); -final _setTopLevelField = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( +final _setTopLevelField = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); /// from: `static public final void setTopLevelField(int i)` void setTopLevelField( int i, ) { _setTopLevelField(_TopLevelKtClass.reference.pointer, - _id_setTopLevelField as _$jni.JMethodIDPtr, i) + _id_setTopLevelField as jni$_.JMethodIDPtr, i) .check(); } @@ -1029,22 +2352,22 @@ final _id_topLevel = _TopLevelKtClass.staticMethodId( r'()I', ); -final _topLevel = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, +final _topLevel = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public final int topLevel()` int topLevel() { return _topLevel(_TopLevelKtClass.reference.pointer, - _id_topLevel as _$jni.JMethodIDPtr) + _id_topLevel as jni$_.JMethodIDPtr) .integer; } @@ -1053,16 +2376,16 @@ final _id_topLevelSum = _TopLevelKtClass.staticMethodId( r'(II)I', ); -final _topLevelSum = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32, _$jni.Int32)>)>>( +final _topLevelSum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( 'globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); /// from: `static public final int topLevelSum(int i, int i1)` int topLevelSum( @@ -1070,6 +2393,80 @@ int topLevelSum( int i1, ) { return _topLevelSum(_TopLevelKtClass.reference.pointer, - _id_topLevelSum as _$jni.JMethodIDPtr, i, i1) + _id_topLevelSum as jni$_.JMethodIDPtr, i, i1) + .integer; +} + +final _TopLevelKt$1Class = + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/subpackage/TopLevelKt'); + +final _id_getTopLevelField$1 = _TopLevelKt$1Class.staticMethodId( + r'getTopLevelField', + r'()I', +); + +final _getTopLevelField$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + +/// from: `static public final int getTopLevelField()` +int getTopLevelField$1() { + return _getTopLevelField$1(_TopLevelKt$1Class.reference.pointer, + _id_getTopLevelField$1 as jni$_.JMethodIDPtr) + .integer; +} + +final _id_setTopLevelField$1 = _TopLevelKt$1Class.staticMethodId( + r'setTopLevelField', + r'(I)V', +); + +final _setTopLevelField$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( + 'globalEnv_CallStaticVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + +/// from: `static public final void setTopLevelField(int i)` +void setTopLevelField$1( + int i, +) { + _setTopLevelField$1(_TopLevelKt$1Class.reference.pointer, + _id_setTopLevelField$1 as jni$_.JMethodIDPtr, i) + .check(); +} + +final _id_topLevel$1 = _TopLevelKt$1Class.staticMethodId( + r'topLevel', + r'()I', +); + +final _topLevel$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + +/// from: `static public final int topLevel()` +int topLevel$1() { + return _topLevel$1(_TopLevelKt$1Class.reference.pointer, + _id_topLevel$1 as jni$_.JMethodIDPtr) .integer; } diff --git a/pkgs/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/Nullability.kt b/pkgs/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/Nullability.kt new file mode 100644 index 000000000..159be46ba --- /dev/null +++ b/pkgs/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/Nullability.kt @@ -0,0 +1,84 @@ +/* Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file + * for details. All rights reserved. Use of this source code is governed by a + * BSD-style license that can be found in the LICENSE file. + */ + +package com.github.dart_lang.jnigen + +public class Nullability(val t: T, val u: U, var nullableU: U?) { + public fun hello(): String { + return "hello" + } + + public fun nullableHello(returnNull: Boolean): String? { + return if (returnNull) null else "hello" + } + + public fun methodGenericEcho(v: V): V { + return v + } + + public fun methodGenericNullableEcho(v: V): V { + return v + } + + public fun classGenericEcho(u: U): U { + return u + } + + public fun classGenericNullableEcho(t: T): T { + return t + } + + public fun firstOf(list: List): String { + return list.first(); + } + + public fun firstOfNullable(list: List): String? { + return list.first(); + } + + public fun classGenericFirstOf(list: List): U { + return list.first(); + } + + public fun classGenericFirstOfNullable(list: List): T { + return list.first(); + } + + public fun methodGenericFirstOf(list: List): V { + return list.first(); + } + + public fun methodGenericFirstOfNullable(list: List): V { + return list.first(); + } + + public fun stringListOf(element: String): List { + return listOf(element) + } + + public fun nullableListOf(element: String?): List { + return listOf(element) + } + + public fun classGenericListOf(element: U): List { + return listOf(element) + } + + public fun classGenericNullableListOf(element: T): List { + return listOf(element) + } + + public fun methodGenericListOf(element: V): List { + return listOf(element) + } + + public fun methodGenericNullableListOf(element: V): List { + return listOf(element) + } + + public inner class InnerClass { + public fun f(t: T, u: U, v: V) {} + } +} diff --git a/pkgs/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/subpackage/TopLevel.kt b/pkgs/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/subpackage/TopLevel.kt new file mode 100644 index 000000000..6505f8715 --- /dev/null +++ b/pkgs/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/subpackage/TopLevel.kt @@ -0,0 +1,14 @@ +/* Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file + * for details. All rights reserved. Use of this source code is governed by a + * BSD-style license that can be found in the LICENSE file. + */ + +package com.github.dart_lang.jnigen.subpackage + +// The same property and function defined in `../TopLevel.kt` to test renaming. + +var topLevelField: Int = 42 + +fun topLevel(): Int { + return 42 +} diff --git a/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart b/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart index 6003f7791..827579ec5 100644 --- a/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart +++ b/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart @@ -24,16 +24,229 @@ void registerTests(String groupName, TestRunnerCallback test) { test('Top levels', () { expect(topLevel(), 42); + expect(topLevel$1(), 42); expect(topLevelSum(10, 20), 30); expect(getTopLevelField(), 42); + expect(getTopLevelField$1(), 42); setTopLevelField(30); + setTopLevelField$1(30); expect(getTopLevelField(), 30); + expect(getTopLevelField$1(), 30); }); test('Generics', () { using((arena) { - final speed = Speed(10, SpeedUnit.MetrePerSec)..releasedBy(arena); - expect(speed.convertValue(SpeedUnit.KmPerHour), closeTo(36, 1e-6)); + final speed = Speed(10, SpeedUnit.MetrePerSec!)..releasedBy(arena); + expect(speed.convertValue(SpeedUnit.KmPerHour!), closeTo(36, 1e-6)); + }); + }); + + group('Nullability', () { + Nullability testObject(Arena arena) { + return Nullability( + null, + 'hello'.toJString(), + null, + T: JString.nullableType, + U: JString.type, + )..releasedBy(arena); + } + + test('Getters', () { + using((arena) { + final obj = testObject(arena); + expect( + obj.getU().toDartString(releaseOriginal: true), + 'hello', + ); + expect(obj.getT(), null); + expect(obj.getNullableU(), null); + }); + }); + test('Setters', () { + using((arena) { + final obj = testObject(arena); + obj.setNullableU('hello'.toJString()..releasedBy(arena)); + expect( + obj.getNullableU()!.toDartString(releaseOriginal: true), + 'hello', + ); + obj.setNullableU(null); + expect( + obj.getNullableU(), + null, + ); + }); + }); + test('Methods', () { + using((arena) { + final obj = testObject(arena); + expect(obj.hello().toDartString(releaseOriginal: true), 'hello'); + expect( + obj.nullableHello(false)!.toDartString(releaseOriginal: true), + 'hello', + ); + expect(obj.nullableHello(true), null); + expect( + obj + .classGenericEcho('hello'.toJString()..releasedBy(arena)) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .classGenericNullableEcho( + 'hello'.toJString()..releasedBy(arena))! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect(obj.classGenericNullableEcho(null), null); + expect( + obj + .methodGenericEcho( + 'hello'.toJString()..releasedBy(arena), + V: JString.type, + ) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .methodGenericNullableEcho( + 'hello'.toJString()..releasedBy(arena), + V: JString.nullableType, + )! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj.methodGenericNullableEcho(null, V: JString.nullableType), + null, + ); + expect( + obj + .stringListOf('hello'.toJString()..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .nullableListOf('hello'.toJString()..releasedBy(arena))[0]! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect(obj.nullableListOf(null)[0], null); + expect( + obj + .classGenericListOf('hello'.toJString()..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .classGenericNullableListOf( + 'hello'.toJString()..releasedBy(arena))[0]! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect(obj.classGenericNullableListOf(null)[0], null); + expect( + obj + .methodGenericListOf('hello'.toJString()..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .methodGenericNullableListOf( + 'hello'.toJString()..releasedBy(arena), + V: JString.nullableType, + )[0]! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj.methodGenericNullableListOf(null, V: JString.nullableType)[0], + null, + ); + expect( + obj + .firstOf(['hello'.toJString()..releasedBy(arena)] + .toJList(JString.type)) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .firstOfNullable(['hello'.toJString()..releasedBy(arena), null] + .toJList(JString.nullableType))! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj.firstOfNullable([null, 'hello'.toJString()..releasedBy(arena)] + .toJList(JString.nullableType)), + null, + ); + expect( + obj + .classGenericFirstOf(['hello'.toJString()..releasedBy(arena)] + .toJList(JString.type)) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .classGenericFirstOfNullable([ + 'hello'.toJString()..releasedBy(arena), + null, + ].toJList(JString.nullableType))! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj.classGenericFirstOfNullable([ + null, + 'hello'.toJString()..releasedBy(arena), + ].toJList(JString.nullableType)), + null, + ); + expect( + obj + .methodGenericFirstOf(['hello'.toJString()..releasedBy(arena)] + .toJList(JString.type)) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj + .methodGenericFirstOfNullable([ + 'hello'.toJString()..releasedBy(arena), + null, + ].toJList(JString.nullableType))! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + obj.methodGenericFirstOfNullable([ + null, + 'hello'.toJString()..releasedBy(arena), + ].toJList(JString.nullableType)), + null, + ); + }); + }); + test('Inner class', () { + using((arena) { + final obj = testObject(arena); + final innerObj = Nullability$InnerClass( + obj, + V: JInteger.type); + expect( + innerObj.f, + isA(), + ); + }); }); }); }); diff --git a/pkgs/jnigen/test/package_resolver_test.dart b/pkgs/jnigen/test/package_resolver_test.dart index a29e04362..59595522e 100644 --- a/pkgs/jnigen/test/package_resolver_test.dart +++ b/pkgs/jnigen/test/package_resolver_test.dart @@ -43,23 +43,24 @@ void main() async { final tests = [ // Absolute imports resolved using import map - ResolverTest('android.os.Process', 'package:android/os.dart', 'process_.'), + ResolverTest( + 'android.os.Process', 'package:android/os.dart', r'process$_.'), ResolverTest('org.apache.pdfbox.pdmodel.PDDocument', - 'package:pdfbox/pdfbox.dart', 'pddocument_.'), + 'package:pdfbox/pdfbox.dart', r'pddocument$_.'), // Relative imports // inner package - ResolverTest('a.b.c.D', 'c/D.dart', 'd_.'), + ResolverTest('a.b.c.D', 'c/D.dart', r'd$_.'), // inner package, deeper - ResolverTest('a.b.c.d.E', 'c/d/E.dart', 'e_.'), + ResolverTest('a.b.c.d.E', 'c/d/E.dart', r'e$_.'), // parent package - ResolverTest('a.X', '../X.dart', 'x_.'), + ResolverTest('a.X', '../X.dart', r'x$_.'), // unrelated package in same translation unit - ResolverTest('e.f.G', '../../e/f/G.dart', 'g_.'), - ResolverTest('e.F', '../../e/F.dart', 'f_.'), + ResolverTest('e.f.G', '../../e/f/G.dart', r'g$_.'), + ResolverTest('e.F', '../../e/F.dart', r'f$_.'), // neighbour package - ResolverTest('a.g.Y', '../g/Y.dart', 'y_.'), + ResolverTest('a.g.Y', '../g/Y.dart', r'y$_.'), // inner package of a neighbour package - ResolverTest('a.m.n.P', '../m/n/P.dart', 'p_.'), + ResolverTest('a.m.n.P', '../m/n/P.dart', r'p$_.'), ]; for (var testCase in tests) { diff --git a/pkgs/jnigen/test/renamer_test.dart b/pkgs/jnigen/test/renamer_test.dart index 5fea38fc6..d2c9bac24 100644 --- a/pkgs/jnigen/test/renamer_test.dart +++ b/pkgs/jnigen/test/renamer_test.dart @@ -177,8 +177,6 @@ void main() { }); test('Names with existing dollar signs', () async { - // TODO(https://github.com/dart-lang/native/issues/1544): Test class names - // containing dollar signs. final classes = Classes({ 'Foo': ClassDecl( binaryName: 'Foo', @@ -295,4 +293,42 @@ void main() { final classRenamedMethods = classes.decls['MyClass']!.methods.finalNames; expect(classRenamedMethods, [r'implement', r'implementIn']); }); + + test('Inner classes vs classes with dollar signs', () async { + final classes = Classes({ + 'Outer': ClassDecl( + binaryName: 'Outer', + declKind: DeclKind.classKind, + superclass: TypeUsage.object, + methods: [], + ), + r'Outer$Inner': ClassDecl( + binaryName: r'Outer$Inner', + declKind: DeclKind.classKind, + superclass: TypeUsage.object, + methods: [], + outerClassBinaryName: 'Outer', + ), + r'Outer$Inner$Innermost': ClassDecl( + binaryName: r'Outer$Inner$Innermost', + declKind: DeclKind.classKind, + superclass: TypeUsage.object, + methods: [], + outerClassBinaryName: r'Outer$Inner', + ), + r'Outer$With$Many$Dollarsigns': ClassDecl( + binaryName: r'Outer$With$Many$Dollarsigns', + declKind: DeclKind.classKind, + superclass: TypeUsage.object, + methods: [], + ), + }); + await rename(classes); + expect(classes.decls['Outer']!.finalName, 'Outer'); + expect(classes.decls[r'Outer$Inner']!.finalName, r'Outer$Inner'); + expect(classes.decls[r'Outer$Inner$Innermost']!.finalName, + r'Outer$Inner$Innermost'); + expect(classes.decls[r'Outer$With$Many$Dollarsigns']!.finalName, + r'Outer$$With$$Many$$Dollarsigns'); + }); } diff --git a/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart b/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart index debd204f9..0e7178234 100644 --- a/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart +++ b/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart @@ -24,6 +24,7 @@ // ignore_for_file: prefer_double_quotes // ignore_for_file: unintended_html_in_doc_comment // ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion // ignore_for_file: unnecessary_parenthesis // ignore_for_file: unused_element // ignore_for_file: unused_field @@ -33,50 +34,107 @@ // ignore_for_file: use_super_parameters import 'dart:core' show Object, String, bool, double, int; -import 'dart:core' as _$core; +import 'dart:core' as core$_; -import 'package:jni/_internal.dart' as _$jni; -import 'package:jni/jni.dart' as _$jni; +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; /// from: `com.github.dart_lang.jnigen.simple_package.Color` -class Color extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Color extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Color.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/simple_package/Color'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/simple_package/Color'); /// The type which includes information such as the signature of this class. + static const nullableType = $Color$NullableType(); static const type = $Color$Type(); + static final _id_RED = _class.staticFieldId( + r'RED', + r'Lcom/github/dart_lang/jnigen/simple_package/Color;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.simple_package.Color RED` + /// The returned object must be released after use, by calling the [release] method. + static Color? get RED => _id_RED.get(_class, const $Color$NullableType()); + + static final _id_BLUE = _class.staticFieldId( + r'BLUE', + r'Lcom/github/dart_lang/jnigen/simple_package/Color;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.simple_package.Color BLUE` + /// The returned object must be released after use, by calling the [release] method. + static Color? get BLUE => _id_BLUE.get(_class, const $Color$NullableType()); + + static final _id_BLACK = _class.staticFieldId( + r'BLACK', + r'Lcom/github/dart_lang/jnigen/simple_package/Color;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.simple_package.Color BLACK` + /// The returned object must be released after use, by calling the [release] method. + static Color? get BLACK => _id_BLACK.get(_class, const $Color$NullableType()); + + static final _id_GREEN = _class.staticFieldId( + r'GREEN', + r'Lcom/github/dart_lang/jnigen/simple_package/Color;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.simple_package.Color GREEN` + /// The returned object must be released after use, by calling the [release] method. + static Color? get GREEN => _id_GREEN.get(_class, const $Color$NullableType()); + + static final _id_YELLOW = _class.staticFieldId( + r'YELLOW', + r'Lcom/github/dart_lang/jnigen/simple_package/Color;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.simple_package.Color YELLOW` + /// The returned object must be released after use, by calling the [release] method. + static Color? get YELLOW => + _id_YELLOW.get(_class, const $Color$NullableType()); + + static final _id_LIME = _class.staticFieldId( + r'LIME', + r'Lcom/github/dart_lang/jnigen/simple_package/Color;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.simple_package.Color LIME` + /// The returned object must be released after use, by calling the [release] method. + static Color? get LIME => _id_LIME.get(_class, const $Color$NullableType()); + static final _id_values = _class.staticMethodId( r'values', r'()[Lcom/github/dart_lang/jnigen/simple_package/Color;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public com.github.dart_lang.jnigen.simple_package.Color[] values()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($Color$Type())); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType($Color$NullableType())); } static final _id_valueOf = _class.staticMethodId( @@ -84,183 +142,273 @@ class Color extends _$jni.JObject { r'(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/simple_package/Color;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.simple_package.Color valueOf(java.lang.String name)` + /// from: `static public com.github.dart_lang.jnigen.simple_package.Color valueOf(java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - static Color valueOf( - _$jni.JString name, + static Color? valueOf( + jni$_.JString? string, ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - name.reference.pointer) - .object(const $Color$Type()); + final _$string = string?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const $Color$NullableType()); } } -final class $Color$Type extends _$jni.JObjType { - @_$jni.internal - const $Color$Type(); +final class $Color$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Color$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Color;'; - @_$jni.internal - @_$core.override - Color fromReference(_$jni.JReference reference) => - Color.fromReference(reference); + @jni$_.internal + @core$_.override + Color? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Color.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Color$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Color$NullableType) && + other is $Color$NullableType; + } +} + +final class $Color$Type extends jni$_.JObjType { + @jni$_.internal + const $Color$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Color;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Color fromReference(jni$_.JReference reference) => Color.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Color$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Color$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Color$Type) && other is $Color$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Example$Nested$NestedTwice` -class Example_Nested_NestedTwice extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Example_Nested_NestedTwice.fromReference( - _$jni.JReference reference, +class Example$Nested$NestedTwice extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Example$Nested$NestedTwice.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Example$Nested$NestedTwice'); /// The type which includes information such as the signature of this class. - static const type = $Example_Nested_NestedTwice$Type(); + static const nullableType = $Example$Nested$NestedTwice$NullableType(); + static const type = $Example$Nested$NestedTwice$Type(); static final _id_ZERO = _class.staticFieldId( r'ZERO', r'I', ); /// from: `static public int ZERO` - static int get ZERO => _id_ZERO.get(_class, const _$jni.jintType()); + static int get ZERO => _id_ZERO.get(_class, const jni$_.jintType()); /// from: `static public int ZERO` static set ZERO(int value) => - _id_ZERO.set(_class, const _$jni.jintType(), value); + _id_ZERO.set(_class, const jni$_.jintType(), value); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory Example_Nested_NestedTwice() { - return Example_Nested_NestedTwice.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + factory Example$Nested$NestedTwice() { + return Example$Nested$NestedTwice.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $Example_Nested_NestedTwice$Type - extends _$jni.JObjType { - @_$jni.internal - const $Example_Nested_NestedTwice$Type(); +final class $Example$Nested$NestedTwice$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $Example$Nested$NestedTwice$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Example$Nested$NestedTwice;'; - @_$jni.internal - @_$core.override - Example_Nested_NestedTwice fromReference(_$jni.JReference reference) => - Example_Nested_NestedTwice.fromReference(reference); + @jni$_.internal + @core$_.override + Example$Nested$NestedTwice? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Example$Nested$NestedTwice.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Example$Nested$NestedTwice$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Example$Nested$NestedTwice$NullableType) && + other is $Example$Nested$NestedTwice$NullableType; + } +} + +final class $Example$Nested$NestedTwice$Type + extends jni$_.JObjType { + @jni$_.internal + const $Example$Nested$NestedTwice$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Example$Nested$NestedTwice;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Example$Nested$NestedTwice fromReference(jni$_.JReference reference) => + Example$Nested$NestedTwice.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Example$Nested$NestedTwice$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Example_Nested_NestedTwice$Type).hashCode; + @core$_.override + int get hashCode => ($Example$Nested$NestedTwice$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Example_Nested_NestedTwice$Type) && - other is $Example_Nested_NestedTwice$Type; + return other.runtimeType == ($Example$Nested$NestedTwice$Type) && + other is $Example$Nested$NestedTwice$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Example$Nested` -class Example_Nested extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Example_Nested.fromReference( - _$jni.JReference reference, +class Example$Nested extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Example$Nested.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Example$Nested'); /// The type which includes information such as the signature of this class. - static const type = $Example_Nested$Type(); + static const nullableType = $Example$Nested$NullableType(); + static const type = $Example$Nested$Type(); static final _id_new$ = _class.constructorId( r'(Z)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_NewObject') + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void (boolean value)` + /// from: `public void (boolean z)` /// The returned object must be released after use, by calling the [release] method. - factory Example_Nested( - bool value, + factory Example$Nested( + bool z, ) { - return Example_Nested.fromReference(_new$(_class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, value ? 1 : 0) + return Example$Nested.fromReference(_new$( + _class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, z ? 1 : 0) .reference); } @@ -269,22 +417,22 @@ class Example_Nested extends _$jni.JObject { r'()V', ); - static final _usesAnonymousInnerClass = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _usesAnonymousInnerClass = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void usesAnonymousInnerClass()` void usesAnonymousInnerClass() { _usesAnonymousInnerClass(reference.pointer, - _id_usesAnonymousInnerClass as _$jni.JMethodIDPtr) + _id_usesAnonymousInnerClass as jni$_.JMethodIDPtr) .check(); } @@ -293,21 +441,21 @@ class Example_Nested extends _$jni.JObject { r'()Z', ); - static final _getValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getValue()` bool getValue() { - return _getValue(reference.pointer, _id_getValue as _$jni.JMethodIDPtr) + return _getValue(reference.pointer, _id_getValue as jni$_.JMethodIDPtr) .boolean; } @@ -316,161 +464,254 @@ class Example_Nested extends _$jni.JObject { r'(Z)V', ); - static final _setValue = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setValue = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void setValue(boolean value)` + /// from: `public void setValue(boolean z)` void setValue( - bool value, + bool z, ) { - _setValue(reference.pointer, _id_setValue as _$jni.JMethodIDPtr, - value ? 1 : 0) + _setValue(reference.pointer, _id_setValue as jni$_.JMethodIDPtr, z ? 1 : 0) .check(); } } -final class $Example_Nested$Type extends _$jni.JObjType { - @_$jni.internal - const $Example_Nested$Type(); +final class $Example$Nested$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $Example$Nested$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;'; - @_$jni.internal - @_$core.override - Example_Nested fromReference(_$jni.JReference reference) => - Example_Nested.fromReference(reference); + @jni$_.internal + @core$_.override + Example$Nested? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Example$Nested.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Example$Nested$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Example$Nested$NullableType) && + other is $Example$Nested$NullableType; + } +} + +final class $Example$Nested$Type extends jni$_.JObjType { + @jni$_.internal + const $Example$Nested$Type(); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Example$Nested fromReference(jni$_.JReference reference) => + Example$Nested.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Example$Nested$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Example_Nested$Type).hashCode; + @core$_.override + int get hashCode => ($Example$Nested$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Example_Nested$Type) && - other is $Example_Nested$Type; + return other.runtimeType == ($Example$Nested$Type) && + other is $Example$Nested$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Example$NonStaticNested` -class Example_NonStaticNested extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Example_NonStaticNested.fromReference( - _$jni.JReference reference, +class Example$NonStaticNested extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Example$NonStaticNested.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Example$NonStaticNested'); /// The type which includes information such as the signature of this class. - static const type = $Example_NonStaticNested$Type(); + static const nullableType = $Example$NonStaticNested$NullableType(); + static const type = $Example$NonStaticNested$Type(); static final _id_ok = _class.instanceFieldId( r'ok', r'Z', ); /// from: `public boolean ok` - bool get ok => _id_ok.get(this, const _$jni.jbooleanType()); + bool get ok => _id_ok.get(this, const jni$_.jbooleanType()); /// from: `public boolean ok` - set ok(bool value) => _id_ok.set(this, const _$jni.jbooleanType(), value); + set ok(bool value) => _id_ok.set(this, const jni$_.jbooleanType(), value); static final _id_new$ = _class.constructorId( r'(Lcom/github/dart_lang/jnigen/simple_package/Example;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void (com.github.dart_lang.jnigen.simple_package.Example $parent)` + /// from: `public void (com.github.dart_lang.jnigen.simple_package.Example $outerClass)` /// The returned object must be released after use, by calling the [release] method. - factory Example_NonStaticNested( - Example $parent, + factory Example$NonStaticNested( + Example $outerClass, ) { - return Example_NonStaticNested.fromReference(_new$(_class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, $parent.reference.pointer) + final _$$outerClass = $outerClass.reference; + return Example$NonStaticNested.fromReference(_new$(_class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, _$$outerClass.pointer) .reference); } } -final class $Example_NonStaticNested$Type - extends _$jni.JObjType { - @_$jni.internal - const $Example_NonStaticNested$Type(); +final class $Example$NonStaticNested$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $Example$NonStaticNested$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Example$NonStaticNested;'; - @_$jni.internal - @_$core.override - Example_NonStaticNested fromReference(_$jni.JReference reference) => - Example_NonStaticNested.fromReference(reference); + @jni$_.internal + @core$_.override + Example$NonStaticNested? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Example$NonStaticNested.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Example$NonStaticNested$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Example$NonStaticNested$NullableType) && + other is $Example$NonStaticNested$NullableType; + } +} + +final class $Example$NonStaticNested$Type + extends jni$_.JObjType { + @jni$_.internal + const $Example$NonStaticNested$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Example$NonStaticNested;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Example$NonStaticNested fromReference(jni$_.JReference reference) => + Example$NonStaticNested.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Example$NonStaticNested$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Example_NonStaticNested$Type).hashCode; + @core$_.override + int get hashCode => ($Example$NonStaticNested$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Example_NonStaticNested$Type) && - other is $Example_NonStaticNested$Type; + return other.runtimeType == ($Example$NonStaticNested$Type) && + other is $Example$NonStaticNested$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Example` -class Example extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Example extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Example.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Example'); /// The type which includes information such as the signature of this class. + static const nullableType = $Example$NullableType(); static const type = $Example$Type(); /// from: `static public final int ON` @@ -491,8 +732,8 @@ class Example extends _$jni.JObject { /// from: `static public final java.lang.String SEMICOLON_STRING` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get SEMICOLON_STRING => - _id_SEMICOLON_STRING.get(_class, const _$jni.JStringType()); + static jni$_.JString? get SEMICOLON_STRING => + _id_SEMICOLON_STRING.get(_class, const jni$_.JStringNullableType()); static final _id_unusedRandom = _class.staticFieldId( r'unusedRandom', @@ -501,30 +742,30 @@ class Example extends _$jni.JObject { /// from: `static public final java.util.Random unusedRandom` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JObject get unusedRandom => - _id_unusedRandom.get(_class, const _$jni.JObjectType()); + static jni$_.JObject? get unusedRandom => + _id_unusedRandom.get(_class, const jni$_.JObjectNullableType()); static final _id_getAmount = _class.staticMethodId( r'getAmount', r'()I', ); - static final _getAmount = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getAmount = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public int getAmount()` static int getAmount() { return _getAmount( - _class.reference.pointer, _id_getAmount as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_getAmount as jni$_.JMethodIDPtr) .integer; } @@ -533,21 +774,21 @@ class Example extends _$jni.JObject { r'()D', ); - static final _getPi = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getPi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticDoubleMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public double getPi()` static double getPi() { - return _getPi(_class.reference.pointer, _id_getPi as _$jni.JMethodIDPtr) + return _getPi(_class.reference.pointer, _id_getPi as jni$_.JMethodIDPtr) .doubleFloat; } @@ -556,22 +797,22 @@ class Example extends _$jni.JObject { r'()C', ); - static final _getAsterisk = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getAsterisk = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticCharMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public char getAsterisk()` static int getAsterisk() { return _getAsterisk( - _class.reference.pointer, _id_getAsterisk as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_getAsterisk as jni$_.JMethodIDPtr) .char; } @@ -580,23 +821,23 @@ class Example extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public java.lang.String getName()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString getName() { - return _getName(_class.reference.pointer, _id_getName as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + static jni$_.JString? getName() { + return _getName(_class.reference.pointer, _id_getName as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_getNestedInstance = _class.staticMethodId( @@ -604,24 +845,24 @@ class Example extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;', ); - static final _getNestedInstance = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNestedInstance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `static public com.github.dart_lang.jnigen.simple_package.Example.Nested getNestedInstance()` + /// from: `static public com.github.dart_lang.jnigen.simple_package.Example$Nested getNestedInstance()` /// The returned object must be released after use, by calling the [release] method. - static Example_Nested getNestedInstance() { + static Example$Nested? getNestedInstance() { return _getNestedInstance(_class.reference.pointer, - _id_getNestedInstance as _$jni.JMethodIDPtr) - .object(const $Example_Nested$Type()); + _id_getNestedInstance as jni$_.JMethodIDPtr) + .object(const $Example$Nested$NullableType()); } static final _id_setAmount = _class.staticMethodId( @@ -629,21 +870,20 @@ class Example extends _$jni.JObject { r'(I)V', ); - static final _setAmount = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + static final _setAmount = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( 'globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `static public void setAmount(int newAmount)` + /// from: `static public void setAmount(int i)` static void setAmount( - int newAmount, + int i, ) { - _setAmount(_class.reference.pointer, _id_setAmount as _$jni.JMethodIDPtr, - newAmount) + _setAmount(_class.reference.pointer, _id_setAmount as jni$_.JMethodIDPtr, i) .check(); } @@ -652,23 +892,24 @@ class Example extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setName = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public void setName(java.lang.String newName)` + /// from: `static public void setName(java.lang.String string)` static void setName( - _$jni.JString newName, + jni$_.JString? string, ) { - _setName(_class.reference.pointer, _id_setName as _$jni.JMethodIDPtr, - newName.reference.pointer) + final _$string = string?.reference ?? jni$_.jNullReference; + _setName(_class.reference.pointer, _id_setName as jni$_.JMethodIDPtr, + _$string.pointer) .check(); } @@ -677,25 +918,24 @@ class Example extends _$jni.JObject { r'(Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;)V', ); - static final _setNestedInstance = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setNestedInstance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public void setNestedInstance(com.github.dart_lang.jnigen.simple_package.Example.Nested newNested)` + /// from: `static public void setNestedInstance(com.github.dart_lang.jnigen.simple_package.Example$Nested nested)` static void setNestedInstance( - Example_Nested newNested, + Example$Nested? nested, ) { - _setNestedInstance( - _class.reference.pointer, - _id_setNestedInstance as _$jni.JMethodIDPtr, - newNested.reference.pointer) + final _$nested = nested?.reference ?? jni$_.jNullReference; + _setNestedInstance(_class.reference.pointer, + _id_setNestedInstance as jni$_.JMethodIDPtr, _$nested.pointer) .check(); } @@ -704,31 +944,31 @@ class Example extends _$jni.JObject { r'(IIII)I', ); - static final _max4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _max4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, int)>(); - /// from: `static public int max4(int a, int b, int c, int d)` + /// from: `static public int max4(int i, int i1, int i2, int i3)` static int max4( - int a, - int b, - int c, - int d, + int i, + int i1, + int i2, + int i3, ) { - return _max4(_class.reference.pointer, _id_max4 as _$jni.JMethodIDPtr, a, b, - c, d) + return _max4(_class.reference.pointer, _id_max4 as jni$_.JMethodIDPtr, i, + i1, i2, i3) .integer; } @@ -737,39 +977,39 @@ class Example extends _$jni.JObject { r'(IIIIIIII)I', ); - static final _max8 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _max8 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, int, int, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, int, int, int, int, int)>(); - /// from: `static public int max8(int a, int b, int c, int d, int e, int f, int g, int h)` + /// from: `static public int max8(int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7)` static int max8( - int a, - int b, - int c, - int d, - int e, - int f, - int g, - int h, + int i, + int i1, + int i2, + int i3, + int i4, + int i5, + int i6, + int i7, ) { - return _max8(_class.reference.pointer, _id_max8 as _$jni.JMethodIDPtr, a, b, - c, d, e, f, g, h) + return _max8(_class.reference.pointer, _id_max8 as jni$_.JMethodIDPtr, i, + i1, i2, i3, i4, i5, i6, i7) .integer; } @@ -778,21 +1018,21 @@ class Example extends _$jni.JObject { r'()I', ); - static final _getNumber = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getNumber = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int getNumber()` int getNumber() { - return _getNumber(reference.pointer, _id_getNumber as _$jni.JMethodIDPtr) + return _getNumber(reference.pointer, _id_getNumber as jni$_.JMethodIDPtr) .integer; } @@ -801,21 +1041,21 @@ class Example extends _$jni.JObject { r'(I)V', ); - static final _setNumber = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setNumber = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void setNumber(int number)` + /// from: `public void setNumber(int i)` void setNumber( - int number, + int i, ) { - _setNumber(reference.pointer, _id_setNumber as _$jni.JMethodIDPtr, number) + _setNumber(reference.pointer, _id_setNumber as jni$_.JMethodIDPtr, i) .check(); } @@ -824,21 +1064,21 @@ class Example extends _$jni.JObject { r'()Z', ); - static final _getIsUp = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getIsUp = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallBooleanMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public boolean getIsUp()` bool getIsUp() { - return _getIsUp(reference.pointer, _id_getIsUp as _$jni.JMethodIDPtr) + return _getIsUp(reference.pointer, _id_getIsUp as jni$_.JMethodIDPtr) .boolean; } @@ -847,21 +1087,21 @@ class Example extends _$jni.JObject { r'(Z)V', ); - static final _setUp = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _setUp = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void setUp(boolean isUp)` + /// from: `public void setUp(boolean z)` void setUp( - bool isUp, + bool z, ) { - _setUp(reference.pointer, _id_setUp as _$jni.JMethodIDPtr, isUp ? 1 : 0) + _setUp(reference.pointer, _id_setUp as jni$_.JMethodIDPtr, z ? 1 : 0) .check(); } @@ -870,24 +1110,24 @@ class Example extends _$jni.JObject { r'()Ljava/lang/String;', ); - static final _getCodename = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getCodename = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.String getCodename()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getCodename() { + jni$_.JString? getCodename() { return _getCodename( - reference.pointer, _id_getCodename as _$jni.JMethodIDPtr) - .object(const _$jni.JStringType()); + reference.pointer, _id_getCodename as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); } static final _id_setCodename = _class.instanceMethodId( @@ -895,23 +1135,24 @@ class Example extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _setCodename = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setCodename = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void setCodename(java.lang.String codename)` + /// from: `public void setCodename(java.lang.String string)` void setCodename( - _$jni.JString codename, + jni$_.JString? string, ) { - _setCodename(reference.pointer, _id_setCodename as _$jni.JMethodIDPtr, - codename.reference.pointer) + final _$string = string?.reference ?? jni$_.jNullReference; + _setCodename(reference.pointer, _id_setCodename as jni$_.JMethodIDPtr, + _$string.pointer) .check(); } @@ -920,23 +1161,23 @@ class Example extends _$jni.JObject { r'()Ljava/util/Random;', ); - static final _getRandom = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getRandom = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.util.Random getRandom()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getRandom() { - return _getRandom(reference.pointer, _id_getRandom as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + jni$_.JObject? getRandom() { + return _getRandom(reference.pointer, _id_getRandom as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_setRandom = _class.instanceMethodId( @@ -944,23 +1185,24 @@ class Example extends _$jni.JObject { r'(Ljava/util/Random;)V', ); - static final _setRandom = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _setRandom = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public void setRandom(java.util.Random random)` void setRandom( - _$jni.JObject random, + jni$_.JObject? random, ) { - _setRandom(reference.pointer, _id_setRandom as _$jni.JMethodIDPtr, - random.reference.pointer) + final _$random = random?.reference ?? jni$_.jNullReference; + _setRandom(reference.pointer, _id_setRandom as jni$_.JMethodIDPtr, + _$random.pointer) .check(); } @@ -969,22 +1211,22 @@ class Example extends _$jni.JObject { r'()J', ); - static final _getRandomLong = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getRandomLong = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public long getRandomLong()` int getRandomLong() { return _getRandomLong( - reference.pointer, _id_getRandomLong as _$jni.JMethodIDPtr) + reference.pointer, _id_getRandomLong as jni$_.JMethodIDPtr) .long; } @@ -993,31 +1235,31 @@ class Example extends _$jni.JObject { r'(JJJJ)J', ); - static final _add4Longs = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _add4Longs = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int64, - _$jni.Int64, - _$jni.Int64, - _$jni.Int64 + jni$_.Int64, + jni$_.Int64, + jni$_.Int64, + jni$_.Int64 )>)>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, int)>(); - /// from: `public long add4Longs(long a, long b, long c, long d)` + /// from: `public long add4Longs(long j, long j1, long j2, long j3)` int add4Longs( - int a, - int b, - int c, - int d, + int j, + int j1, + int j2, + int j3, ) { - return _add4Longs( - reference.pointer, _id_add4Longs as _$jni.JMethodIDPtr, a, b, c, d) + return _add4Longs(reference.pointer, _id_add4Longs as jni$_.JMethodIDPtr, j, + j1, j2, j3) .long; } @@ -1026,39 +1268,39 @@ class Example extends _$jni.JObject { r'(JJJJJJJJ)J', ); - static final _add8Longs = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _add8Longs = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int64, - _$jni.Int64, - _$jni.Int64, - _$jni.Int64, - _$jni.Int64, - _$jni.Int64, - _$jni.Int64, - _$jni.Int64 + jni$_.Int64, + jni$_.Int64, + jni$_.Int64, + jni$_.Int64, + jni$_.Int64, + jni$_.Int64, + jni$_.Int64, + jni$_.Int64 )>)>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, int, int, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, int, int, int, int, int)>(); - /// from: `public long add8Longs(long a, long b, long c, long d, long e, long f, long g, long h)` + /// from: `public long add8Longs(long j, long j1, long j2, long j3, long j4, long j5, long j6, long j7)` int add8Longs( - int a, - int b, - int c, - int d, - int e, - int f, - int g, - int h, + int j, + int j1, + int j2, + int j3, + int j4, + int j5, + int j6, + int j7, ) { - return _add8Longs(reference.pointer, _id_add8Longs as _$jni.JMethodIDPtr, a, - b, c, d, e, f, g, h) + return _add8Longs(reference.pointer, _id_add8Longs as jni$_.JMethodIDPtr, j, + j1, j2, j3, j4, j5, j6, j7) .long; } @@ -1067,27 +1309,26 @@ class Example extends _$jni.JObject { r'(Ljava/util/Random;)Ljava/lang/String;', ); - static final _getRandomNumericString = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _getRandomNumericString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); /// from: `public java.lang.String getRandomNumericString(java.util.Random random)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString getRandomNumericString( - _$jni.JObject random, + jni$_.JString? getRandomNumericString( + jni$_.JObject? random, ) { - return _getRandomNumericString( - reference.pointer, - _id_getRandomNumericString as _$jni.JMethodIDPtr, - random.reference.pointer) - .object(const _$jni.JStringType()); + final _$random = random?.reference ?? jni$_.jNullReference; + return _getRandomNumericString(reference.pointer, + _id_getRandomNumericString as jni$_.JMethodIDPtr, _$random.pointer) + .object(const jni$_.JStringNullableType()); } static final _id_finalMethod = _class.instanceMethodId( @@ -1095,21 +1336,21 @@ class Example extends _$jni.JObject { r'()V', ); - static final _finalMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _finalMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public final void finalMethod()` void finalMethod() { - _finalMethod(reference.pointer, _id_finalMethod as _$jni.JMethodIDPtr) + _finalMethod(reference.pointer, _id_finalMethod as jni$_.JMethodIDPtr) .check(); } @@ -1118,23 +1359,25 @@ class Example extends _$jni.JObject { r'()Ljava/util/List;', ); - static final _getList = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `public java.util.List getList()` + /// from: `public java.util.List getList()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JList<_$jni.JString> getList() { - return _getList(reference.pointer, _id_getList as _$jni.JMethodIDPtr) - .object(const _$jni.JListType(_$jni.JStringType())); + jni$_.JList? getList() { + return _getList(reference.pointer, _id_getList as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JListNullableType( + jni$_.JStringNullableType())); } static final _id_joinStrings = _class.instanceMethodId( @@ -1142,37 +1385,37 @@ class Example extends _$jni.JObject { r'(Ljava/util/List;Ljava/lang/String;)Ljava/lang/String;', ); - static final _joinStrings = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _joinStrings = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `public java.lang.String joinStrings(java.util.List values, java.lang.String delim)` + /// from: `public java.lang.String joinStrings(java.util.List list, java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - /// - /// Joins the strings in the list using the given delimiter. - _$jni.JString joinStrings( - _$jni.JList<_$jni.JString> values, - _$jni.JString delim, + jni$_.JString? joinStrings( + jni$_.JList? list, + jni$_.JString? string, ) { + final _$list = list?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; return _joinStrings( reference.pointer, - _id_joinStrings as _$jni.JMethodIDPtr, - values.reference.pointer, - delim.reference.pointer) - .object(const _$jni.JStringType()); + _id_joinStrings as jni$_.JMethodIDPtr, + _$list.pointer, + _$string.pointer) + .object(const jni$_.JStringNullableType()); } static final _id_methodWithSeveralParams = _class.instanceMethodId( @@ -1180,54 +1423,55 @@ class Example extends _$jni.JObject { r'(CLjava/lang/String;[ILjava/lang/CharSequence;Ljava/util/List;Ljava/util/Map;)V', ); - static final _methodWithSeveralParams = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _methodWithSeveralParams = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, int, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `public void methodWithSeveralParams(char ch, java.lang.String s, int[] a, T t, java.util.List lt, java.util.Map wm)` - void methodWithSeveralParams<$T extends _$jni.JObject>( - int ch, - _$jni.JString s, - _$jni.JArray<_$jni.jint> a, - $T t, - _$jni.JList<$T> lt, - _$jni.JMap<_$jni.JString, _$jni.JObject> wm, { - _$jni.JObjType<$T>? T, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void methodWithSeveralParams(char c, java.lang.String string, java.lang.Object[] is, T charSequence, java.util.List list, java.util.Map map)` + void methodWithSeveralParams<$T extends jni$_.JObject?>( + int c, + jni$_.JString? string, + jni$_.JIntArray? is$, + $T? charSequence, + jni$_.JList<$T?>? list, + jni$_.JMap? map, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - (lt.$type as _$jni.JListType<_$core.dynamic>).E, - t.$type, - ]) as _$jni.JObjType<$T>; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + final _$charSequence = charSequence?.reference ?? jni$_.jNullReference; + final _$list = list?.reference ?? jni$_.jNullReference; + final _$map = map?.reference ?? jni$_.jNullReference; _methodWithSeveralParams( reference.pointer, - _id_methodWithSeveralParams as _$jni.JMethodIDPtr, - ch, - s.reference.pointer, - a.reference.pointer, - t.reference.pointer, - lt.reference.pointer, - wm.reference.pointer) + _id_methodWithSeveralParams as jni$_.JMethodIDPtr, + c, + _$string.pointer, + _$is$.pointer, + _$charSequence.pointer, + _$list.pointer, + _$map.pointer) .check(); } @@ -1235,23 +1479,23 @@ class Example extends _$jni.JObject { r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Example() { return Example.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -1259,49 +1503,49 @@ class Example extends _$jni.JObject { r'(I)V', ); - static final _new$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_NewObject') + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void (int number)` + /// from: `public void (int i)` /// The returned object must be released after use, by calling the [release] method. factory Example.new$1( - int number, + int i, ) { - return Example.fromReference(_new$1( - _class.reference.pointer, _id_new$1 as _$jni.JMethodIDPtr, number) - .reference); + return Example.fromReference( + _new$1(_class.reference.pointer, _id_new$1 as jni$_.JMethodIDPtr, i) + .reference); } static final _id_new$2 = _class.constructorId( r'(IZ)V', ); - static final _new$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32, _$jni.Int32)>)>>( + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); - /// from: `public void (int number, boolean isUp)` + /// from: `public void (int i, boolean z)` /// The returned object must be released after use, by calling the [release] method. factory Example.new$2( - int number, - bool isUp, + int i, + bool z, ) { return Example.fromReference(_new$2(_class.reference.pointer, - _id_new$2 as _$jni.JMethodIDPtr, number, isUp ? 1 : 0) + _id_new$2 as jni$_.JMethodIDPtr, i, z ? 1 : 0) .reference); } @@ -1309,34 +1553,31 @@ class Example extends _$jni.JObject { r'(IZLjava/lang/String;)V', ); - static final _new$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Int32, - _$jni.Pointer<_$jni.Void> + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, jni$_.Pointer)>(); - /// from: `public void (int number, boolean isUp, java.lang.String codename)` + /// from: `public void (int i, boolean z, java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. factory Example.new$3( - int number, - bool isUp, - _$jni.JString codename, + int i, + bool z, + jni$_.JString? string, ) { - return Example.fromReference(_new$3( - _class.reference.pointer, - _id_new$3 as _$jni.JMethodIDPtr, - number, - isUp ? 1 : 0, - codename.reference.pointer) + final _$string = string?.reference ?? jni$_.jNullReference; + return Example.fromReference(_new$3(_class.reference.pointer, + _id_new$3 as jni$_.JMethodIDPtr, i, z ? 1 : 0, _$string.pointer) .reference); } @@ -1344,40 +1585,40 @@ class Example extends _$jni.JObject { r'(IIIIIIII)V', ); - static final _new$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, int, int, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, int, int, int, int, int)>(); - /// from: `public void (int a, int b, int c, int d, int e, int f, int g, int h)` + /// from: `public void (int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7)` /// The returned object must be released after use, by calling the [release] method. factory Example.new$4( - int a, - int b, - int c, - int d, - int e, - int f, - int g, - int h, + int i, + int i1, + int i2, + int i3, + int i4, + int i5, + int i6, + int i7, ) { return Example.fromReference(_new$4(_class.reference.pointer, - _id_new$4 as _$jni.JMethodIDPtr, a, b, c, d, e, f, g, h) + _id_new$4 as jni$_.JMethodIDPtr, i, i1, i2, i3, i4, i5, i6, i7) .reference); } @@ -1386,22 +1627,22 @@ class Example extends _$jni.JObject { r'()I', ); - static final _whichExample = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _whichExample = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int whichExample()` int whichExample() { return _whichExample( - reference.pointer, _id_whichExample as _$jni.JMethodIDPtr) + reference.pointer, _id_whichExample as jni$_.JMethodIDPtr) .integer; } @@ -1410,24 +1651,24 @@ class Example extends _$jni.JObject { r'(II)I', ); - static final _addInts = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32, _$jni.Int32)>)>>( + static final _addInts = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( 'globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); - /// from: `static public int addInts(int a, int b)` + /// from: `static public int addInts(int i, int i1)` static int addInts( - int a, - int b, + int i, + int i1, ) { return _addInts( - _class.reference.pointer, _id_addInts as _$jni.JMethodIDPtr, a, b) + _class.reference.pointer, _id_addInts as jni$_.JMethodIDPtr, i, i1) .integer; } @@ -1436,23 +1677,23 @@ class Example extends _$jni.JObject { r'()[I', ); - static final _getArr = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getArr = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public int[] getArr()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray<_$jni.jint> getArr() { - return _getArr(_class.reference.pointer, _id_getArr as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jintType())); + static jni$_.JIntArray? getArr() { + return _getArr(_class.reference.pointer, _id_getArr as jni$_.JMethodIDPtr) + .object(const jni$_.JIntArrayNullableType()); } static final _id_addAll = _class.staticMethodId( @@ -1460,23 +1701,24 @@ class Example extends _$jni.JObject { r'([I)I', ); - static final _addAll = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _addAll = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public int addAll(int[] arr)` + /// from: `static public int addAll(int[] is)` static int addAll( - _$jni.JArray<_$jni.jint> arr, + jni$_.JIntArray? is$, ) { - return _addAll(_class.reference.pointer, _id_addAll as _$jni.JMethodIDPtr, - arr.reference.pointer) + final _$is$ = is$?.reference ?? jni$_.jNullReference; + return _addAll(_class.reference.pointer, _id_addAll as jni$_.JMethodIDPtr, + _$is$.pointer) .integer; } @@ -1485,23 +1727,23 @@ class Example extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/simple_package/Example;', ); - static final _getSelf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _getSelf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public com.github.dart_lang.jnigen.simple_package.Example getSelf()` /// The returned object must be released after use, by calling the [release] method. - Example getSelf() { - return _getSelf(reference.pointer, _id_getSelf as _$jni.JMethodIDPtr) - .object(const $Example$Type()); + Example? getSelf() { + return _getSelf(reference.pointer, _id_getSelf as jni$_.JMethodIDPtr) + .object(const $Example$NullableType()); } static final _id_throwException = _class.staticMethodId( @@ -1509,22 +1751,22 @@ class Example extends _$jni.JObject { r'()V', ); - static final _throwException = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _throwException = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public void throwException()` static void throwException() { _throwException( - _class.reference.pointer, _id_throwException as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_throwException as jni$_.JMethodIDPtr) .check(); } @@ -1533,21 +1775,21 @@ class Example extends _$jni.JObject { r'()V', ); - static final _overloaded = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _overloaded = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void overloaded()` void overloaded() { - _overloaded(reference.pointer, _id_overloaded as _$jni.JMethodIDPtr) + _overloaded(reference.pointer, _id_overloaded as jni$_.JMethodIDPtr) .check(); } @@ -1556,25 +1798,26 @@ class Example extends _$jni.JObject { r'(ILjava/lang/String;)V', ); - static final _overloaded$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni - .VarArgs<(_$jni.Int32, _$jni.Pointer<_$jni.Void>)>)>>( + static final _overloaded$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32, jni$_.Pointer)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); - /// from: `public void overloaded(int a, java.lang.String b)` + /// from: `public void overloaded(int i, java.lang.String string)` void overloaded$1( - int a, - _$jni.JString b, + int i, + jni$_.JString? string, ) { - _overloaded$1(reference.pointer, _id_overloaded$1 as _$jni.JMethodIDPtr, a, - b.reference.pointer) + final _$string = string?.reference ?? jni$_.jNullReference; + _overloaded$1(reference.pointer, _id_overloaded$1 as jni$_.JMethodIDPtr, i, + _$string.pointer) .check(); } @@ -1583,21 +1826,21 @@ class Example extends _$jni.JObject { r'(I)V', ); - static final _overloaded$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + static final _overloaded$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void overloaded(int a)` + /// from: `public void overloaded(int i)` void overloaded$2( - int a, + int i, ) { - _overloaded$2(reference.pointer, _id_overloaded$2 as _$jni.JMethodIDPtr, a) + _overloaded$2(reference.pointer, _id_overloaded$2 as jni$_.JMethodIDPtr, i) .check(); } @@ -1606,30 +1849,32 @@ class Example extends _$jni.JObject { r'(Ljava/util/List;Ljava/lang/String;)V', ); - static final _overloaded$3 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _overloaded$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `public void overloaded(java.util.List a, java.lang.String b)` + /// from: `public void overloaded(java.util.List list, java.lang.String string)` void overloaded$3( - _$jni.JList<_$jni.JInteger> a, - _$jni.JString b, + jni$_.JList? list, + jni$_.JString? string, ) { - _overloaded$3(reference.pointer, _id_overloaded$3 as _$jni.JMethodIDPtr, - a.reference.pointer, b.reference.pointer) + final _$list = list?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _overloaded$3(reference.pointer, _id_overloaded$3 as jni$_.JMethodIDPtr, + _$list.pointer, _$string.pointer) .check(); } @@ -1638,96 +1883,140 @@ class Example extends _$jni.JObject { r'(Ljava/util/List;)V', ); - static final _overloaded$4 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _overloaded$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void overloaded(java.util.List a)` + /// from: `public void overloaded(java.util.List list)` void overloaded$4( - _$jni.JList<_$jni.JInteger> a, + jni$_.JList? list, ) { - _overloaded$4(reference.pointer, _id_overloaded$4 as _$jni.JMethodIDPtr, - a.reference.pointer) + final _$list = list?.reference ?? jni$_.jNullReference; + _overloaded$4(reference.pointer, _id_overloaded$4 as jni$_.JMethodIDPtr, + _$list.pointer) .check(); } } -final class $Example$Type extends _$jni.JObjType { - @_$jni.internal - const $Example$Type(); +final class $Example$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Example$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Example;'; - @_$jni.internal - @_$core.override - Example fromReference(_$jni.JReference reference) => - Example.fromReference(reference); + @jni$_.internal + @core$_.override + Example? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Example.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Example$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Example$NullableType) && + other is $Example$NullableType; + } +} + +final class $Example$Type extends jni$_.JObjType { + @jni$_.internal + const $Example$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Example;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Example fromReference(jni$_.JReference reference) => Example.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Example$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Example$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Example$Type) && other is $Example$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Exceptions` -class Exceptions extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Exceptions extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Exceptions.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Exceptions'); /// The type which includes information such as the signature of this class. + static const nullableType = $Exceptions$NullableType(); static const type = $Exceptions$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Exceptions() { return Exceptions.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -1735,23 +2024,23 @@ class Exceptions extends _$jni.JObject { r'(F)V', ); - static final _new$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_NewObject') + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Double,)>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); - /// from: `public void (float x)` + /// from: `public void (float f)` /// The returned object must be released after use, by calling the [release] method. factory Exceptions.new$1( - double x, + double f, ) { return Exceptions.fromReference( - _new$1(_class.reference.pointer, _id_new$1 as _$jni.JMethodIDPtr, x) + _new$1(_class.reference.pointer, _id_new$1 as jni$_.JMethodIDPtr, f) .reference); } @@ -1759,36 +2048,36 @@ class Exceptions extends _$jni.JObject { r'(IIIIII)V', ); - static final _new$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32 + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, int, int, int)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, int, int, int)>(); - /// from: `public void (int a, int b, int c, int d, int e, int f)` + /// from: `public void (int i, int i1, int i2, int i3, int i4, int i5)` /// The returned object must be released after use, by calling the [release] method. factory Exceptions.new$2( - int a, - int b, - int c, - int d, - int e, - int f, + int i, + int i1, + int i2, + int i3, + int i4, + int i5, ) { return Exceptions.fromReference(_new$2(_class.reference.pointer, - _id_new$2 as _$jni.JMethodIDPtr, a, b, c, d, e, f) + _id_new$2 as jni$_.JMethodIDPtr, i, i1, i2, i3, i4, i5) .reference); } @@ -1797,24 +2086,24 @@ class Exceptions extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _staticObjectMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _staticObjectMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public java.lang.Object staticObjectMethod()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JObject staticObjectMethod() { + static jni$_.JObject? staticObjectMethod() { return _staticObjectMethod(_class.reference.pointer, - _id_staticObjectMethod as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_staticObjectMethod as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_staticIntMethod = _class.staticMethodId( @@ -1822,22 +2111,22 @@ class Exceptions extends _$jni.JObject { r'()I', ); - static final _staticIntMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _staticIntMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public int staticIntMethod()` static int staticIntMethod() { return _staticIntMethod( - _class.reference.pointer, _id_staticIntMethod as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_staticIntMethod as jni$_.JMethodIDPtr) .integer; } @@ -1846,24 +2135,26 @@ class Exceptions extends _$jni.JObject { r'()[Ljava/lang/Object;', ); - static final _staticObjectArrayMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _staticObjectArrayMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public java.lang.Object[] staticObjectArrayMethod()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray<_$jni.JObject> staticObjectArrayMethod() { + static jni$_.JArray? staticObjectArrayMethod() { return _staticObjectArrayMethod(_class.reference.pointer, - _id_staticObjectArrayMethod as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.JObjectType())); + _id_staticObjectArrayMethod as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JObjectNullableType())); } static final _id_staticIntArrayMethod = _class.staticMethodId( @@ -1871,24 +2162,24 @@ class Exceptions extends _$jni.JObject { r'()[I', ); - static final _staticIntArrayMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _staticIntArrayMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public int[] staticIntArrayMethod()` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray<_$jni.jint> staticIntArrayMethod() { + static jni$_.JIntArray? staticIntArrayMethod() { return _staticIntArrayMethod(_class.reference.pointer, - _id_staticIntArrayMethod as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jintType())); + _id_staticIntArrayMethod as jni$_.JMethodIDPtr) + .object(const jni$_.JIntArrayNullableType()); } static final _id_objectMethod = _class.instanceMethodId( @@ -1896,24 +2187,24 @@ class Exceptions extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _objectMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _objectMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object objectMethod()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject objectMethod() { + jni$_.JObject? objectMethod() { return _objectMethod( - reference.pointer, _id_objectMethod as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + reference.pointer, _id_objectMethod as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_intMethod = _class.instanceMethodId( @@ -1921,21 +2212,21 @@ class Exceptions extends _$jni.JObject { r'()I', ); - static final _intMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _intMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int intMethod()` int intMethod() { - return _intMethod(reference.pointer, _id_intMethod as _$jni.JMethodIDPtr) + return _intMethod(reference.pointer, _id_intMethod as jni$_.JMethodIDPtr) .integer; } @@ -1944,24 +2235,26 @@ class Exceptions extends _$jni.JObject { r'()[Ljava/lang/Object;', ); - static final _objectArrayMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _objectArrayMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.lang.Object[] objectArrayMethod()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<_$jni.JObject> objectArrayMethod() { + jni$_.JArray? objectArrayMethod() { return _objectArrayMethod( - reference.pointer, _id_objectArrayMethod as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.JObjectType())); + reference.pointer, _id_objectArrayMethod as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JObjectNullableType())); } static final _id_intArrayMethod = _class.instanceMethodId( @@ -1969,24 +2262,24 @@ class Exceptions extends _$jni.JObject { r'()[I', ); - static final _intArrayMethod = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _intArrayMethod = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int[] intArrayMethod()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<_$jni.jint> intArrayMethod() { + jni$_.JIntArray? intArrayMethod() { return _intArrayMethod( - reference.pointer, _id_intArrayMethod as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType(_$jni.jintType())); + reference.pointer, _id_intArrayMethod as jni$_.JMethodIDPtr) + .object(const jni$_.JIntArrayNullableType()); } static final _id_throwNullPointerException = _class.instanceMethodId( @@ -1994,22 +2287,22 @@ class Exceptions extends _$jni.JObject { r'()I', ); - static final _throwNullPointerException = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _throwNullPointerException = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int throwNullPointerException()` int throwNullPointerException() { return _throwNullPointerException(reference.pointer, - _id_throwNullPointerException as _$jni.JMethodIDPtr) + _id_throwNullPointerException as jni$_.JMethodIDPtr) .integer; } @@ -2019,24 +2312,24 @@ class Exceptions extends _$jni.JObject { ); static final _throwFileNotFoundException = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.io.InputStream throwFileNotFoundException()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject throwFileNotFoundException() { + jni$_.JObject? throwFileNotFoundException() { return _throwFileNotFoundException(reference.pointer, - _id_throwFileNotFoundException as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_throwFileNotFoundException as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_throwClassCastException = _class.instanceMethodId( @@ -2044,24 +2337,24 @@ class Exceptions extends _$jni.JObject { r'()Ljava/io/FileInputStream;', ); - static final _throwClassCastException = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _throwClassCastException = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public java.io.FileInputStream throwClassCastException()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject throwClassCastException() { + jni$_.JObject? throwClassCastException() { return _throwClassCastException(reference.pointer, - _id_throwClassCastException as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + _id_throwClassCastException as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } static final _id_throwArrayIndexException = _class.instanceMethodId( @@ -2069,22 +2362,22 @@ class Exceptions extends _$jni.JObject { r'()I', ); - static final _throwArrayIndexException = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _throwArrayIndexException = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int throwArrayIndexException()` int throwArrayIndexException() { return _throwArrayIndexException(reference.pointer, - _id_throwArrayIndexException as _$jni.JMethodIDPtr) + _id_throwArrayIndexException as jni$_.JMethodIDPtr) .integer; } @@ -2093,22 +2386,22 @@ class Exceptions extends _$jni.JObject { r'()I', ); - static final _throwArithmeticException = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _throwArithmeticException = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int throwArithmeticException()` int throwArithmeticException() { return _throwArithmeticException(reference.pointer, - _id_throwArithmeticException as _$jni.JMethodIDPtr) + _id_throwArithmeticException as jni$_.JMethodIDPtr) .integer; } @@ -2117,85 +2410,130 @@ class Exceptions extends _$jni.JObject { r'()V', ); - static final _throwLoremIpsum = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _throwLoremIpsum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `static public void throwLoremIpsum()` static void throwLoremIpsum() { _throwLoremIpsum( - _class.reference.pointer, _id_throwLoremIpsum as _$jni.JMethodIDPtr) + _class.reference.pointer, _id_throwLoremIpsum as jni$_.JMethodIDPtr) .check(); } } -final class $Exceptions$Type extends _$jni.JObjType { - @_$jni.internal - const $Exceptions$Type(); +final class $Exceptions$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Exceptions$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Exceptions;'; - @_$jni.internal - @_$core.override - Exceptions fromReference(_$jni.JReference reference) => - Exceptions.fromReference(reference); + @jni$_.internal + @core$_.override + Exceptions? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Exceptions.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Exceptions$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Exceptions$NullableType) && + other is $Exceptions$NullableType; + } +} + +final class $Exceptions$Type extends jni$_.JObjType { + @jni$_.internal + const $Exceptions$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Exceptions;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Exceptions fromReference(jni$_.JReference reference) => + Exceptions.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Exceptions$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Exceptions$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Exceptions$Type) && other is $Exceptions$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Fields$Nested` -class Fields_Nested extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - Fields_Nested.fromReference( - _$jni.JReference reference, +class Fields$Nested extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Fields$Nested.fromReference( + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Fields$Nested'); /// The type which includes information such as the signature of this class. - static const type = $Fields_Nested$Type(); + static const nullableType = $Fields$Nested$NullableType(); + static const type = $Fields$Nested$Type(); static final _id_hundred = _class.instanceFieldId( r'hundred', r'J', ); /// from: `public long hundred` - int get hundred => _id_hundred.get(this, const _$jni.jlongType()); + int get hundred => _id_hundred.get(this, const jni$_.jlongType()); /// from: `public long hundred` set hundred(int value) => - _id_hundred.set(this, const _$jni.jlongType(), value); + _id_hundred.set(this, const jni$_.jlongType(), value); static final _id_BEST_GOD = _class.staticFieldId( r'BEST_GOD', @@ -2204,87 +2542,132 @@ class Fields_Nested extends _$jni.JObject { /// from: `static public java.lang.String BEST_GOD` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get BEST_GOD => - _id_BEST_GOD.get(_class, const _$jni.JStringType()); + static jni$_.JString? get BEST_GOD => + _id_BEST_GOD.get(_class, const jni$_.JStringNullableType()); /// from: `static public java.lang.String BEST_GOD` /// The returned object must be released after use, by calling the [release] method. - static set BEST_GOD(_$jni.JString value) => - _id_BEST_GOD.set(_class, const _$jni.JStringType(), value); + static set BEST_GOD(jni$_.JString? value) => + _id_BEST_GOD.set(_class, const jni$_.JStringNullableType(), value); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. - factory Fields_Nested() { - return Fields_Nested.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + factory Fields$Nested() { + return Fields$Nested.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $Fields_Nested$Type extends _$jni.JObjType { - @_$jni.internal - const $Fields_Nested$Type(); +final class $Fields$Nested$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Fields$Nested$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Fields$Nested;'; - @_$jni.internal - @_$core.override - Fields_Nested fromReference(_$jni.JReference reference) => - Fields_Nested.fromReference(reference); + @jni$_.internal + @core$_.override + Fields$Nested? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Fields$Nested.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Fields$Nested$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Fields$Nested$NullableType) && + other is $Fields$Nested$NullableType; + } +} - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); +final class $Fields$Nested$Type extends jni$_.JObjType { + @jni$_.internal + const $Fields$Nested$Type(); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Fields$Nested;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Fields$Nested fromReference(jni$_.JReference reference) => + Fields$Nested.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Fields$Nested$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($Fields_Nested$Type).hashCode; + @core$_.override + int get hashCode => ($Fields$Nested$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($Fields_Nested$Type) && - other is $Fields_Nested$Type; + return other.runtimeType == ($Fields$Nested$Type) && + other is $Fields$Nested$Type; } } /// from: `com.github.dart_lang.jnigen.simple_package.Fields` -class Fields extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Fields extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Fields.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/simple_package/Fields'); /// The type which includes information such as the signature of this class. + static const nullableType = $Fields$NullableType(); static const type = $Fields$Type(); static final _id_amount = _class.staticFieldId( r'amount', @@ -2292,11 +2675,11 @@ class Fields extends _$jni.JObject { ); /// from: `static public int amount` - static int get amount => _id_amount.get(_class, const _$jni.jintType()); + static int get amount => _id_amount.get(_class, const jni$_.jintType()); /// from: `static public int amount` static set amount(int value) => - _id_amount.set(_class, const _$jni.jintType(), value); + _id_amount.set(_class, const jni$_.jintType(), value); static final _id_pi = _class.staticFieldId( r'pi', @@ -2304,11 +2687,11 @@ class Fields extends _$jni.JObject { ); /// from: `static public double pi` - static double get pi => _id_pi.get(_class, const _$jni.jdoubleType()); + static double get pi => _id_pi.get(_class, const jni$_.jdoubleType()); /// from: `static public double pi` static set pi(double value) => - _id_pi.set(_class, const _$jni.jdoubleType(), value); + _id_pi.set(_class, const jni$_.jdoubleType(), value); static final _id_asterisk = _class.staticFieldId( r'asterisk', @@ -2316,11 +2699,11 @@ class Fields extends _$jni.JObject { ); /// from: `static public char asterisk` - static int get asterisk => _id_asterisk.get(_class, const _$jni.jcharType()); + static int get asterisk => _id_asterisk.get(_class, const jni$_.jcharType()); /// from: `static public char asterisk` static set asterisk(int value) => - _id_asterisk.set(_class, const _$jni.jcharType(), value); + _id_asterisk.set(_class, const jni$_.jcharType(), value); static final _id_name = _class.staticFieldId( r'name', @@ -2329,13 +2712,13 @@ class Fields extends _$jni.JObject { /// from: `static public java.lang.String name` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JString get name => - _id_name.get(_class, const _$jni.JStringType()); + static jni$_.JString? get name => + _id_name.get(_class, const jni$_.JStringNullableType()); /// from: `static public java.lang.String name` /// The returned object must be released after use, by calling the [release] method. - static set name(_$jni.JString value) => - _id_name.set(_class, const _$jni.JStringType(), value); + static set name(jni$_.JString? value) => + _id_name.set(_class, const jni$_.JStringNullableType(), value); static final _id_i = _class.instanceFieldId( r'i', @@ -2344,12 +2727,12 @@ class Fields extends _$jni.JObject { /// from: `public java.lang.Integer i` /// The returned object must be released after use, by calling the [release] method. - _$jni.JInteger get i => _id_i.get(this, const _$jni.JIntegerType()); + jni$_.JInteger? get i => _id_i.get(this, const jni$_.JIntegerNullableType()); /// from: `public java.lang.Integer i` /// The returned object must be released after use, by calling the [release] method. - set i(_$jni.JInteger value) => - _id_i.set(this, const _$jni.JIntegerType(), value); + set i(jni$_.JInteger? value) => + _id_i.set(this, const jni$_.JIntegerNullableType(), value); static final _id_trillion = _class.instanceFieldId( r'trillion', @@ -2357,11 +2740,11 @@ class Fields extends _$jni.JObject { ); /// from: `public long trillion` - int get trillion => _id_trillion.get(this, const _$jni.jlongType()); + int get trillion => _id_trillion.get(this, const jni$_.jlongType()); /// from: `public long trillion` set trillion(int value) => - _id_trillion.set(this, const _$jni.jlongType(), value); + _id_trillion.set(this, const jni$_.jlongType(), value); static final _id_isAchillesDead = _class.instanceFieldId( r'isAchillesDead', @@ -2370,11 +2753,11 @@ class Fields extends _$jni.JObject { /// from: `public boolean isAchillesDead` bool get isAchillesDead => - _id_isAchillesDead.get(this, const _$jni.jbooleanType()); + _id_isAchillesDead.get(this, const jni$_.jbooleanType()); /// from: `public boolean isAchillesDead` set isAchillesDead(bool value) => - _id_isAchillesDead.set(this, const _$jni.jbooleanType(), value); + _id_isAchillesDead.set(this, const jni$_.jbooleanType(), value); static final _id_bestFighterInGreece = _class.instanceFieldId( r'bestFighterInGreece', @@ -2383,13 +2766,13 @@ class Fields extends _$jni.JObject { /// from: `public java.lang.String bestFighterInGreece` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString get bestFighterInGreece => - _id_bestFighterInGreece.get(this, const _$jni.JStringType()); + jni$_.JString? get bestFighterInGreece => + _id_bestFighterInGreece.get(this, const jni$_.JStringNullableType()); /// from: `public java.lang.String bestFighterInGreece` /// The returned object must be released after use, by calling the [release] method. - set bestFighterInGreece(_$jni.JString value) => - _id_bestFighterInGreece.set(this, const _$jni.JStringType(), value); + set bestFighterInGreece(jni$_.JString? value) => _id_bestFighterInGreece.set( + this, const jni$_.JStringNullableType(), value); static final _id_random = _class.instanceFieldId( r'random', @@ -2398,12 +2781,13 @@ class Fields extends _$jni.JObject { /// from: `public java.util.Random random` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject get random => _id_random.get(this, const _$jni.JObjectType()); + jni$_.JObject? get random => + _id_random.get(this, const jni$_.JObjectNullableType()); /// from: `public java.util.Random random` /// The returned object must be released after use, by calling the [release] method. - set random(_$jni.JObject value) => - _id_random.set(this, const _$jni.JObjectType(), value); + set random(jni$_.JObject? value) => + _id_random.set(this, const jni$_.JObjectNullableType(), value); static final _id_euroSymbol = _class.staticFieldId( r'euroSymbol', @@ -2412,84 +2796,127 @@ class Fields extends _$jni.JObject { /// from: `static public char euroSymbol` static int get euroSymbol => - _id_euroSymbol.get(_class, const _$jni.jcharType()); + _id_euroSymbol.get(_class, const jni$_.jcharType()); /// from: `static public char euroSymbol` static set euroSymbol(int value) => - _id_euroSymbol.set(_class, const _$jni.jcharType(), value); + _id_euroSymbol.set(_class, const jni$_.jcharType(), value); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Fields() { return Fields.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $Fields$Type extends _$jni.JObjType { - @_$jni.internal - const $Fields$Type(); +final class $Fields$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Fields$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/simple_package/Fields;'; - @_$jni.internal - @_$core.override - Fields fromReference(_$jni.JReference reference) => - Fields.fromReference(reference); + @jni$_.internal + @core$_.override + Fields? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Fields.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Fields$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Fields$NullableType) && + other is $Fields$NullableType; + } +} + +final class $Fields$Type extends jni$_.JObjType { + @jni$_.internal + const $Fields$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/simple_package/Fields;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Fields fromReference(jni$_.JReference reference) => Fields.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Fields$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Fields$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Fields$Type) && other is $Fields$Type; } } /// from: `com.github.dart_lang.jnigen.pkg2.C2` -class C2 extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class C2 extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal C2.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/pkg2/C2'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/pkg2/C2'); /// The type which includes information such as the signature of this class. + static const nullableType = $C2$NullableType(); static const type = $C2$Type(); static final _id_CONSTANT = _class.staticFieldId( r'CONSTANT', @@ -2497,104 +2924,146 @@ class C2 extends _$jni.JObject { ); /// from: `static public int CONSTANT` - static int get CONSTANT => _id_CONSTANT.get(_class, const _$jni.jintType()); + static int get CONSTANT => _id_CONSTANT.get(_class, const jni$_.jintType()); /// from: `static public int CONSTANT` static set CONSTANT(int value) => - _id_CONSTANT.set(_class, const _$jni.jintType(), value); + _id_CONSTANT.set(_class, const jni$_.jintType(), value); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory C2() { return C2.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $C2$Type extends _$jni.JObjType { - @_$jni.internal - const $C2$Type(); +final class $C2$NullableType extends jni$_.JObjType { + @jni$_.internal + const $C2$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/pkg2/C2;'; - @_$jni.internal - @_$core.override - C2 fromReference(_$jni.JReference reference) => C2.fromReference(reference); + @jni$_.internal + @core$_.override + C2? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : C2.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($C2$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($C2$NullableType) && other is $C2$NullableType; + } +} + +final class $C2$Type extends jni$_.JObjType { + @jni$_.internal + const $C2$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/pkg2/C2;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + C2 fromReference(jni$_.JReference reference) => C2.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $C2$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($C2$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($C2$Type) && other is $C2$Type; } } /// from: `com.github.dart_lang.jnigen.pkg2.Example` -class Example$1 extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class Example$1 extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal Example$1.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/pkg2/Example'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/pkg2/Example'); /// The type which includes information such as the signature of this class. + static const nullableType = $Example$1$NullableType(); static const type = $Example$1$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory Example$1() { return Example$1.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -2603,87 +3072,141 @@ class Example$1 extends _$jni.JObject { r'()I', ); - static final _whichExample = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _whichExample = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int whichExample()` int whichExample() { return _whichExample( - reference.pointer, _id_whichExample as _$jni.JMethodIDPtr) + reference.pointer, _id_whichExample as jni$_.JMethodIDPtr) .integer; } } -final class $Example$1$Type extends _$jni.JObjType { - @_$jni.internal - const $Example$1$Type(); +final class $Example$1$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Example$1$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/pkg2/Example;'; - @_$jni.internal - @_$core.override - Example$1 fromReference(_$jni.JReference reference) => - Example$1.fromReference(reference); + @jni$_.internal + @core$_.override + Example$1? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Example$1.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Example$1$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Example$1$NullableType) && + other is $Example$1$NullableType; + } +} + +final class $Example$1$Type extends jni$_.JObjType { + @jni$_.internal + const $Example$1$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/pkg2/Example;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + Example$1 fromReference(jni$_.JReference reference) => + Example$1.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Example$1$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($Example$1$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($Example$1$Type) && other is $Example$1$Type; } } /// from: `com.github.dart_lang.jnigen.generics.GenericTypeParams` -class GenericTypeParams<$S extends _$jni.JObject, $K extends _$jni.JObject> - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GenericTypeParams<$S extends jni$_.JObject?, $K extends jni$_.JObject?> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$K> K; + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal + @jni$_.internal GenericTypeParams.fromReference( this.S, this.K, - _$jni.JReference reference, - ) : $type = type(S, K), + jni$_.JReference reference, + ) : $type = type<$S, $K>(S, K), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/GenericTypeParams'); /// The type which includes information such as the signature of this class. + static $GenericTypeParams$NullableType<$S, $K> + nullableType<$S extends jni$_.JObject?, $K extends jni$_.JObject?>( + jni$_.JObjType<$S> S, + jni$_.JObjType<$K> K, + ) { + return $GenericTypeParams$NullableType<$S, $K>( + S, + K, + ); + } + static $GenericTypeParams$Type<$S, $K> - type<$S extends _$jni.JObject, $K extends _$jni.JObject>( - _$jni.JObjType<$S> S, - _$jni.JObjType<$K> K, + type<$S extends jni$_.JObject?, $K extends jni$_.JObject?>( + jni$_.JObjType<$S> S, + jni$_.JObjType<$K> K, ) { - return $GenericTypeParams$Type( + return $GenericTypeParams$Type<$S, $K>( S, K, ); @@ -2693,69 +3216,131 @@ class GenericTypeParams<$S extends _$jni.JObject, $K extends _$jni.JObject> r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory GenericTypeParams({ - required _$jni.JObjType<$S> S, - required _$jni.JObjType<$K> K, + required jni$_.JObjType<$S> S, + required jni$_.JObjType<$K> K, }) { - return GenericTypeParams.fromReference( + return GenericTypeParams<$S, $K>.fromReference( S, K, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $GenericTypeParams$Type<$S extends _$jni.JObject, - $K extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$S> S; +final class $GenericTypeParams$NullableType<$S extends jni$_.JObject?, + $K extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$K> K; + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - const $GenericTypeParams$Type( + @jni$_.internal + const $GenericTypeParams$NullableType( this.S, this.K, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/GenericTypeParams;'; - @_$jni.internal - @_$core.override - GenericTypeParams<$S, $K> fromReference(_$jni.JReference reference) => - GenericTypeParams.fromReference(S, K, reference); + @jni$_.internal + @core$_.override + GenericTypeParams<$S, $K>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : GenericTypeParams<$S, $K>.fromReference( + S, + K, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($GenericTypeParams$NullableType, S, K); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($GenericTypeParams$NullableType<$S, $K>) && + other is $GenericTypeParams$NullableType<$S, $K> && + S == other.S && + K == other.K; + } +} + +final class $GenericTypeParams$Type<$S extends jni$_.JObject?, + $K extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$S> S; + + @jni$_.internal + final jni$_.JObjType<$K> K; + + @jni$_.internal + const $GenericTypeParams$Type( + this.S, + this.K, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/GenericTypeParams;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GenericTypeParams<$S, $K> fromReference(jni$_.JReference reference) => + GenericTypeParams<$S, $K>.fromReference( + S, + K, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GenericTypeParams$NullableType<$S, $K>(S, K); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($GenericTypeParams$Type, S, K); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($GenericTypeParams$Type<$S, $K>) && other is $GenericTypeParams$Type<$S, $K> && @@ -2765,43 +3350,60 @@ final class $GenericTypeParams$Type<$S extends _$jni.JObject, } /// from: `com.github.dart_lang.jnigen.generics.GrandParent$Parent$Child` -class GrandParent_Parent_Child<$T extends _$jni.JObject, - $S extends _$jni.JObject, $U extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GrandParent$Parent$Child< + $T extends jni$_.JObject?, + $S extends jni$_.JObject?, + $U extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$U> U; + @jni$_.internal + final jni$_.JObjType<$U> U; - @_$jni.internal - GrandParent_Parent_Child.fromReference( + @jni$_.internal + GrandParent$Parent$Child.fromReference( this.T, this.S, this.U, - _$jni.JReference reference, - ) : $type = type(T, S, U), + jni$_.JReference reference, + ) : $type = type<$T, $S, $U>(T, S, U), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child'); /// The type which includes information such as the signature of this class. - static $GrandParent_Parent_Child$Type<$T, $S, $U> type< - $T extends _$jni.JObject, - $S extends _$jni.JObject, - $U extends _$jni.JObject>( - _$jni.JObjType<$T> T, - _$jni.JObjType<$S> S, - _$jni.JObjType<$U> U, + static $GrandParent$Parent$Child$NullableType<$T, $S, $U> nullableType< + $T extends jni$_.JObject?, + $S extends jni$_.JObject?, + $U extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$S> S, + jni$_.JObjType<$U> U, + ) { + return $GrandParent$Parent$Child$NullableType<$T, $S, $U>( + T, + S, + U, + ); + } + + static $GrandParent$Parent$Child$Type<$T, $S, $U> type< + $T extends jni$_.JObject?, + $S extends jni$_.JObject?, + $U extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$S> S, + jni$_.JObjType<$U> U, ) { - return $GrandParent_Parent_Child$Type( + return $GrandParent$Parent$Child$Type<$T, $S, $U>( T, S, U, @@ -2815,11 +3417,12 @@ class GrandParent_Parent_Child<$T extends _$jni.JObject, /// from: `public T grandParentValue` /// The returned object must be released after use, by calling the [release] method. - $T get grandParentValue => _id_grandParentValue.get(this, T); + $T? get grandParentValue => _id_grandParentValue.get(this, T.nullableType); /// from: `public T grandParentValue` /// The returned object must be released after use, by calling the [release] method. - set grandParentValue($T value) => _id_grandParentValue.set(this, T, value); + set grandParentValue($T? value) => + _id_grandParentValue.set(this, T.nullableType, value); static final _id_parentValue = _class.instanceFieldId( r'parentValue', @@ -2828,11 +3431,12 @@ class GrandParent_Parent_Child<$T extends _$jni.JObject, /// from: `public S parentValue` /// The returned object must be released after use, by calling the [release] method. - $S get parentValue => _id_parentValue.get(this, S); + $S? get parentValue => _id_parentValue.get(this, S.nullableType); /// from: `public S parentValue` /// The returned object must be released after use, by calling the [release] method. - set parentValue($S value) => _id_parentValue.set(this, S, value); + set parentValue($S? value) => + _id_parentValue.set(this, S.nullableType, value); static final _id_value = _class.instanceFieldId( r'value', @@ -2841,110 +3445,182 @@ class GrandParent_Parent_Child<$T extends _$jni.JObject, /// from: `public U value` /// The returned object must be released after use, by calling the [release] method. - $U get value => _id_value.get(this, U); + $U? get value => _id_value.get(this, U.nullableType); /// from: `public U value` /// The returned object must be released after use, by calling the [release] method. - set value($U value) => _id_value.set(this, U, value); + set value($U? value) => _id_value.set(this, U.nullableType, value); static final _id_new$ = _class.constructorId( r'(Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;Ljava/lang/Object;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `public void (com.github.dart_lang.jnigen.generics.GrandParent$Parent $parent, U newValue)` + /// from: `public void (com.github.dart_lang.jnigen.generics.GrandParent$Parent $outerClass, U object)` /// The returned object must be released after use, by calling the [release] method. - factory GrandParent_Parent_Child( - GrandParent_Parent<$T, $S> $parent, - $U newValue, { - _$jni.JObjType<$T>? T, - _$jni.JObjType<$S>? S, - _$jni.JObjType<$U>? U, + factory GrandParent$Parent$Child( + GrandParent$Parent<$T?, $S?> $outerClass, + $U? object, { + jni$_.JObjType<$T>? T, + jni$_.JObjType<$S>? S, + required jni$_.JObjType<$U> U, }) { - T ??= _$jni.lowestCommonSuperType([ - ($parent.$type - as $GrandParent_Parent$Type<_$core.dynamic, _$core.dynamic>) + T ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type + as $GrandParent$Parent$Type) .T, - ]) as _$jni.JObjType<$T>; - S ??= _$jni.lowestCommonSuperType([ - ($parent.$type - as $GrandParent_Parent$Type<_$core.dynamic, _$core.dynamic>) + ]) as jni$_.JObjType<$T>; + S ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type + as $GrandParent$Parent$Type) .S, - ]) as _$jni.JObjType<$S>; - U ??= _$jni.lowestCommonSuperType([ - newValue.$type, - ]) as _$jni.JObjType<$U>; - return GrandParent_Parent_Child.fromReference( + ]) as jni$_.JObjType<$S>; + final _$$outerClass = $outerClass.reference; + final _$object = object?.reference ?? jni$_.jNullReference; + return GrandParent$Parent$Child<$T, $S, $U>.fromReference( T, S, U, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr, - $parent.reference.pointer, newValue.reference.pointer) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$$outerClass.pointer, _$object.pointer) .reference); } } -final class $GrandParent_Parent_Child$Type<$T extends _$jni.JObject, - $S extends _$jni.JObject, $U extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $GrandParent$Parent$Child$NullableType<$T extends jni$_.JObject?, + $S extends jni$_.JObject?, $U extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$U> U; + @jni$_.internal + final jni$_.JObjType<$U> U; - @_$jni.internal - const $GrandParent_Parent_Child$Type( + @jni$_.internal + const $GrandParent$Parent$Child$NullableType( this.T, this.S, this.U, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent$Child;'; - @_$jni.internal - @_$core.override - GrandParent_Parent_Child<$T, $S, $U> fromReference( - _$jni.JReference reference) => - GrandParent_Parent_Child.fromReference(T, S, U, reference); + @jni$_.internal + @core$_.override + GrandParent$Parent$Child<$T, $S, $U>? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : GrandParent$Parent$Child<$T, $S, $U>.fromReference( + T, + S, + U, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => + Object.hash($GrandParent$Parent$Child$NullableType, T, S, U); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($GrandParent$Parent$Child$NullableType<$T, $S, $U>) && + other is $GrandParent$Parent$Child$NullableType<$T, $S, $U> && + T == other.T && + S == other.S && + U == other.U; + } +} + +final class $GrandParent$Parent$Child$Type<$T extends jni$_.JObject?, + $S extends jni$_.JObject?, $U extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$S> S; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + const $GrandParent$Parent$Child$Type( + this.T, + this.S, + this.U, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent$Child;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GrandParent$Parent$Child<$T, $S, $U> fromReference( + jni$_.JReference reference) => + GrandParent$Parent$Child<$T, $S, $U>.fromReference( + T, + S, + U, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GrandParent$Parent$Child$NullableType<$T, $S, $U>(T, S, U); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => Object.hash($GrandParent_Parent_Child$Type, T, S, U); + @core$_.override + int get hashCode => Object.hash($GrandParent$Parent$Child$Type, T, S, U); - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($GrandParent_Parent_Child$Type<$T, $S, $U>) && - other is $GrandParent_Parent_Child$Type<$T, $S, $U> && + return other.runtimeType == ($GrandParent$Parent$Child$Type<$T, $S, $U>) && + other is $GrandParent$Parent$Child$Type<$T, $S, $U> && T == other.T && S == other.S && U == other.U; @@ -2952,36 +3628,47 @@ final class $GrandParent_Parent_Child$Type<$T extends _$jni.JObject, } /// from: `com.github.dart_lang.jnigen.generics.GrandParent$Parent` -class GrandParent_Parent<$T extends _$jni.JObject, $S extends _$jni.JObject> - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GrandParent$Parent<$T extends jni$_.JObject?, $S extends jni$_.JObject?> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - GrandParent_Parent.fromReference( + @jni$_.internal + GrandParent$Parent.fromReference( this.T, this.S, - _$jni.JReference reference, - ) : $type = type(T, S), + jni$_.JReference reference, + ) : $type = type<$T, $S>(T, S), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/GrandParent$Parent'); /// The type which includes information such as the signature of this class. - static $GrandParent_Parent$Type<$T, $S> - type<$T extends _$jni.JObject, $S extends _$jni.JObject>( - _$jni.JObjType<$T> T, - _$jni.JObjType<$S> S, + static $GrandParent$Parent$NullableType<$T, $S> + nullableType<$T extends jni$_.JObject?, $S extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$S> S, + ) { + return $GrandParent$Parent$NullableType<$T, $S>( + T, + S, + ); + } + + static $GrandParent$Parent$Type<$T, $S> + type<$T extends jni$_.JObject?, $S extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$S> S, ) { - return $GrandParent_Parent$Type( + return $GrandParent$Parent$Type<$T, $S>( T, S, ); @@ -2994,11 +3681,12 @@ class GrandParent_Parent<$T extends _$jni.JObject, $S extends _$jni.JObject> /// from: `public T parentValue` /// The returned object must be released after use, by calling the [release] method. - $T get parentValue => _id_parentValue.get(this, T); + $T? get parentValue => _id_parentValue.get(this, T.nullableType); /// from: `public T parentValue` /// The returned object must be released after use, by calling the [release] method. - set parentValue($T value) => _id_parentValue.set(this, T, value); + set parentValue($T? value) => + _id_parentValue.set(this, T.nullableType, value); static final _id_value = _class.instanceFieldId( r'value', @@ -3007,132 +3695,204 @@ class GrandParent_Parent<$T extends _$jni.JObject, $S extends _$jni.JObject> /// from: `public S value` /// The returned object must be released after use, by calling the [release] method. - $S get value => _id_value.get(this, S); + $S? get value => _id_value.get(this, S.nullableType); /// from: `public S value` /// The returned object must be released after use, by calling the [release] method. - set value($S value) => _id_value.set(this, S, value); + set value($S? value) => _id_value.set(this, S.nullableType, value); static final _id_new$ = _class.constructorId( r'(Lcom/github/dart_lang/jnigen/generics/GrandParent;Ljava/lang/Object;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `public void (com.github.dart_lang.jnigen.generics.GrandParent $parent, S newValue)` + /// from: `public void (com.github.dart_lang.jnigen.generics.GrandParent $outerClass, S object)` /// The returned object must be released after use, by calling the [release] method. - factory GrandParent_Parent( - GrandParent<$T> $parent, - $S newValue, { - _$jni.JObjType<$T>? T, - _$jni.JObjType<$S>? S, + factory GrandParent$Parent( + GrandParent<$T?> $outerClass, + $S? object, { + jni$_.JObjType<$T>? T, + required jni$_.JObjType<$S> S, }) { - T ??= _$jni.lowestCommonSuperType([ - ($parent.$type as $GrandParent$Type<_$core.dynamic>).T, - ]) as _$jni.JObjType<$T>; - S ??= _$jni.lowestCommonSuperType([ - newValue.$type, - ]) as _$jni.JObjType<$S>; - return GrandParent_Parent.fromReference( + T ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $GrandParent$Type).T, + ]) as jni$_.JObjType<$T>; + final _$$outerClass = $outerClass.reference; + final _$object = object?.reference ?? jni$_.jNullReference; + return GrandParent$Parent<$T, $S>.fromReference( T, S, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr, - $parent.reference.pointer, newValue.reference.pointer) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$$outerClass.pointer, _$object.pointer) .reference); } } -final class $GrandParent_Parent$Type<$T extends _$jni.JObject, - $S extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $GrandParent$Parent$NullableType<$T extends jni$_.JObject?, + $S extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - const $GrandParent_Parent$Type( + @jni$_.internal + const $GrandParent$Parent$NullableType( this.T, this.S, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;'; - @_$jni.internal - @_$core.override - GrandParent_Parent<$T, $S> fromReference(_$jni.JReference reference) => - GrandParent_Parent.fromReference(T, S, reference); + @jni$_.internal + @core$_.override + GrandParent$Parent<$T, $S>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : GrandParent$Parent<$T, $S>.fromReference( + T, + S, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($GrandParent$Parent$NullableType, T, S); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($GrandParent$Parent$NullableType<$T, $S>) && + other is $GrandParent$Parent$NullableType<$T, $S> && + T == other.T && + S == other.S; + } +} + +final class $GrandParent$Parent$Type<$T extends jni$_.JObject?, + $S extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - @_$core.override + @jni$_.internal + const $GrandParent$Parent$Type( + this.T, + this.S, + ); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;'; + + @jni$_.internal + @core$_.override + GrandParent$Parent<$T, $S> fromReference(jni$_.JReference reference) => + GrandParent$Parent<$T, $S>.fromReference( + T, + S, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GrandParent$Parent$NullableType<$T, $S>(T, S); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => Object.hash($GrandParent_Parent$Type, T, S); + @core$_.override + int get hashCode => Object.hash($GrandParent$Parent$Type, T, S); - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($GrandParent_Parent$Type<$T, $S>) && - other is $GrandParent_Parent$Type<$T, $S> && + return other.runtimeType == ($GrandParent$Parent$Type<$T, $S>) && + other is $GrandParent$Parent$Type<$T, $S> && T == other.T && S == other.S; } } /// from: `com.github.dart_lang.jnigen.generics.GrandParent$StaticParent$Child` -class GrandParent_StaticParent_Child<$S extends _$jni.JObject, - $U extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GrandParent$StaticParent$Child<$S extends jni$_.JObject?, + $U extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$U> U; + @jni$_.internal + final jni$_.JObjType<$U> U; - @_$jni.internal - GrandParent_StaticParent_Child.fromReference( + @jni$_.internal + GrandParent$StaticParent$Child.fromReference( this.S, this.U, - _$jni.JReference reference, - ) : $type = type(S, U), + jni$_.JReference reference, + ) : $type = type<$S, $U>(S, U), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child'); /// The type which includes information such as the signature of this class. - static $GrandParent_StaticParent_Child$Type<$S, $U> - type<$S extends _$jni.JObject, $U extends _$jni.JObject>( - _$jni.JObjType<$S> S, - _$jni.JObjType<$U> U, + static $GrandParent$StaticParent$Child$NullableType<$S, $U> + nullableType<$S extends jni$_.JObject?, $U extends jni$_.JObject?>( + jni$_.JObjType<$S> S, + jni$_.JObjType<$U> U, + ) { + return $GrandParent$StaticParent$Child$NullableType<$S, $U>( + S, + U, + ); + } + + static $GrandParent$StaticParent$Child$Type<$S, $U> + type<$S extends jni$_.JObject?, $U extends jni$_.JObject?>( + jni$_.JObjType<$S> S, + jni$_.JObjType<$U> U, ) { - return $GrandParent_StaticParent_Child$Type( + return $GrandParent$StaticParent$Child$Type<$S, $U>( S, U, ); @@ -3145,11 +3905,12 @@ class GrandParent_StaticParent_Child<$S extends _$jni.JObject, /// from: `public S parentValue` /// The returned object must be released after use, by calling the [release] method. - $S get parentValue => _id_parentValue.get(this, S); + $S? get parentValue => _id_parentValue.get(this, S.nullableType); /// from: `public S parentValue` /// The returned object must be released after use, by calling the [release] method. - set parentValue($S value) => _id_parentValue.set(this, S, value); + set parentValue($S? value) => + _id_parentValue.set(this, S.nullableType, value); static final _id_value = _class.instanceFieldId( r'value', @@ -3158,135 +3919,206 @@ class GrandParent_StaticParent_Child<$S extends _$jni.JObject, /// from: `public U value` /// The returned object must be released after use, by calling the [release] method. - $U get value => _id_value.get(this, U); + $U? get value => _id_value.get(this, U.nullableType); /// from: `public U value` /// The returned object must be released after use, by calling the [release] method. - set value($U value) => _id_value.set(this, U, value); + set value($U? value) => _id_value.set(this, U.nullableType, value); static final _id_new$ = _class.constructorId( r'(Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;Ljava/lang/Object;Ljava/lang/Object;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `public void (com.github.dart_lang.jnigen.generics.GrandParent$StaticParent $parent, S parentValue, U value)` - /// The returned object must be released after use, by calling the [release] method. - factory GrandParent_StaticParent_Child( - GrandParent_StaticParent<$S> $parent, - $S parentValue, - $U value, { - _$jni.JObjType<$S>? S, - _$jni.JObjType<$U>? U, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (com.github.dart_lang.jnigen.generics.GrandParent$StaticParent $outerClass, S object, U object1)` + /// The returned object must be released after use, by calling the [release] method. + factory GrandParent$StaticParent$Child( + GrandParent$StaticParent<$S?> $outerClass, + $S? object, + $U? object1, { + jni$_.JObjType<$S>? S, + required jni$_.JObjType<$U> U, }) { - S ??= _$jni.lowestCommonSuperType([ - parentValue.$type, - ($parent.$type as $GrandParent_StaticParent$Type<_$core.dynamic>).S, - ]) as _$jni.JObjType<$S>; - U ??= _$jni.lowestCommonSuperType([ - value.$type, - ]) as _$jni.JObjType<$U>; - return GrandParent_StaticParent_Child.fromReference( + S ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $GrandParent$StaticParent$Type).S, + ]) as jni$_.JObjType<$S>; + final _$$outerClass = $outerClass.reference; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return GrandParent$StaticParent$Child<$S, $U>.fromReference( S, U, - _new$( - _class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, - $parent.reference.pointer, - parentValue.reference.pointer, - value.reference.pointer) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$$outerClass.pointer, _$object.pointer, _$object1.pointer) .reference); } } -final class $GrandParent_StaticParent_Child$Type<$S extends _$jni.JObject, - $U extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$S> S; +final class $GrandParent$StaticParent$Child$NullableType< + $S extends jni$_.JObject?, $U extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$U> U; + @jni$_.internal + final jni$_.JObjType<$U> U; - @_$jni.internal - const $GrandParent_StaticParent_Child$Type( + @jni$_.internal + const $GrandParent$StaticParent$Child$NullableType( this.S, this.U, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child;'; - @_$jni.internal - @_$core.override - GrandParent_StaticParent_Child<$S, $U> fromReference( - _$jni.JReference reference) => - GrandParent_StaticParent_Child.fromReference(S, U, reference); - - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); - - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GrandParent$StaticParent$Child<$S, $U>? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : GrandParent$StaticParent$Child<$S, $U>.fromReference( + S, + U, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + this; + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => Object.hash($GrandParent_StaticParent_Child$Type, S, U); + @core$_.override + int get hashCode => + Object.hash($GrandParent$StaticParent$Child$NullableType, S, U); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == - ($GrandParent_StaticParent_Child$Type<$S, $U>) && - other is $GrandParent_StaticParent_Child$Type<$S, $U> && + ($GrandParent$StaticParent$Child$NullableType<$S, $U>) && + other is $GrandParent$StaticParent$Child$NullableType<$S, $U> && S == other.S && U == other.U; } } -/// from: `com.github.dart_lang.jnigen.generics.GrandParent$StaticParent` -class GrandParent_StaticParent<$S extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +final class $GrandParent$StaticParent$Child$Type<$S extends jni$_.JObject?, + $U extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - final _$jni.JObjType<$S> S; + @jni$_.internal + final jni$_.JObjType<$U> U; - @_$jni.internal - GrandParent_StaticParent.fromReference( + @jni$_.internal + const $GrandParent$StaticParent$Child$Type( this.S, - _$jni.JReference reference, - ) : $type = type(S), - super.fromReference(reference); + this.U, + ); - static final _class = _$jni.JClass.forName( - r'com/github/dart_lang/jnigen/generics/GrandParent$StaticParent'); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child;'; + + @jni$_.internal + @core$_.override + GrandParent$StaticParent$Child<$S, $U> fromReference( + jni$_.JReference reference) => + GrandParent$StaticParent$Child<$S, $U>.fromReference( + S, + U, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GrandParent$StaticParent$Child$NullableType<$S, $U>(S, U); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($GrandParent$StaticParent$Child$Type, S, U); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($GrandParent$StaticParent$Child$Type<$S, $U>) && + other is $GrandParent$StaticParent$Child$Type<$S, $U> && + S == other.S && + U == other.U; + } +} + +/// from: `com.github.dart_lang.jnigen.generics.GrandParent$StaticParent` +class GrandParent$StaticParent<$S extends jni$_.JObject?> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; + + @jni$_.internal + final jni$_.JObjType<$S> S; + + @jni$_.internal + GrandParent$StaticParent.fromReference( + this.S, + jni$_.JReference reference, + ) : $type = type<$S>(S), + super.fromReference(reference); + + static final _class = jni$_.JClass.forName( + r'com/github/dart_lang/jnigen/generics/GrandParent$StaticParent'); /// The type which includes information such as the signature of this class. - static $GrandParent_StaticParent$Type<$S> type<$S extends _$jni.JObject>( - _$jni.JObjType<$S> S, + static $GrandParent$StaticParent$NullableType<$S> + nullableType<$S extends jni$_.JObject?>( + jni$_.JObjType<$S> S, + ) { + return $GrandParent$StaticParent$NullableType<$S>( + S, + ); + } + + static $GrandParent$StaticParent$Type<$S> type<$S extends jni$_.JObject?>( + jni$_.JObjType<$S> S, ) { - return $GrandParent_StaticParent$Type( + return $GrandParent$StaticParent$Type<$S>( S, ); } @@ -3298,107 +4130,167 @@ class GrandParent_StaticParent<$S extends _$jni.JObject> extends _$jni.JObject { /// from: `public S value` /// The returned object must be released after use, by calling the [release] method. - $S get value => _id_value.get(this, S); + $S? get value => _id_value.get(this, S.nullableType); /// from: `public S value` /// The returned object must be released after use, by calling the [release] method. - set value($S value) => _id_value.set(this, S, value); + set value($S? value) => _id_value.set(this, S.nullableType, value); static final _id_new$ = _class.constructorId( r'(Ljava/lang/Object;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void (S value)` + /// from: `public void (S object)` /// The returned object must be released after use, by calling the [release] method. - factory GrandParent_StaticParent( - $S value, { - _$jni.JObjType<$S>? S, + factory GrandParent$StaticParent( + $S? object, { + required jni$_.JObjType<$S> S, }) { - S ??= _$jni.lowestCommonSuperType([ - value.$type, - ]) as _$jni.JObjType<$S>; - return GrandParent_StaticParent.fromReference( + final _$object = object?.reference ?? jni$_.jNullReference; + return GrandParent$StaticParent<$S>.fromReference( S, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr, - value.reference.pointer) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$object.pointer) .reference); } } -final class $GrandParent_StaticParent$Type<$S extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$S> S; +final class $GrandParent$StaticParent$NullableType<$S extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$S> S; - @_$jni.internal - const $GrandParent_StaticParent$Type( + @jni$_.internal + const $GrandParent$StaticParent$NullableType( this.S, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;'; - @_$jni.internal - @_$core.override - GrandParent_StaticParent<$S> fromReference(_$jni.JReference reference) => - GrandParent_StaticParent.fromReference(S, reference); + @jni$_.internal + @core$_.override + GrandParent$StaticParent<$S>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : GrandParent$StaticParent<$S>.fromReference( + S, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($GrandParent$StaticParent$NullableType, S); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($GrandParent$StaticParent$NullableType<$S>) && + other is $GrandParent$StaticParent$NullableType<$S> && + S == other.S; + } +} + +final class $GrandParent$StaticParent$Type<$S extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$S> S; + + @jni$_.internal + const $GrandParent$StaticParent$Type( + this.S, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GrandParent$StaticParent<$S> fromReference(jni$_.JReference reference) => + GrandParent$StaticParent<$S>.fromReference( + S, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GrandParent$StaticParent$NullableType<$S>(S); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => Object.hash($GrandParent_StaticParent$Type, S); + @core$_.override + int get hashCode => Object.hash($GrandParent$StaticParent$Type, S); - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($GrandParent_StaticParent$Type<$S>) && - other is $GrandParent_StaticParent$Type<$S> && + return other.runtimeType == ($GrandParent$StaticParent$Type<$S>) && + other is $GrandParent$StaticParent$Type<$S> && S == other.S; } } /// from: `com.github.dart_lang.jnigen.generics.GrandParent` -class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GrandParent<$T extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal GrandParent.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), + jni$_.JReference reference, + ) : $type = type<$T>(T), super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/generics/GrandParent'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/GrandParent'); /// The type which includes information such as the signature of this class. - static $GrandParent$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $GrandParent$NullableType<$T> nullableType<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + ) { + return $GrandParent$NullableType<$T>( + T, + ); + } + + static $GrandParent$Type<$T> type<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, ) { - return $GrandParent$Type( + return $GrandParent$Type<$T>( T, ); } @@ -3410,40 +4302,38 @@ class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { /// from: `public T value` /// The returned object must be released after use, by calling the [release] method. - $T get value => _id_value.get(this, T); + $T? get value => _id_value.get(this, T.nullableType); /// from: `public T value` /// The returned object must be released after use, by calling the [release] method. - set value($T value) => _id_value.set(this, T, value); + set value($T? value) => _id_value.set(this, T.nullableType, value); static final _id_new$ = _class.constructorId( r'(Ljava/lang/Object;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void (T value)` + /// from: `public void (T object)` /// The returned object must be released after use, by calling the [release] method. factory GrandParent( - $T value, { - _$jni.JObjType<$T>? T, + $T? object, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - value.$type, - ]) as _$jni.JObjType<$T>; - return GrandParent.fromReference( + final _$object = object?.reference ?? jni$_.jNullReference; + return GrandParent<$T>.fromReference( T, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr, - value.reference.pointer) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$object.pointer) .reference); } @@ -3452,25 +4342,26 @@ class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;', ); - static final _stringParent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _stringParent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `public com.github.dart_lang.jnigen.generics.GrandParent.Parent stringParent()` + /// from: `public com.github.dart_lang.jnigen.generics.GrandParent.Parent stringParent()` /// The returned object must be released after use, by calling the [release] method. - GrandParent_Parent<_$jni.JObject, _$jni.JString> stringParent() { + GrandParent$Parent<$T?, jni$_.JString?>? stringParent() { return _stringParent( - reference.pointer, _id_stringParent as _$jni.JMethodIDPtr) - .object(const $GrandParent_Parent$Type( - _$jni.JObjectType(), _$jni.JStringType())); + reference.pointer, _id_stringParent as jni$_.JMethodIDPtr) + .object?>( + $GrandParent$Parent$NullableType<$T?, jni$_.JString?>( + T.nullableType, const jni$_.JStringNullableType())); } static final _id_varParent = _class.instanceMethodId( @@ -3478,29 +4369,29 @@ class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;', ); - static final _varParent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _varParent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public com.github.dart_lang.jnigen.generics.GrandParent.Parent varParent(S nestedValue)` + /// from: `public com.github.dart_lang.jnigen.generics.GrandParent.Parent varParent(S object)` /// The returned object must be released after use, by calling the [release] method. - GrandParent_Parent<_$jni.JObject, $S> varParent<$S extends _$jni.JObject>( - $S nestedValue, { - _$jni.JObjType<$S>? S, + GrandParent$Parent<$T?, $S?>? varParent<$S extends jni$_.JObject?>( + $S? object, { + required jni$_.JObjType<$S> S, }) { - S ??= _$jni.lowestCommonSuperType([ - nestedValue.$type, - ]) as _$jni.JObjType<$S>; - return _varParent(reference.pointer, _id_varParent as _$jni.JMethodIDPtr, - nestedValue.reference.pointer) - .object($GrandParent_Parent$Type(const _$jni.JObjectType(), S)); + final _$object = object?.reference ?? jni$_.jNullReference; + return _varParent(reference.pointer, _id_varParent as jni$_.JMethodIDPtr, + _$object.pointer) + .object?>( + $GrandParent$Parent$NullableType<$T?, $S?>( + T.nullableType, S.nullableType)); } static final _id_stringStaticParent = _class.staticMethodId( @@ -3508,24 +4399,26 @@ class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;', ); - static final _stringStaticParent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _stringStaticParent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `static public com.github.dart_lang.jnigen.generics.GrandParent.StaticParent stringStaticParent()` + /// from: `static public com.github.dart_lang.jnigen.generics.GrandParent$StaticParent stringStaticParent()` /// The returned object must be released after use, by calling the [release] method. - static GrandParent_StaticParent<_$jni.JString> stringStaticParent() { + static GrandParent$StaticParent? stringStaticParent() { return _stringStaticParent(_class.reference.pointer, - _id_stringStaticParent as _$jni.JMethodIDPtr) - .object(const $GrandParent_StaticParent$Type(_$jni.JStringType())); + _id_stringStaticParent as jni$_.JMethodIDPtr) + .object?>( + const $GrandParent$StaticParent$NullableType( + jni$_.JStringNullableType())); } static final _id_varStaticParent = _class.staticMethodId( @@ -3533,29 +4426,29 @@ class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;', ); - static final _varStaticParent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _varStaticParent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.generics.GrandParent.StaticParent varStaticParent(S value)` + /// from: `static public com.github.dart_lang.jnigen.generics.GrandParent$StaticParent varStaticParent(S object)` /// The returned object must be released after use, by calling the [release] method. - static GrandParent_StaticParent<$S> varStaticParent<$S extends _$jni.JObject>( - $S value, { - _$jni.JObjType<$S>? S, + static GrandParent$StaticParent<$S?>? + varStaticParent<$S extends jni$_.JObject?>( + $S? object, { + required jni$_.JObjType<$S> S, }) { - S ??= _$jni.lowestCommonSuperType([ - value.$type, - ]) as _$jni.JObjType<$S>; + final _$object = object?.reference ?? jni$_.jNullReference; return _varStaticParent(_class.reference.pointer, - _id_varStaticParent as _$jni.JMethodIDPtr, value.reference.pointer) - .object($GrandParent_StaticParent$Type(S)); + _id_varStaticParent as jni$_.JMethodIDPtr, _$object.pointer) + .object?>( + $GrandParent$StaticParent$NullableType<$S?>(S.nullableType)); } static final _id_staticParentWithSameType = _class.instanceMethodId( @@ -3563,58 +4456,111 @@ class GrandParent<$T extends _$jni.JObject> extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;', ); - static final _staticParentWithSameType = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _staticParentWithSameType = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `public com.github.dart_lang.jnigen.generics.GrandParent.StaticParent staticParentWithSameType()` + /// from: `public com.github.dart_lang.jnigen.generics.GrandParent$StaticParent staticParentWithSameType()` /// The returned object must be released after use, by calling the [release] method. - GrandParent_StaticParent<$T> staticParentWithSameType() { + GrandParent$StaticParent<$T?>? staticParentWithSameType() { return _staticParentWithSameType(reference.pointer, - _id_staticParentWithSameType as _$jni.JMethodIDPtr) - .object($GrandParent_StaticParent$Type(T)); + _id_staticParentWithSameType as jni$_.JMethodIDPtr) + .object?>( + $GrandParent$StaticParent$NullableType<$T?>(T.nullableType)); } } -final class $GrandParent$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $GrandParent$NullableType<$T extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $GrandParent$Type( + @jni$_.internal + const $GrandParent$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/GrandParent;'; - @_$jni.internal - @_$core.override - GrandParent<$T> fromReference(_$jni.JReference reference) => - GrandParent.fromReference(T, reference); + @jni$_.internal + @core$_.override + GrandParent<$T>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : GrandParent<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($GrandParent$NullableType, T); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($GrandParent$NullableType<$T>) && + other is $GrandParent$NullableType<$T> && + T == other.T; + } +} + +final class $GrandParent$Type<$T extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + const $GrandParent$Type( + this.T, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/generics/GrandParent;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GrandParent<$T> fromReference(jni$_.JReference reference) => + GrandParent<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GrandParent$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($GrandParent$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($GrandParent$Type<$T>) && other is $GrandParent$Type<$T> && @@ -3623,36 +4569,47 @@ final class $GrandParent$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.generics.MyMap$MyEntry` -class MyMap_MyEntry<$K extends _$jni.JObject, $V extends _$jni.JObject> - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class MyMap$MyEntry<$K extends jni$_.JObject?, $V extends jni$_.JObject?> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$K> K; + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal - MyMap_MyEntry.fromReference( + @jni$_.internal + MyMap$MyEntry.fromReference( this.K, this.V, - _$jni.JReference reference, - ) : $type = type(K, V), + jni$_.JReference reference, + ) : $type = type<$K, $V>(K, V), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/MyMap$MyEntry'); /// The type which includes information such as the signature of this class. - static $MyMap_MyEntry$Type<$K, $V> - type<$K extends _$jni.JObject, $V extends _$jni.JObject>( - _$jni.JObjType<$K> K, - _$jni.JObjType<$V> V, + static $MyMap$MyEntry$NullableType<$K, $V> + nullableType<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + jni$_.JObjType<$V> V, ) { - return $MyMap_MyEntry$Type( + return $MyMap$MyEntry$NullableType<$K, $V>( + K, + V, + ); + } + + static $MyMap$MyEntry$Type<$K, $V> + type<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + jni$_.JObjType<$V> V, + ) { + return $MyMap$MyEntry$Type<$K, $V>( K, V, ); @@ -3665,11 +4622,11 @@ class MyMap_MyEntry<$K extends _$jni.JObject, $V extends _$jni.JObject> /// from: `public K key` /// The returned object must be released after use, by calling the [release] method. - $K get key => _id_key.get(this, K); + $K? get key => _id_key.get(this, K.nullableType); /// from: `public K key` /// The returned object must be released after use, by calling the [release] method. - set key($K value) => _id_key.set(this, K, value); + set key($K? value) => _id_key.set(this, K.nullableType, value); static final _id_value = _class.instanceFieldId( r'value', @@ -3678,140 +4635,209 @@ class MyMap_MyEntry<$K extends _$jni.JObject, $V extends _$jni.JObject> /// from: `public V value` /// The returned object must be released after use, by calling the [release] method. - $V get value => _id_value.get(this, V); + $V? get value => _id_value.get(this, V.nullableType); /// from: `public V value` /// The returned object must be released after use, by calling the [release] method. - set value($V value) => _id_value.set(this, V, value); + set value($V? value) => _id_value.set(this, V.nullableType, value); static final _id_new$ = _class.constructorId( r'(Lcom/github/dart_lang/jnigen/generics/MyMap;Ljava/lang/Object;Ljava/lang/Object;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `public void (com.github.dart_lang.jnigen.generics.MyMap $parent, K key, V value)` - /// The returned object must be released after use, by calling the [release] method. - factory MyMap_MyEntry( - MyMap<$K, $V> $parent, - $K key, - $V value, { - _$jni.JObjType<$K>? K, - _$jni.JObjType<$V>? V, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (com.github.dart_lang.jnigen.generics.MyMap $outerClass, K object, V object1)` + /// The returned object must be released after use, by calling the [release] method. + factory MyMap$MyEntry( + MyMap<$K?, $V?> $outerClass, + $K? object, + $V? object1, { + jni$_.JObjType<$K>? K, + jni$_.JObjType<$V>? V, }) { - K ??= _$jni.lowestCommonSuperType([ - key.$type, - ($parent.$type as $MyMap$Type<_$core.dynamic, _$core.dynamic>).K, - ]) as _$jni.JObjType<$K>; - V ??= _$jni.lowestCommonSuperType([ - value.$type, - ($parent.$type as $MyMap$Type<_$core.dynamic, _$core.dynamic>).V, - ]) as _$jni.JObjType<$V>; - return MyMap_MyEntry.fromReference( + K ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $MyMap$Type).K, + ]) as jni$_.JObjType<$K>; + V ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $MyMap$Type).V, + ]) as jni$_.JObjType<$V>; + final _$$outerClass = $outerClass.reference; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return MyMap$MyEntry<$K, $V>.fromReference( K, V, - _new$( - _class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, - $parent.reference.pointer, - key.reference.pointer, - value.reference.pointer) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$$outerClass.pointer, _$object.pointer, _$object1.pointer) .reference); } } -final class $MyMap_MyEntry$Type<$K extends _$jni.JObject, - $V extends _$jni.JObject> extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$K> K; +final class $MyMap$MyEntry$NullableType<$K extends jni$_.JObject?, + $V extends jni$_.JObject?> extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal - const $MyMap_MyEntry$Type( + @jni$_.internal + const $MyMap$MyEntry$NullableType( this.K, this.V, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/MyMap$MyEntry;'; - @_$jni.internal - @_$core.override - MyMap_MyEntry<$K, $V> fromReference(_$jni.JReference reference) => - MyMap_MyEntry.fromReference(K, V, reference); + @jni$_.internal + @core$_.override + MyMap$MyEntry<$K, $V>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : MyMap$MyEntry<$K, $V>.fromReference( + K, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($MyMap$MyEntry$NullableType, K, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyMap$MyEntry$NullableType<$K, $V>) && + other is $MyMap$MyEntry$NullableType<$K, $V> && + K == other.K && + V == other.V; + } +} + +final class $MyMap$MyEntry$Type<$K extends jni$_.JObject?, + $V extends jni$_.JObject?> extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$K> K; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $MyMap$MyEntry$Type( + this.K, + this.V, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/MyMap$MyEntry;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MyMap$MyEntry<$K, $V> fromReference(jni$_.JReference reference) => + MyMap$MyEntry<$K, $V>.fromReference( + K, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $MyMap$MyEntry$NullableType<$K, $V>(K, V); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => Object.hash($MyMap_MyEntry$Type, K, V); + @core$_.override + int get hashCode => Object.hash($MyMap$MyEntry$Type, K, V); - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($MyMap_MyEntry$Type<$K, $V>) && - other is $MyMap_MyEntry$Type<$K, $V> && + return other.runtimeType == ($MyMap$MyEntry$Type<$K, $V>) && + other is $MyMap$MyEntry$Type<$K, $V> && K == other.K && V == other.V; } } /// from: `com.github.dart_lang.jnigen.generics.MyMap` -class MyMap<$K extends _$jni.JObject, $V extends _$jni.JObject> - extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class MyMap<$K extends jni$_.JObject?, $V extends jni$_.JObject?> + extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$K> K; + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal + @jni$_.internal MyMap.fromReference( this.K, this.V, - _$jni.JReference reference, - ) : $type = type(K, V), + jni$_.JReference reference, + ) : $type = type<$K, $V>(K, V), super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/generics/MyMap'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/MyMap'); /// The type which includes information such as the signature of this class. + static $MyMap$NullableType<$K, $V> + nullableType<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + jni$_.JObjType<$V> V, + ) { + return $MyMap$NullableType<$K, $V>( + K, + V, + ); + } + static $MyMap$Type<$K, $V> - type<$K extends _$jni.JObject, $V extends _$jni.JObject>( - _$jni.JObjType<$K> K, - _$jni.JObjType<$V> V, + type<$K extends jni$_.JObject?, $V extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + jni$_.JObjType<$V> V, ) { - return $MyMap$Type( + return $MyMap$Type<$K, $V>( K, V, ); @@ -3821,28 +4847,28 @@ class MyMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory MyMap({ - required _$jni.JObjType<$K> K, - required _$jni.JObjType<$V> V, + required jni$_.JObjType<$K> K, + required jni$_.JObjType<$V> V, }) { - return MyMap.fromReference( + return MyMap<$K, $V>.fromReference( K, V, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -3851,25 +4877,26 @@ class MyMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _get = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _get = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public V get(K key)` + /// from: `public V get(K object)` /// The returned object must be released after use, by calling the [release] method. - $V get( - $K key, + $V? get( + $K? object, ) { - return _get(reference.pointer, _id_get as _$jni.JMethodIDPtr, - key.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + return _get( + reference.pointer, _id_get as jni$_.JMethodIDPtr, _$object.pointer) + .object<$V?>(V.nullableType); } static final _id_put = _class.instanceMethodId( @@ -3877,32 +4904,34 @@ class MyMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _put = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _put = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `public V put(K key, V value)` + /// from: `public V put(K object, V object1)` /// The returned object must be released after use, by calling the [release] method. - $V put( - $K key, - $V value, + $V? put( + $K? object, + $V? object1, ) { - return _put(reference.pointer, _id_put as _$jni.JMethodIDPtr, - key.reference.pointer, value.reference.pointer) - .object(V); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return _put(reference.pointer, _id_put as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer) + .object<$V?>(V.nullableType); } static final _id_entryStack = _class.instanceMethodId( @@ -3910,62 +4939,123 @@ class MyMap<$K extends _$jni.JObject, $V extends _$jni.JObject> r'()Lcom/github/dart_lang/jnigen/generics/MyStack;', ); - static final _entryStack = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _entryStack = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `public com.github.dart_lang.jnigen.generics.MyStack.MyEntry> entryStack()` + /// from: `public com.github.dart_lang.jnigen.generics.MyStack entryStack()` /// The returned object must be released after use, by calling the [release] method. - MyStack> entryStack() { - return _entryStack(reference.pointer, _id_entryStack as _$jni.JMethodIDPtr) - .object(const $MyStack$Type( - $MyMap_MyEntry$Type(_$jni.JObjectType(), _$jni.JObjectType()))); + MyStack?>? entryStack() { + return _entryStack(reference.pointer, _id_entryStack as jni$_.JMethodIDPtr) + .object?>?>( + $MyStack$NullableType?>( + $MyMap$MyEntry$NullableType<$K?, $V?>( + K.nullableType, V.nullableType))); } } -final class $MyMap$Type<$K extends _$jni.JObject, $V extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$K> K; +final class $MyMap$NullableType<$K extends jni$_.JObject?, + $V extends jni$_.JObject?> extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal - const $MyMap$Type( + @jni$_.internal + const $MyMap$NullableType( this.K, this.V, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/MyMap;'; - @_$jni.internal - @_$core.override - MyMap<$K, $V> fromReference(_$jni.JReference reference) => - MyMap.fromReference(K, V, reference); + @jni$_.internal + @core$_.override + MyMap<$K, $V>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : MyMap<$K, $V>.fromReference( + K, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($MyMap$NullableType, K, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyMap$NullableType<$K, $V>) && + other is $MyMap$NullableType<$K, $V> && + K == other.K && + V == other.V; + } +} + +final class $MyMap$Type<$K extends jni$_.JObject?, $V extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$K> K; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $MyMap$Type( + this.K, + this.V, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/generics/MyMap;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MyMap<$K, $V> fromReference(jni$_.JReference reference) => + MyMap<$K, $V>.fromReference( + K, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $MyMap$NullableType<$K, $V>(K, V); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($MyMap$Type, K, V); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyMap$Type<$K, $V>) && other is $MyMap$Type<$K, $V> && @@ -3975,29 +5065,37 @@ final class $MyMap$Type<$K extends _$jni.JObject, $V extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.generics.MyStack` -class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class MyStack<$T extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal MyStack.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), + jni$_.JReference reference, + ) : $type = type<$T>(T), super.fromReference(reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/generics/MyStack'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/MyStack'); /// The type which includes information such as the signature of this class. - static $MyStack$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $MyStack$NullableType<$T> nullableType<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + ) { + return $MyStack$NullableType<$T>( + T, + ); + } + + static $MyStack$Type<$T> type<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, ) { - return $MyStack$Type( + return $MyStack$Type<$T>( T, ); } @@ -4006,26 +5104,26 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory MyStack({ - required _$jni.JObjType<$T> T, + required jni$_.JObjType<$T> T, }) { - return MyStack.fromReference( + return MyStack<$T>.fromReference( T, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -4034,29 +5132,27 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'([Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;', ); - static final _fromArray = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _fromArray = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.generics.MyStack fromArray(T[] arr)` + /// from: `static public com.github.dart_lang.jnigen.generics.MyStack fromArray(java.lang.Object[] objects)` /// The returned object must be released after use, by calling the [release] method. - static MyStack<$T> fromArray<$T extends _$jni.JObject>( - _$jni.JArray<$T> arr, { - _$jni.JObjType<$T>? T, + static MyStack<$T?>? fromArray<$T extends jni$_.JObject?>( + jni$_.JArray<$T?>? objects, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - ((arr.$type as _$jni.JArrayType).elementType as _$jni.JObjType), - ]) as _$jni.JObjType<$T>; + final _$objects = objects?.reference ?? jni$_.jNullReference; return _fromArray(_class.reference.pointer, - _id_fromArray as _$jni.JMethodIDPtr, arr.reference.pointer) - .object($MyStack$Type(T)); + _id_fromArray as jni$_.JMethodIDPtr, _$objects.pointer) + .object?>($MyStack$NullableType<$T?>(T.nullableType)); } static final _id_fromArrayOfArrayOfGrandParents = _class.staticMethodId( @@ -4065,35 +5161,30 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { ); static final _fromArrayOfArrayOfGrandParents = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.generics.MyStack fromArrayOfArrayOfGrandParents(com.github.dart_lang.jnigen.generics.GrandParent[][] arr)` + /// from: `static public com.github.dart_lang.jnigen.generics.MyStack fromArrayOfArrayOfGrandParents(java.lang.Object[] grandParents)` /// The returned object must be released after use, by calling the [release] method. - static MyStack<$S> fromArrayOfArrayOfGrandParents<$S extends _$jni.JObject>( - _$jni.JArray<_$jni.JArray>> arr, { - _$jni.JObjType<$S>? S, + static MyStack<$S?>? + fromArrayOfArrayOfGrandParents<$S extends jni$_.JObject?>( + jni$_.JArray?>?>? grandParents, { + required jni$_.JObjType<$S> S, }) { - S ??= _$jni.lowestCommonSuperType([ - (((((arr.$type as _$jni.JArrayType).elementType as _$jni.JObjType) - as _$jni.JArrayType) - .elementType as _$jni.JObjType) - as $GrandParent$Type<_$core.dynamic>) - .T, - ]) as _$jni.JObjType<$S>; + final _$grandParents = grandParents?.reference ?? jni$_.jNullReference; return _fromArrayOfArrayOfGrandParents( _class.reference.pointer, - _id_fromArrayOfArrayOfGrandParents as _$jni.JMethodIDPtr, - arr.reference.pointer) - .object($MyStack$Type(S)); + _id_fromArrayOfArrayOfGrandParents as jni$_.JMethodIDPtr, + _$grandParents.pointer) + .object?>($MyStack$NullableType<$S?>(S.nullableType)); } static final _id_of = _class.staticMethodId( @@ -4101,25 +5192,25 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'()Lcom/github/dart_lang/jnigen/generics/MyStack;', ); - static final _of = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _of = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); - /// from: `static public com.github.dart_lang.jnigen.generics.MyStack of()` + /// from: `static public com.github.dart_lang.jnigen.generics.MyStack of()` /// The returned object must be released after use, by calling the [release] method. - static MyStack<$T> of<$T extends _$jni.JObject>({ - required _$jni.JObjType<$T> T, + static MyStack<$T?>? of<$T extends jni$_.JObject?>({ + required jni$_.JObjType<$T> T, }) { - return _of(_class.reference.pointer, _id_of as _$jni.JMethodIDPtr) - .object($MyStack$Type(T)); + return _of(_class.reference.pointer, _id_of as jni$_.JMethodIDPtr) + .object?>($MyStack$NullableType<$T?>(T.nullableType)); } static final _id_of$1 = _class.staticMethodId( @@ -4127,29 +5218,27 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;', ); - static final _of$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _of$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.generics.MyStack of(T obj)` + /// from: `static public com.github.dart_lang.jnigen.generics.MyStack of(T object)` /// The returned object must be released after use, by calling the [release] method. - static MyStack<$T> of$1<$T extends _$jni.JObject>( - $T obj, { - _$jni.JObjType<$T>? T, + static MyStack<$T?>? of$1<$T extends jni$_.JObject?>( + $T? object, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - obj.$type, - ]) as _$jni.JObjType<$T>; - return _of$1(_class.reference.pointer, _id_of$1 as _$jni.JMethodIDPtr, - obj.reference.pointer) - .object($MyStack$Type(T)); + final _$object = object?.reference ?? jni$_.jNullReference; + return _of$1(_class.reference.pointer, _id_of$1 as jni$_.JMethodIDPtr, + _$object.pointer) + .object?>($MyStack$NullableType<$T?>(T.nullableType)); } static final _id_of$2 = _class.staticMethodId( @@ -4157,37 +5246,35 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;', ); - static final _of$2 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _of$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.generics.MyStack of(T obj, T obj2)` + /// from: `static public com.github.dart_lang.jnigen.generics.MyStack of(T object, T object1)` /// The returned object must be released after use, by calling the [release] method. - static MyStack<$T> of$2<$T extends _$jni.JObject>( - $T obj, - $T obj2, { - _$jni.JObjType<$T>? T, + static MyStack<$T?>? of$2<$T extends jni$_.JObject?>( + $T? object, + $T? object1, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - obj2.$type, - obj.$type, - ]) as _$jni.JObjType<$T>; - return _of$2(_class.reference.pointer, _id_of$2 as _$jni.JMethodIDPtr, - obj.reference.pointer, obj2.reference.pointer) - .object($MyStack$Type(T)); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return _of$2(_class.reference.pointer, _id_of$2 as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer) + .object?>($MyStack$NullableType<$T?>(T.nullableType)); } static final _id_push = _class.instanceMethodId( @@ -4195,23 +5282,23 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)V', ); - static final _push = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _push = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void push(T item)` + /// from: `public void push(T object)` void push( - $T item, + $T? object, ) { - _push(reference.pointer, _id_push as _$jni.JMethodIDPtr, - item.reference.pointer) + final _$object = object?.reference ?? jni$_.jNullReference; + _push(reference.pointer, _id_push as jni$_.JMethodIDPtr, _$object.pointer) .check(); } @@ -4220,22 +5307,23 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'()Ljava/lang/Object;', ); - static final _pop = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _pop = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public T pop()` /// The returned object must be released after use, by calling the [release] method. - $T pop() { - return _pop(reference.pointer, _id_pop as _$jni.JMethodIDPtr).object(T); + $T? pop() { + return _pop(reference.pointer, _id_pop as jni$_.JMethodIDPtr) + .object<$T?>(T.nullableType); } static final _id_size = _class.instanceMethodId( @@ -4243,55 +5331,106 @@ class MyStack<$T extends _$jni.JObject> extends _$jni.JObject { r'()I', ); - static final _size = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _size = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public int size()` int size() { - return _size(reference.pointer, _id_size as _$jni.JMethodIDPtr).integer; + return _size(reference.pointer, _id_size as jni$_.JMethodIDPtr).integer; } } -final class $MyStack$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $MyStack$NullableType<$T extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $MyStack$Type( + @jni$_.internal + const $MyStack$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/MyStack;'; - @_$jni.internal - @_$core.override - MyStack<$T> fromReference(_$jni.JReference reference) => - MyStack.fromReference(T, reference); + @jni$_.internal + @core$_.override + MyStack<$T>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : MyStack<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($MyStack$NullableType, T); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyStack$NullableType<$T>) && + other is $MyStack$NullableType<$T> && + T == other.T; + } +} + +final class $MyStack$Type<$T extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + const $MyStack$Type( + this.T, + ); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/generics/MyStack;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MyStack<$T> fromReference(jni$_.JReference reference) => + MyStack<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => $MyStack$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($MyStack$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyStack$Type<$T>) && other is $MyStack$Type<$T> && @@ -4300,30 +5439,40 @@ final class $MyStack$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.generics.StringKeyedMap` -class StringKeyedMap<$V extends _$jni.JObject> - extends MyMap<_$jni.JString, $V> { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class StringKeyedMap<$V extends jni$_.JObject?> + extends MyMap { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$V> V; + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal + @jni$_.internal StringKeyedMap.fromReference( this.V, - _$jni.JReference reference, - ) : $type = type(V), - super.fromReference(const _$jni.JStringType(), V, reference); + jni$_.JReference reference, + ) : $type = type<$V>(V), + super.fromReference( + const jni$_.JStringNullableType(), V.nullableType, reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/StringKeyedMap'); /// The type which includes information such as the signature of this class. - static $StringKeyedMap$Type<$V> type<$V extends _$jni.JObject>( - _$jni.JObjType<$V> V, + static $StringKeyedMap$NullableType<$V> + nullableType<$V extends jni$_.JObject?>( + jni$_.JObjType<$V> V, + ) { + return $StringKeyedMap$NullableType<$V>( + V, + ); + } + + static $StringKeyedMap$Type<$V> type<$V extends jni$_.JObject?>( + jni$_.JObjType<$V> V, ) { - return $StringKeyedMap$Type( + return $StringKeyedMap$Type<$V>( V, ); } @@ -4332,62 +5481,118 @@ class StringKeyedMap<$V extends _$jni.JObject> r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory StringKeyedMap({ - required _$jni.JObjType<$V> V, + required jni$_.JObjType<$V> V, }) { - return StringKeyedMap.fromReference( + return StringKeyedMap<$V>.fromReference( V, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $StringKeyedMap$Type<$V extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$V> V; +final class $StringKeyedMap$NullableType<$V extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal - const $StringKeyedMap$Type( + @jni$_.internal + const $StringKeyedMap$NullableType( this.V, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/StringKeyedMap;'; - @_$jni.internal - @_$core.override - StringKeyedMap<$V> fromReference(_$jni.JReference reference) => - StringKeyedMap.fromReference(V, reference); + @jni$_.internal + @core$_.override + StringKeyedMap<$V>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : StringKeyedMap<$V>.fromReference( + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => $MyMap$NullableType( + const jni$_.JStringNullableType(), V.nullableType); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => Object.hash($StringKeyedMap$NullableType, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringKeyedMap$NullableType<$V>) && + other is $StringKeyedMap$NullableType<$V> && + V == other.V; + } +} + +final class $StringKeyedMap$Type<$V extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $StringKeyedMap$Type( + this.V, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => $MyMap$Type(const _$jni.JStringType(), V); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/StringKeyedMap;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringKeyedMap<$V> fromReference(jni$_.JReference reference) => + StringKeyedMap<$V>.fromReference( + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => $MyMap$NullableType( + const jni$_.JStringNullableType(), V.nullableType); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $StringKeyedMap$NullableType<$V>(V); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => Object.hash($StringKeyedMap$Type, V); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringKeyedMap$Type<$V>) && other is $StringKeyedMap$Type<$V> && @@ -4396,145 +5601,238 @@ final class $StringKeyedMap$Type<$V extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.generics.StringMap` -class StringMap extends StringKeyedMap<_$jni.JString> { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class StringMap extends StringKeyedMap { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal StringMap.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, - super.fromReference(const _$jni.JStringType(), reference); + super.fromReference(const jni$_.JStringNullableType(), reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/generics/StringMap'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/StringMap'); /// The type which includes information such as the signature of this class. + static const nullableType = $StringMap$NullableType(); static const type = $StringMap$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory StringMap() { return StringMap.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $StringMap$Type extends _$jni.JObjType { - @_$jni.internal - const $StringMap$Type(); +final class $StringMap$NullableType extends jni$_.JObjType { + @jni$_.internal + const $StringMap$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/StringMap;'; - @_$jni.internal - @_$core.override - StringMap fromReference(_$jni.JReference reference) => - StringMap.fromReference(reference); + @jni$_.internal + @core$_.override + StringMap? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : StringMap.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $StringKeyedMap$NullableType( + jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 3; + + @core$_.override + int get hashCode => ($StringMap$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringMap$NullableType) && + other is $StringMap$NullableType; + } +} + +final class $StringMap$Type extends jni$_.JObjType { + @jni$_.internal + const $StringMap$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => - const $StringKeyedMap$Type(_$jni.JStringType()); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/generics/StringMap;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringMap fromReference(jni$_.JReference reference) => + StringMap.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $StringKeyedMap$NullableType( + jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $StringMap$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 3; - @_$core.override + @core$_.override int get hashCode => ($StringMap$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringMap$Type) && other is $StringMap$Type; } } /// from: `com.github.dart_lang.jnigen.generics.StringStack` -class StringStack extends MyStack<_$jni.JString> { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class StringStack extends MyStack { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal StringStack.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, - super.fromReference(const _$jni.JStringType(), reference); + super.fromReference(const jni$_.JStringNullableType(), reference); static final _class = - _$jni.JClass.forName(r'com/github/dart_lang/jnigen/generics/StringStack'); + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/StringStack'); /// The type which includes information such as the signature of this class. + static const nullableType = $StringStack$NullableType(); static const type = $StringStack$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory StringStack() { return StringStack.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $StringStack$Type extends _$jni.JObjType { - @_$jni.internal - const $StringStack$Type(); +final class $StringStack$NullableType extends jni$_.JObjType { + @jni$_.internal + const $StringStack$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/StringStack;'; - @_$jni.internal - @_$core.override - StringStack fromReference(_$jni.JReference reference) => - StringStack.fromReference(reference); + @jni$_.internal + @core$_.override + StringStack? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : StringStack.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $MyStack$NullableType(jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($StringStack$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringStack$NullableType) && + other is $StringStack$NullableType; + } +} + +final class $StringStack$Type extends jni$_.JObjType { + @jni$_.internal + const $StringStack$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const $MyStack$Type(_$jni.JStringType()); + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/generics/StringStack;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringStack fromReference(jni$_.JReference reference) => + StringStack.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => + const $MyStack$NullableType(jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $StringStack$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => ($StringStack$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringStack$Type) && other is $StringStack$Type; @@ -4542,30 +5840,40 @@ final class $StringStack$Type extends _$jni.JObjType { } /// from: `com.github.dart_lang.jnigen.generics.StringValuedMap` -class StringValuedMap<$K extends _$jni.JObject> - extends MyMap<$K, _$jni.JString> { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class StringValuedMap<$K extends jni$_.JObject?> + extends MyMap<$K?, jni$_.JString?> { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$K> K; + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal + @jni$_.internal StringValuedMap.fromReference( this.K, - _$jni.JReference reference, - ) : $type = type(K), - super.fromReference(K, const _$jni.JStringType(), reference); + jni$_.JReference reference, + ) : $type = type<$K>(K), + super.fromReference( + K.nullableType, const jni$_.JStringNullableType(), reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/generics/StringValuedMap'); /// The type which includes information such as the signature of this class. - static $StringValuedMap$Type<$K> type<$K extends _$jni.JObject>( - _$jni.JObjType<$K> K, + static $StringValuedMap$NullableType<$K> + nullableType<$K extends jni$_.JObject?>( + jni$_.JObjType<$K> K, + ) { + return $StringValuedMap$NullableType<$K>( + K, + ); + } + + static $StringValuedMap$Type<$K> type<$K extends jni$_.JObject?>( + jni$_.JObjType<$K> K, ) { - return $StringValuedMap$Type( + return $StringValuedMap$Type<$K>( K, ); } @@ -4574,62 +5882,118 @@ class StringValuedMap<$K extends _$jni.JObject> r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory StringValuedMap({ - required _$jni.JObjType<$K> K, + required jni$_.JObjType<$K> K, }) { - return StringValuedMap.fromReference( + return StringValuedMap<$K>.fromReference( K, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $StringValuedMap$Type<$K extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$K> K; +final class $StringValuedMap$NullableType<$K extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$K> K; - @_$jni.internal - const $StringValuedMap$Type( + @jni$_.internal + const $StringValuedMap$NullableType( this.K, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/generics/StringValuedMap;'; - @_$jni.internal - @_$core.override - StringValuedMap<$K> fromReference(_$jni.JReference reference) => - StringValuedMap.fromReference(K, reference); + @jni$_.internal + @core$_.override + StringValuedMap<$K>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : StringValuedMap<$K>.fromReference( + K, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => $MyMap$NullableType<$K?, jni$_.JString?>( + K.nullableType, const jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => Object.hash($StringValuedMap$NullableType, K); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringValuedMap$NullableType<$K>) && + other is $StringValuedMap$NullableType<$K> && + K == other.K; + } +} + +final class $StringValuedMap$Type<$K extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$K> K; + + @jni$_.internal + const $StringValuedMap$Type( + this.K, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => $MyMap$Type(K, const _$jni.JStringType()); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/generics/StringValuedMap;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringValuedMap<$K> fromReference(jni$_.JReference reference) => + StringValuedMap<$K>.fromReference( + K, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => $MyMap$NullableType<$K?, jni$_.JString?>( + K.nullableType, const jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $StringValuedMap$NullableType<$K>(K); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => Object.hash($StringValuedMap$Type, K); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringValuedMap$Type<$K>) && other is $StringValuedMap$Type<$K> && @@ -4638,29 +6002,38 @@ final class $StringValuedMap$Type<$K extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.interfaces.GenericInterface` -class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GenericInterface<$T extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal GenericInterface.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), + jni$_.JReference reference, + ) : $type = type<$T>(T), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/GenericInterface'); /// The type which includes information such as the signature of this class. - static $GenericInterface$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $GenericInterface$NullableType<$T> + nullableType<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, ) { - return $GenericInterface$Type( + return $GenericInterface$NullableType<$T>( + T, + ); + } + + static $GenericInterface$Type<$T> type<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + ) { + return $GenericInterface$Type<$T>( T, ); } @@ -4670,29 +6043,28 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)[Ljava/lang/Object;', ); - static final _genericArrayOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _genericArrayOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract U[] genericArrayOf(U element)` + /// from: `public abstract java.lang.Object[] genericArrayOf(U object)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<$U> genericArrayOf<$U extends _$jni.JObject>( - $U element, { - _$jni.JObjType<$U>? U, + jni$_.JArray<$U?>? genericArrayOf<$U extends jni$_.JObject?>( + $U? object, { + required jni$_.JObjType<$U> U, }) { - U ??= _$jni.lowestCommonSuperType([ - element.$type, - ]) as _$jni.JObjType<$U>; + final _$object = object?.reference ?? jni$_.jNullReference; return _genericArrayOf(reference.pointer, - _id_genericArrayOf as _$jni.JMethodIDPtr, element.reference.pointer) - .object(_$jni.JArrayType(U)); + _id_genericArrayOf as jni$_.JMethodIDPtr, _$object.pointer) + .object?>( + jni$_.JArrayNullableType<$U?>(U.nullableType)); } static final _id_arrayOf = _class.instanceMethodId( @@ -4700,25 +6072,27 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)[Ljava/lang/Object;', ); - static final _arrayOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _arrayOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract T[] arrayOf(T element)` + /// from: `public abstract java.lang.Object[] arrayOf(T object)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JArray<$T> arrayOf( - $T element, + jni$_.JArray<$T?>? arrayOf( + $T? object, ) { - return _arrayOf(reference.pointer, _id_arrayOf as _$jni.JMethodIDPtr, - element.reference.pointer) - .object(_$jni.JArrayType(T)); + final _$object = object?.reference ?? jni$_.jNullReference; + return _arrayOf(reference.pointer, _id_arrayOf as jni$_.JMethodIDPtr, + _$object.pointer) + .object?>( + jni$_.JArrayNullableType<$T?>(T.nullableType)); } static final _id_mapOf = _class.instanceMethodId( @@ -4726,36 +6100,36 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;', ); - static final _mapOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _mapOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `public abstract java.util.Map mapOf(T key, U value)` + /// from: `public abstract java.util.Map mapOf(T object, U object1)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JMap<$T, $U> mapOf<$U extends _$jni.JObject>( - $T key, - $U value, { - _$jni.JObjType<$U>? U, + jni$_.JMap<$T?, $U?>? mapOf<$U extends jni$_.JObject?>( + $T? object, + $U? object1, { + required jni$_.JObjType<$U> U, }) { - U ??= _$jni.lowestCommonSuperType([ - value.$type, - ]) as _$jni.JObjType<$U>; - return _mapOf(reference.pointer, _id_mapOf as _$jni.JMethodIDPtr, - key.reference.pointer, value.reference.pointer) - .object(_$jni.JMapType(T, U)); + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1?.reference ?? jni$_.jNullReference; + return _mapOf(reference.pointer, _id_mapOf as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer) + .object?>( + jni$_.JMapNullableType<$T?, $U?>(T.nullableType, U.nullableType)); } static final _id_firstOfGenericArray = _class.instanceMethodId( @@ -4763,31 +6137,27 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'([Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _firstOfGenericArray = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _firstOfGenericArray = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract U firstOfGenericArray(U[] array)` + /// from: `public abstract U firstOfGenericArray(java.lang.Object[] objects)` /// The returned object must be released after use, by calling the [release] method. - $U firstOfGenericArray<$U extends _$jni.JObject>( - _$jni.JArray<$U> array, { - _$jni.JObjType<$U>? U, + $U? firstOfGenericArray<$U extends jni$_.JObject?>( + jni$_.JArray<$U?>? objects, { + required jni$_.JObjType<$U> U, }) { - U ??= _$jni.lowestCommonSuperType([ - ((array.$type as _$jni.JArrayType).elementType as _$jni.JObjType), - ]) as _$jni.JObjType<$U>; - return _firstOfGenericArray( - reference.pointer, - _id_firstOfGenericArray as _$jni.JMethodIDPtr, - array.reference.pointer) - .object(U); + final _$objects = objects?.reference ?? jni$_.jNullReference; + return _firstOfGenericArray(reference.pointer, + _id_firstOfGenericArray as jni$_.JMethodIDPtr, _$objects.pointer) + .object<$U?>(U.nullableType); } static final _id_firstOfArray = _class.instanceMethodId( @@ -4795,25 +6165,26 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'([Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _firstOfArray = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _firstOfArray = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract T firstOfArray(T[] array)` + /// from: `public abstract T firstOfArray(java.lang.Object[] objects)` /// The returned object must be released after use, by calling the [release] method. - $T firstOfArray( - _$jni.JArray<$T> array, + $T? firstOfArray( + jni$_.JArray<$T?>? objects, ) { + final _$objects = objects?.reference ?? jni$_.jNullReference; return _firstOfArray(reference.pointer, - _id_firstOfArray as _$jni.JMethodIDPtr, array.reference.pointer) - .object(T); + _id_firstOfArray as jni$_.JMethodIDPtr, _$objects.pointer) + .object<$T?>(T.nullableType); } static final _id_firstKeyOf = _class.instanceMethodId( @@ -4821,29 +6192,27 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/util/Map;)Ljava/lang/Object;', ); - static final _firstKeyOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _firstKeyOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract T firstKeyOf(java.util.Map map)` + /// from: `public abstract T firstKeyOf(java.util.Map map)` /// The returned object must be released after use, by calling the [release] method. - $T firstKeyOf<$U extends _$jni.JObject>( - _$jni.JMap<$T, $U> map, { - _$jni.JObjType<$U>? U, + $T? firstKeyOf<$U extends jni$_.JObject?>( + jni$_.JMap<$T?, $U?>? map, { + required jni$_.JObjType<$U> U, }) { - U ??= _$jni.lowestCommonSuperType([ - (map.$type as _$jni.JMapType<_$core.dynamic, _$core.dynamic>).V, - ]) as _$jni.JObjType<$U>; - return _firstKeyOf(reference.pointer, _id_firstKeyOf as _$jni.JMethodIDPtr, - map.reference.pointer) - .object(T); + final _$map = map?.reference ?? jni$_.jNullReference; + return _firstKeyOf(reference.pointer, _id_firstKeyOf as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$T?>(T.nullableType); } static final _id_firstValueOf = _class.instanceMethodId( @@ -4851,41 +6220,39 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/util/Map;)Ljava/lang/Object;', ); - static final _firstValueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _firstValueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract U firstValueOf(java.util.Map map)` + /// from: `public abstract U firstValueOf(java.util.Map map)` /// The returned object must be released after use, by calling the [release] method. - $U firstValueOf<$U extends _$jni.JObject>( - _$jni.JMap<$T, $U> map, { - _$jni.JObjType<$U>? U, + $U? firstValueOf<$U extends jni$_.JObject?>( + jni$_.JMap<$T?, $U?>? map, { + required jni$_.JObjType<$U> U, }) { - U ??= _$jni.lowestCommonSuperType([ - (map.$type as _$jni.JMapType<_$core.dynamic, _$core.dynamic>).V, - ]) as _$jni.JObjType<$U>; + final _$map = map?.reference ?? jni$_.jNullReference; return _firstValueOf(reference.pointer, - _id_firstValueOf as _$jni.JMethodIDPtr, map.reference.pointer) - .object(U); + _id_firstValueOf as jni$_.JMethodIDPtr, _$map.pointer) + .object<$U?>(U.nullableType); } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -4893,109 +6260,122 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'genericArrayOf(Ljava/lang/Object;)[Ljava/lang/Object;') { final $r = _$impls[$p]!.genericArrayOf( - $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + $a![0]?.as(const jni$_.JObjectType(), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'arrayOf(Ljava/lang/Object;)[Ljava/lang/Object;') { final $r = _$impls[$p]!.arrayOf( - $a[0].as(_$impls[$p]!.T, releaseOriginal: true), + $a![0]?.as(_$impls[$p]!.T, releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'mapOf(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;') { final $r = _$impls[$p]!.mapOf( - $a[0].as(_$impls[$p]!.T, releaseOriginal: true), - $a[1].as(const _$jni.JObjectType(), releaseOriginal: true), + $a![0]?.as(_$impls[$p]!.T, releaseOriginal: true), + $a![1]?.as(const jni$_.JObjectType(), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'firstOfGenericArray([Ljava/lang/Object;)Ljava/lang/Object;') { final $r = _$impls[$p]!.firstOfGenericArray( - $a[0].as(const _$jni.JArrayType(_$jni.JObjectType()), + $a![0]?.as( + const jni$_.JArrayType( + jni$_.JObjectNullableType()), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'firstOfArray([Ljava/lang/Object;)Ljava/lang/Object;') { final $r = _$impls[$p]!.firstOfArray( - $a[0].as(const _$jni.JArrayType(_$jni.JObjectType()), + $a![0]?.as( + const jni$_.JArrayType( + jni$_.JObjectNullableType()), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'firstKeyOf(Ljava/util/Map;)Ljava/lang/Object;') { final $r = _$impls[$p]!.firstKeyOf( - $a[0].as( - const _$jni.JMapType(_$jni.JObjectType(), _$jni.JObjectType()), + $a![0]?.as( + const jni$_.JMapType( + jni$_.JObjectNullableType(), jni$_.JObjectNullableType()), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'firstValueOf(Ljava/util/Map;)Ljava/lang/Object;') { final $r = _$impls[$p]!.firstValueOf( - $a[0].as( - const _$jni.JMapType(_$jni.JObjectType(), _$jni.JObjectType()), + $a![0]?.as( + const jni$_.JMapType( + jni$_.JObjectNullableType(), jni$_.JObjectNullableType()), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } - static void implementIn<$T extends _$jni.JObject>( - _$jni.JImplementer implementer, + static void implementIn<$T extends jni$_.JObject?>( + jni$_.JImplementer implementer, $GenericInterface<$T> $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'com.github.dart_lang.jnigen.interfaces.GenericInterface', @@ -5010,62 +6390,63 @@ class GenericInterface<$T extends _$jni.JObject> extends _$jni.JObject { factory GenericInterface.implement( $GenericInterface<$T> $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return GenericInterface.fromReference( + return GenericInterface<$T>.fromReference( $impl.T, $i.implementReference(), ); } } -abstract base mixin class $GenericInterface<$T extends _$jni.JObject> { +abstract base mixin class $GenericInterface<$T extends jni$_.JObject?> { factory $GenericInterface({ - required _$jni.JObjType<$T> T, - required _$jni.JArray<_$jni.JObject> Function(_$jni.JObject element) + required jni$_.JObjType<$T> T, + required jni$_.JArray? Function(jni$_.JObject? object) genericArrayOf, - required _$jni.JArray<_$jni.JObject> Function($T element) arrayOf, - required _$jni.JMap<_$jni.JObject, _$jni.JObject> Function( - $T key, _$jni.JObject value) + required jni$_.JArray? Function($T? object) arrayOf, + required jni$_.JMap? Function( + $T? object, jni$_.JObject? object1) mapOf, - required _$jni.JObject Function(_$jni.JArray<_$jni.JObject> array) + required jni$_.JObject? Function(jni$_.JArray? objects) firstOfGenericArray, - required $T Function(_$jni.JArray<_$jni.JObject> array) firstOfArray, - required $T Function(_$jni.JMap<_$jni.JObject, _$jni.JObject> map) + required $T? Function(jni$_.JArray? objects) firstOfArray, + required $T? Function(jni$_.JMap? map) firstKeyOf, - required _$jni.JObject Function( - _$jni.JMap<_$jni.JObject, _$jni.JObject> map) + required jni$_.JObject? Function( + jni$_.JMap? map) firstValueOf, - }) = _$GenericInterface; - - _$jni.JObjType<$T> get T; - - _$jni.JArray<_$jni.JObject> genericArrayOf(_$jni.JObject element); - _$jni.JArray<_$jni.JObject> arrayOf($T element); - _$jni.JMap<_$jni.JObject, _$jni.JObject> mapOf($T key, _$jni.JObject value); - _$jni.JObject firstOfGenericArray(_$jni.JArray<_$jni.JObject> array); - $T firstOfArray(_$jni.JArray<_$jni.JObject> array); - $T firstKeyOf(_$jni.JMap<_$jni.JObject, _$jni.JObject> map); - _$jni.JObject firstValueOf(_$jni.JMap<_$jni.JObject, _$jni.JObject> map); + }) = _$GenericInterface<$T>; + + jni$_.JObjType<$T> get T; + + jni$_.JArray? genericArrayOf(jni$_.JObject? object); + jni$_.JArray? arrayOf($T? object); + jni$_.JMap? mapOf( + $T? object, jni$_.JObject? object1); + jni$_.JObject? firstOfGenericArray(jni$_.JArray? objects); + $T? firstOfArray(jni$_.JArray? objects); + $T? firstKeyOf(jni$_.JMap? map); + jni$_.JObject? firstValueOf(jni$_.JMap? map); } -final class _$GenericInterface<$T extends _$jni.JObject> +final class _$GenericInterface<$T extends jni$_.JObject?> with $GenericInterface<$T> { _$GenericInterface({ required this.T, - required _$jni.JArray<_$jni.JObject> Function(_$jni.JObject element) + required jni$_.JArray? Function(jni$_.JObject? object) genericArrayOf, - required _$jni.JArray<_$jni.JObject> Function($T element) arrayOf, - required _$jni.JMap<_$jni.JObject, _$jni.JObject> Function( - $T key, _$jni.JObject value) + required jni$_.JArray? Function($T? object) arrayOf, + required jni$_.JMap? Function( + $T? object, jni$_.JObject? object1) mapOf, - required _$jni.JObject Function(_$jni.JArray<_$jni.JObject> array) + required jni$_.JObject? Function(jni$_.JArray? objects) firstOfGenericArray, - required $T Function(_$jni.JArray<_$jni.JObject> array) firstOfArray, - required $T Function(_$jni.JMap<_$jni.JObject, _$jni.JObject> map) + required $T? Function(jni$_.JArray? objects) firstOfArray, + required $T? Function(jni$_.JMap? map) firstKeyOf, - required _$jni.JObject Function( - _$jni.JMap<_$jni.JObject, _$jni.JObject> map) + required jni$_.JObject? Function( + jni$_.JMap? map) firstValueOf, }) : _genericArrayOf = genericArrayOf, _arrayOf = arrayOf, @@ -5075,82 +6456,138 @@ final class _$GenericInterface<$T extends _$jni.JObject> _firstKeyOf = firstKeyOf, _firstValueOf = firstValueOf; - @_$core.override - final _$jni.JObjType<$T> T; + @core$_.override + final jni$_.JObjType<$T> T; - final _$jni.JArray<_$jni.JObject> Function(_$jni.JObject element) + final jni$_.JArray? Function(jni$_.JObject? object) _genericArrayOf; - final _$jni.JArray<_$jni.JObject> Function($T element) _arrayOf; - final _$jni.JMap<_$jni.JObject, _$jni.JObject> Function( - $T key, _$jni.JObject value) _mapOf; - final _$jni.JObject Function(_$jni.JArray<_$jni.JObject> array) + final jni$_.JArray? Function($T? object) _arrayOf; + final jni$_.JMap? Function( + $T? object, jni$_.JObject? object1) _mapOf; + final jni$_.JObject? Function(jni$_.JArray? objects) _firstOfGenericArray; - final $T Function(_$jni.JArray<_$jni.JObject> array) _firstOfArray; - final $T Function(_$jni.JMap<_$jni.JObject, _$jni.JObject> map) _firstKeyOf; - final _$jni.JObject Function(_$jni.JMap<_$jni.JObject, _$jni.JObject> map) + final $T? Function(jni$_.JArray? objects) _firstOfArray; + final $T? Function(jni$_.JMap? map) + _firstKeyOf; + final jni$_.JObject? Function(jni$_.JMap? map) _firstValueOf; - _$jni.JArray<_$jni.JObject> genericArrayOf(_$jni.JObject element) { - return _genericArrayOf(element); + jni$_.JArray? genericArrayOf(jni$_.JObject? object) { + return _genericArrayOf(object); } - _$jni.JArray<_$jni.JObject> arrayOf($T element) { - return _arrayOf(element); + jni$_.JArray? arrayOf($T? object) { + return _arrayOf(object); } - _$jni.JMap<_$jni.JObject, _$jni.JObject> mapOf($T key, _$jni.JObject value) { - return _mapOf(key, value); + jni$_.JMap? mapOf( + $T? object, jni$_.JObject? object1) { + return _mapOf(object, object1); } - _$jni.JObject firstOfGenericArray(_$jni.JArray<_$jni.JObject> array) { - return _firstOfGenericArray(array); + jni$_.JObject? firstOfGenericArray(jni$_.JArray? objects) { + return _firstOfGenericArray(objects); } - $T firstOfArray(_$jni.JArray<_$jni.JObject> array) { - return _firstOfArray(array); + $T? firstOfArray(jni$_.JArray? objects) { + return _firstOfArray(objects); } - $T firstKeyOf(_$jni.JMap<_$jni.JObject, _$jni.JObject> map) { + $T? firstKeyOf(jni$_.JMap? map) { return _firstKeyOf(map); } - _$jni.JObject firstValueOf(_$jni.JMap<_$jni.JObject, _$jni.JObject> map) { + jni$_.JObject? firstValueOf(jni$_.JMap? map) { return _firstValueOf(map); } } -final class $GenericInterface$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $GenericInterface$NullableType<$T extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $GenericInterface$Type( + @jni$_.internal + const $GenericInterface$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/GenericInterface;'; - @_$jni.internal - @_$core.override - GenericInterface<$T> fromReference(_$jni.JReference reference) => - GenericInterface.fromReference(T, reference); + @jni$_.internal + @core$_.override + GenericInterface<$T>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : GenericInterface<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($GenericInterface$NullableType, T); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($GenericInterface$NullableType<$T>) && + other is $GenericInterface$NullableType<$T> && + T == other.T; + } +} + +final class $GenericInterface$Type<$T extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + const $GenericInterface$Type( + this.T, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/GenericInterface;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GenericInterface<$T> fromReference(jni$_.JReference reference) => + GenericInterface<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GenericInterface$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($GenericInterface$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($GenericInterface$Type<$T>) && other is $GenericInterface$Type<$T> && @@ -5159,29 +6596,37 @@ final class $GenericInterface$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.interfaces.MyInterface` -class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class MyInterface<$T extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal MyInterface.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), + jni$_.JReference reference, + ) : $type = type<$T>(T), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/MyInterface'); /// The type which includes information such as the signature of this class. - static $MyInterface$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $MyInterface$NullableType<$T> nullableType<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, ) { - return $MyInterface$Type( + return $MyInterface$NullableType<$T>( + T, + ); + } + + static $MyInterface$Type<$T> type<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + ) { + return $MyInterface$Type<$T>( T, ); } @@ -5191,23 +6636,24 @@ class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/String;)V', ); - static final _voidCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _voidCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract void voidCallback(java.lang.String s)` + /// from: `public abstract void voidCallback(java.lang.String string)` void voidCallback( - _$jni.JString s, + jni$_.JString? string, ) { - _voidCallback(reference.pointer, _id_voidCallback as _$jni.JMethodIDPtr, - s.reference.pointer) + final _$string = string?.reference ?? jni$_.jNullReference; + _voidCallback(reference.pointer, _id_voidCallback as jni$_.JMethodIDPtr, + _$string.pointer) .check(); } @@ -5216,25 +6662,26 @@ class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/String;)Ljava/lang/String;', ); - static final _stringCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _stringCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract java.lang.String stringCallback(java.lang.String s)` + /// from: `public abstract java.lang.String stringCallback(java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - _$jni.JString stringCallback( - _$jni.JString s, + jni$_.JString? stringCallback( + jni$_.JString? string, ) { + final _$string = string?.reference ?? jni$_.jNullReference; return _stringCallback(reference.pointer, - _id_stringCallback as _$jni.JMethodIDPtr, s.reference.pointer) - .object(const _$jni.JStringType()); + _id_stringCallback as jni$_.JMethodIDPtr, _$string.pointer) + .object(const jni$_.JStringNullableType()); } static final _id_varCallback = _class.instanceMethodId( @@ -5242,25 +6689,26 @@ class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(Ljava/lang/Object;)Ljava/lang/Object;', ); - static final _varCallback = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _varCallback = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallObjectMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract T varCallback(T t)` + /// from: `public abstract T varCallback(T object)` /// The returned object must be released after use, by calling the [release] method. - $T varCallback( - $T t, + $T? varCallback( + $T? object, ) { + final _$object = object?.reference ?? jni$_.jNullReference; return _varCallback(reference.pointer, - _id_varCallback as _$jni.JMethodIDPtr, t.reference.pointer) - .object(T); + _id_varCallback as jni$_.JMethodIDPtr, _$object.pointer) + .object<$T?>(T.nullableType); } static final _id_manyPrimitives = _class.instanceMethodId( @@ -5268,44 +6716,44 @@ class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { r'(IZCD)J', ); - static final _manyPrimitives = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _manyPrimitives = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Double + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Double )>)>>('globalEnv_CallLongMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, int, int, int, double)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, int, double)>(); - /// from: `public abstract long manyPrimitives(int a, boolean b, char c, double d)` + /// from: `public abstract long manyPrimitives(int i, boolean z, char c, double d)` int manyPrimitives( - int a, - bool b, + int i, + bool z, int c, double d, ) { return _manyPrimitives(reference.pointer, - _id_manyPrimitives as _$jni.JMethodIDPtr, a, b ? 1 : 0, c, d) + _id_manyPrimitives as jni$_.JMethodIDPtr, i, z ? 1 : 0, c, d) .long; } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -5313,80 +6761,82 @@ class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'voidCallback(Ljava/lang/String;)V') { _$impls[$p]!.voidCallback( - $a[0].as(const _$jni.JStringType(), releaseOriginal: true), + $a![0]?.as(const jni$_.JStringType(), releaseOriginal: true), ); - return _$jni.nullptr; + return jni$_.nullptr; } if ($d == r'stringCallback(Ljava/lang/String;)Ljava/lang/String;') { final $r = _$impls[$p]!.stringCallback( - $a[0].as(const _$jni.JStringType(), releaseOriginal: true), + $a![0]?.as(const jni$_.JStringType(), releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'varCallback(Ljava/lang/Object;)Ljava/lang/Object;') { final $r = _$impls[$p]!.varCallback( - $a[0].as(_$impls[$p]!.T, releaseOriginal: true), + $a![0]?.as(_$impls[$p]!.T, releaseOriginal: true), ); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } if ($d == r'manyPrimitives(IZCD)J') { final $r = _$impls[$p]!.manyPrimitives( - $a[0] - .as(const _$jni.JIntegerType(), releaseOriginal: true) + $a![0]! + .as(const jni$_.JIntegerType(), releaseOriginal: true) .intValue(releaseOriginal: true), - $a[1] - .as(const _$jni.JBooleanType(), releaseOriginal: true) + $a![1]! + .as(const jni$_.JBooleanType(), releaseOriginal: true) .booleanValue(releaseOriginal: true), - $a[2] - .as(const _$jni.JCharacterType(), releaseOriginal: true) + $a![2]! + .as(const jni$_.JCharacterType(), releaseOriginal: true) .charValue(releaseOriginal: true), - $a[3] - .as(const _$jni.JDoubleType(), releaseOriginal: true) + $a![3]! + .as(const jni$_.JDoubleType(), releaseOriginal: true) .doubleValue(releaseOriginal: true), ); - return _$jni.JLong($r).reference.toPointer(); + return jni$_.JLong($r).reference.toPointer(); } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } - static void implementIn<$T extends _$jni.JObject>( - _$jni.JImplementer implementer, + static void implementIn<$T extends jni$_.JObject?>( + jni$_.JImplementer implementer, $MyInterface<$T> $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'com.github.dart_lang.jnigen.interfaces.MyInterface', @@ -5403,106 +6853,159 @@ class MyInterface<$T extends _$jni.JObject> extends _$jni.JObject { factory MyInterface.implement( $MyInterface<$T> $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); - return MyInterface.fromReference( + return MyInterface<$T>.fromReference( $impl.T, $i.implementReference(), ); } - static _$core.Map get $impls => _$impls; + static core$_.Map get $impls => _$impls; } -abstract base mixin class $MyInterface<$T extends _$jni.JObject> { +abstract base mixin class $MyInterface<$T extends jni$_.JObject?> { factory $MyInterface({ - required _$jni.JObjType<$T> T, - required void Function(_$jni.JString s) voidCallback, + required jni$_.JObjType<$T> T, + required void Function(jni$_.JString? string) voidCallback, bool voidCallback$async, - required _$jni.JString Function(_$jni.JString s) stringCallback, - required $T Function($T t) varCallback, - required int Function(int a, bool b, int c, double d) manyPrimitives, - }) = _$MyInterface; + required jni$_.JString? Function(jni$_.JString? string) stringCallback, + required $T? Function($T? object) varCallback, + required int Function(int i, bool z, int c, double d) manyPrimitives, + }) = _$MyInterface<$T>; - _$jni.JObjType<$T> get T; + jni$_.JObjType<$T> get T; - void voidCallback(_$jni.JString s); + void voidCallback(jni$_.JString? string); bool get voidCallback$async => false; - _$jni.JString stringCallback(_$jni.JString s); - $T varCallback($T t); - int manyPrimitives(int a, bool b, int c, double d); + jni$_.JString? stringCallback(jni$_.JString? string); + $T? varCallback($T? object); + int manyPrimitives(int i, bool z, int c, double d); } -final class _$MyInterface<$T extends _$jni.JObject> with $MyInterface<$T> { +final class _$MyInterface<$T extends jni$_.JObject?> with $MyInterface<$T> { _$MyInterface({ required this.T, - required void Function(_$jni.JString s) voidCallback, + required void Function(jni$_.JString? string) voidCallback, this.voidCallback$async = false, - required _$jni.JString Function(_$jni.JString s) stringCallback, - required $T Function($T t) varCallback, - required int Function(int a, bool b, int c, double d) manyPrimitives, + required jni$_.JString? Function(jni$_.JString? string) stringCallback, + required $T? Function($T? object) varCallback, + required int Function(int i, bool z, int c, double d) manyPrimitives, }) : _voidCallback = voidCallback, _stringCallback = stringCallback, _varCallback = varCallback, _manyPrimitives = manyPrimitives; - @_$core.override - final _$jni.JObjType<$T> T; + @core$_.override + final jni$_.JObjType<$T> T; - final void Function(_$jni.JString s) _voidCallback; + final void Function(jni$_.JString? string) _voidCallback; final bool voidCallback$async; - final _$jni.JString Function(_$jni.JString s) _stringCallback; - final $T Function($T t) _varCallback; - final int Function(int a, bool b, int c, double d) _manyPrimitives; + final jni$_.JString? Function(jni$_.JString? string) _stringCallback; + final $T? Function($T? object) _varCallback; + final int Function(int i, bool z, int c, double d) _manyPrimitives; - void voidCallback(_$jni.JString s) { - return _voidCallback(s); + void voidCallback(jni$_.JString? string) { + return _voidCallback(string); } - _$jni.JString stringCallback(_$jni.JString s) { - return _stringCallback(s); + jni$_.JString? stringCallback(jni$_.JString? string) { + return _stringCallback(string); } - $T varCallback($T t) { - return _varCallback(t); + $T? varCallback($T? object) { + return _varCallback(object); } - int manyPrimitives(int a, bool b, int c, double d) { - return _manyPrimitives(a, b, c, d); + int manyPrimitives(int i, bool z, int c, double d) { + return _manyPrimitives(i, z, c, d); } } -final class $MyInterface$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $MyInterface$NullableType<$T extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $MyInterface$Type( + @jni$_.internal + const $MyInterface$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/MyInterface;'; - @_$jni.internal - @_$core.override - MyInterface<$T> fromReference(_$jni.JReference reference) => - MyInterface.fromReference(T, reference); + @jni$_.internal + @core$_.override + MyInterface<$T>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : MyInterface<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($MyInterface$NullableType, T); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyInterface$NullableType<$T>) && + other is $MyInterface$NullableType<$T> && + T == other.T; + } +} + +final class $MyInterface$Type<$T extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - @_$core.override + @jni$_.internal + const $MyInterface$Type( + this.T, + ); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/MyInterface;'; + + @jni$_.internal + @core$_.override + MyInterface<$T> fromReference(jni$_.JReference reference) => + MyInterface<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $MyInterface$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($MyInterface$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyInterface$Type<$T>) && other is $MyInterface$Type<$T> && @@ -5511,43 +7014,44 @@ final class $MyInterface$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.interfaces.MyInterfaceConsumer` -class MyInterfaceConsumer extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class MyInterfaceConsumer extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal MyInterfaceConsumer.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/MyInterfaceConsumer'); /// The type which includes information such as the signature of this class. + static const nullableType = $MyInterfaceConsumer$NullableType(); static const type = $MyInterfaceConsumer$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory MyInterfaceConsumer() { return MyInterfaceConsumer.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -5556,58 +7060,57 @@ class MyInterfaceConsumer extends _$jni.JObject { r'(Lcom/github/dart_lang/jnigen/interfaces/MyInterface;Ljava/lang/String;IZCDLjava/lang/Object;)V', ); - static final _consumeOnAnotherThread = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _consumeOnAnotherThread = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Double, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Double, + jni$_.Pointer )>)>>('globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, int, int, int, double, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `static public void consumeOnAnotherThread(com.github.dart_lang.jnigen.interfaces.MyInterface myInterface, java.lang.String s, int a, boolean b, char c, double d, T t)` - static void consumeOnAnotherThread<$T extends _$jni.JObject>( - MyInterface<$T> myInterface, - _$jni.JString s, - int a, - bool b, + jni$_.Pointer)>(); + + /// from: `static public void consumeOnAnotherThread(com.github.dart_lang.jnigen.interfaces.MyInterface myInterface, java.lang.String string, int i, boolean z, char c, double d, T object)` + static void consumeOnAnotherThread<$T extends jni$_.JObject?>( + MyInterface<$T?>? myInterface, + jni$_.JString? string, + int i, + bool z, int c, double d, - $T t, { - _$jni.JObjType<$T>? T, + $T? object, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - t.$type, - (myInterface.$type as $MyInterface$Type<_$core.dynamic>).T, - ]) as _$jni.JObjType<$T>; + final _$myInterface = myInterface?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$object = object?.reference ?? jni$_.jNullReference; _consumeOnAnotherThread( _class.reference.pointer, - _id_consumeOnAnotherThread as _$jni.JMethodIDPtr, - myInterface.reference.pointer, - s.reference.pointer, - a, - b ? 1 : 0, + _id_consumeOnAnotherThread as jni$_.JMethodIDPtr, + _$myInterface.pointer, + _$string.pointer, + i, + z ? 1 : 0, c, d, - t.reference.pointer) + _$object.pointer) .check(); } @@ -5616,89 +7119,134 @@ class MyInterfaceConsumer extends _$jni.JObject { r'(Lcom/github/dart_lang/jnigen/interfaces/MyInterface;Ljava/lang/String;IZCDLjava/lang/Object;)V', ); - static final _consumeOnSameThread = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _consumeOnSameThread = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32, - _$jni.Int32, - _$jni.Double, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Double, + jni$_.Pointer )>)>>('globalEnv_CallStaticVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, int, int, int, double, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `static public void consumeOnSameThread(com.github.dart_lang.jnigen.interfaces.MyInterface myInterface, java.lang.String s, int a, boolean b, char c, double d, T t)` - static void consumeOnSameThread<$T extends _$jni.JObject>( - MyInterface<$T> myInterface, - _$jni.JString s, - int a, - bool b, + jni$_.Pointer)>(); + + /// from: `static public void consumeOnSameThread(com.github.dart_lang.jnigen.interfaces.MyInterface myInterface, java.lang.String string, int i, boolean z, char c, double d, T object)` + static void consumeOnSameThread<$T extends jni$_.JObject?>( + MyInterface<$T?>? myInterface, + jni$_.JString? string, + int i, + bool z, int c, double d, - $T t, { - _$jni.JObjType<$T>? T, + $T? object, { + required jni$_.JObjType<$T> T, }) { - T ??= _$jni.lowestCommonSuperType([ - t.$type, - (myInterface.$type as $MyInterface$Type<_$core.dynamic>).T, - ]) as _$jni.JObjType<$T>; + final _$myInterface = myInterface?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$object = object?.reference ?? jni$_.jNullReference; _consumeOnSameThread( _class.reference.pointer, - _id_consumeOnSameThread as _$jni.JMethodIDPtr, - myInterface.reference.pointer, - s.reference.pointer, - a, - b ? 1 : 0, + _id_consumeOnSameThread as jni$_.JMethodIDPtr, + _$myInterface.pointer, + _$string.pointer, + i, + z ? 1 : 0, c, d, - t.reference.pointer) + _$object.pointer) .check(); } } -final class $MyInterfaceConsumer$Type - extends _$jni.JObjType { - @_$jni.internal - const $MyInterfaceConsumer$Type(); +final class $MyInterfaceConsumer$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $MyInterfaceConsumer$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/MyInterfaceConsumer;'; - @_$jni.internal - @_$core.override - MyInterfaceConsumer fromReference(_$jni.JReference reference) => - MyInterfaceConsumer.fromReference(reference); + @jni$_.internal + @core$_.override + MyInterfaceConsumer? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : MyInterfaceConsumer.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($MyInterfaceConsumer$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyInterfaceConsumer$NullableType) && + other is $MyInterfaceConsumer$NullableType; + } +} + +final class $MyInterfaceConsumer$Type + extends jni$_.JObjType { + @jni$_.internal + const $MyInterfaceConsumer$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/MyInterfaceConsumer;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MyInterfaceConsumer fromReference(jni$_.JReference reference) => + MyInterfaceConsumer.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $MyInterfaceConsumer$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($MyInterfaceConsumer$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyInterfaceConsumer$Type) && other is $MyInterfaceConsumer$Type; @@ -5706,54 +7254,55 @@ final class $MyInterfaceConsumer$Type } /// from: `com.github.dart_lang.jnigen.interfaces.MyRunnable` -class MyRunnable extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class MyRunnable extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal MyRunnable.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/MyRunnable'); /// The type which includes information such as the signature of this class. + static const nullableType = $MyRunnable$NullableType(); static const type = $MyRunnable$Type(); static final _id_run = _class.instanceMethodId( r'run', r'()V', ); - static final _run = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _run = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public abstract void run()` void run() { - _run(reference.pointer, _id_run as _$jni.JMethodIDPtr).check(); + _run(reference.pointer, _id_run as jni$_.JMethodIDPtr).check(); } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -5761,43 +7310,43 @@ class MyRunnable extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'run()V') { _$impls[$p]!.run(); - return _$jni.nullptr; + return jni$_.nullptr; } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, + jni$_.JImplementer implementer, $MyRunnable $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'com.github.dart_lang.jnigen.interfaces.MyRunnable', @@ -5814,13 +7363,13 @@ class MyRunnable extends _$jni.JObject { factory MyRunnable.implement( $MyRunnable $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); return MyRunnable.fromReference( $i.implementReference(), ); } - static _$core.Map get $impls => _$impls; + static core$_.Map get $impls => _$impls; } abstract base mixin class $MyRunnable { @@ -5847,53 +7396,98 @@ final class _$MyRunnable with $MyRunnable { } } -final class $MyRunnable$Type extends _$jni.JObjType { - @_$jni.internal - const $MyRunnable$Type(); +final class $MyRunnable$NullableType extends jni$_.JObjType { + @jni$_.internal + const $MyRunnable$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/MyRunnable;'; - @_$jni.internal - @_$core.override - MyRunnable fromReference(_$jni.JReference reference) => - MyRunnable.fromReference(reference); + @jni$_.internal + @core$_.override + MyRunnable? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : MyRunnable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($MyRunnable$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyRunnable$NullableType) && + other is $MyRunnable$NullableType; + } +} + +final class $MyRunnable$Type extends jni$_.JObjType { + @jni$_.internal + const $MyRunnable$Type(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/MyRunnable;'; + + @jni$_.internal + @core$_.override + MyRunnable fromReference(jni$_.JReference reference) => + MyRunnable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $MyRunnable$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($MyRunnable$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyRunnable$Type) && other is $MyRunnable$Type; } } /// from: `com.github.dart_lang.jnigen.interfaces.MyRunnableRunner` -class MyRunnableRunner extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class MyRunnableRunner extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal MyRunnableRunner.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/MyRunnableRunner'); /// The type which includes information such as the signature of this class. + static const nullableType = $MyRunnableRunner$NullableType(); static const type = $MyRunnableRunner$Type(); static final _id_error = _class.instanceFieldId( r'error', @@ -5902,35 +7496,37 @@ class MyRunnableRunner extends _$jni.JObject { /// from: `public java.lang.Throwable error` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject get error => _id_error.get(this, const _$jni.JObjectType()); + jni$_.JObject? get error => + _id_error.get(this, const jni$_.JObjectNullableType()); /// from: `public java.lang.Throwable error` /// The returned object must be released after use, by calling the [release] method. - set error(_$jni.JObject value) => - _id_error.set(this, const _$jni.JObjectType(), value); + set error(jni$_.JObject? value) => + _id_error.set(this, const jni$_.JObjectNullableType(), value); static final _id_new$ = _class.constructorId( r'(Lcom/github/dart_lang/jnigen/interfaces/MyRunnable;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void (com.github.dart_lang.jnigen.interfaces.MyRunnable runnable)` + /// from: `public void (com.github.dart_lang.jnigen.interfaces.MyRunnable myRunnable)` /// The returned object must be released after use, by calling the [release] method. factory MyRunnableRunner( - MyRunnable runnable, + MyRunnable? myRunnable, ) { + final _$myRunnable = myRunnable?.reference ?? jni$_.jNullReference; return MyRunnableRunner.fromReference(_new$(_class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, runnable.reference.pointer) + _id_new$ as jni$_.JMethodIDPtr, _$myRunnable.pointer) .reference); } @@ -5939,22 +7535,22 @@ class MyRunnableRunner extends _$jni.JObject { r'()V', ); - static final _runOnSameThread = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _runOnSameThread = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void runOnSameThread()` void runOnSameThread() { _runOnSameThread( - reference.pointer, _id_runOnSameThread as _$jni.JMethodIDPtr) + reference.pointer, _id_runOnSameThread as jni$_.JMethodIDPtr) .check(); } @@ -5963,22 +7559,22 @@ class MyRunnableRunner extends _$jni.JObject { r'()V', ); - static final _runOnAnotherThread = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _runOnAnotherThread = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void runOnAnotherThread()` void runOnAnotherThread() { _runOnAnotherThread( - reference.pointer, _id_runOnAnotherThread as _$jni.JMethodIDPtr) + reference.pointer, _id_runOnAnotherThread as jni$_.JMethodIDPtr) .check(); } @@ -5987,52 +7583,98 @@ class MyRunnableRunner extends _$jni.JObject { r'()V', ); - static final _runOnAnotherThreadAndJoin = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _runOnAnotherThreadAndJoin = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_CallVoidMethod') .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void runOnAnotherThreadAndJoin()` void runOnAnotherThreadAndJoin() { _runOnAnotherThreadAndJoin(reference.pointer, - _id_runOnAnotherThreadAndJoin as _$jni.JMethodIDPtr) + _id_runOnAnotherThreadAndJoin as jni$_.JMethodIDPtr) .check(); } } -final class $MyRunnableRunner$Type extends _$jni.JObjType { - @_$jni.internal - const $MyRunnableRunner$Type(); +final class $MyRunnableRunner$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $MyRunnableRunner$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/MyRunnableRunner;'; - @_$jni.internal - @_$core.override - MyRunnableRunner fromReference(_$jni.JReference reference) => - MyRunnableRunner.fromReference(reference); + @jni$_.internal + @core$_.override + MyRunnableRunner? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : MyRunnableRunner.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($MyRunnableRunner$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyRunnableRunner$NullableType) && + other is $MyRunnableRunner$NullableType; + } +} + +final class $MyRunnableRunner$Type extends jni$_.JObjType { + @jni$_.internal + const $MyRunnableRunner$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/MyRunnableRunner;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MyRunnableRunner fromReference(jni$_.JReference reference) => + MyRunnableRunner.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $MyRunnableRunner$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($MyRunnableRunner$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyRunnableRunner$Type) && other is $MyRunnableRunner$Type; @@ -6040,77 +7682,125 @@ final class $MyRunnableRunner$Type extends _$jni.JObjType { } /// from: `com.github.dart_lang.jnigen.interfaces.StringConversionException` -class StringConversionException extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class StringConversionException extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal StringConversionException.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/StringConversionException'); /// The type which includes information such as the signature of this class. + static const nullableType = $StringConversionException$NullableType(); static const type = $StringConversionException$Type(); static final _id_new$ = _class.constructorId( r'(Ljava/lang/String;)V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void (java.lang.String message)` + /// from: `public void (java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. factory StringConversionException( - _$jni.JString message, + jni$_.JString? string, ) { + final _$string = string?.reference ?? jni$_.jNullReference; return StringConversionException.fromReference(_new$( _class.reference.pointer, - _id_new$ as _$jni.JMethodIDPtr, - message.reference.pointer) + _id_new$ as jni$_.JMethodIDPtr, + _$string.pointer) .reference); } } -final class $StringConversionException$Type - extends _$jni.JObjType { - @_$jni.internal - const $StringConversionException$Type(); +final class $StringConversionException$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $StringConversionException$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/StringConversionException;'; - @_$jni.internal - @_$core.override - StringConversionException fromReference(_$jni.JReference reference) => - StringConversionException.fromReference(reference); + @jni$_.internal + @core$_.override + StringConversionException? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : StringConversionException.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($StringConversionException$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringConversionException$NullableType) && + other is $StringConversionException$NullableType; + } +} + +final class $StringConversionException$Type + extends jni$_.JObjType { + @jni$_.internal + const $StringConversionException$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/StringConversionException;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringConversionException fromReference(jni$_.JReference reference) => + StringConversionException.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $StringConversionException$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($StringConversionException$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringConversionException$Type) && other is $StringConversionException$Type; @@ -6118,57 +7808,59 @@ final class $StringConversionException$Type } /// from: `com.github.dart_lang.jnigen.interfaces.StringConverter` -class StringConverter extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class StringConverter extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal StringConverter.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/StringConverter'); /// The type which includes information such as the signature of this class. + static const nullableType = $StringConverter$NullableType(); static const type = $StringConverter$Type(); static final _id_parseToInt = _class.instanceMethodId( r'parseToInt', r'(Ljava/lang/String;)I', ); - static final _parseToInt = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + static final _parseToInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( 'globalEnv_CallIntMethod') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public abstract int parseToInt(java.lang.String s)` + /// from: `public abstract int parseToInt(java.lang.String string)` int parseToInt( - _$jni.JString s, + jni$_.JString? string, ) { - return _parseToInt(reference.pointer, _id_parseToInt as _$jni.JMethodIDPtr, - s.reference.pointer) + final _$string = string?.reference ?? jni$_.jNullReference; + return _parseToInt(reference.pointer, _id_parseToInt as jni$_.JMethodIDPtr, + _$string.pointer) .integer; } /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, ) { return _$invokeMethod( port, - _$jni.MethodInvocation.fromAddresses( + jni$_.MethodInvocation.fromAddresses( 0, descriptor.address, args.address, @@ -6176,45 +7868,45 @@ class StringConverter extends _$jni.JObject { ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); - static _$jni.Pointer<_$jni.Void> _$invokeMethod( + static jni$_.Pointer _$invokeMethod( int $p, - _$jni.MethodInvocation $i, + jni$_.MethodInvocation $i, ) { try { final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'parseToInt(Ljava/lang/String;)I') { final $r = _$impls[$p]!.parseToInt( - $a[0].as(const _$jni.JStringType(), releaseOriginal: true), + $a![0]?.as(const jni$_.JStringType(), releaseOriginal: true), ); - return _$jni.JInteger($r).reference.toPointer(); + return jni$_.JInteger($r).reference.toPointer(); } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, + jni$_.JImplementer implementer, $StringConverter $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'com.github.dart_lang.jnigen.interfaces.StringConverter', @@ -6229,7 +7921,7 @@ class StringConverter extends _$jni.JObject { factory StringConverter.implement( $StringConverter $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); return StringConverter.fromReference( $i.implementReference(), @@ -6239,50 +7931,95 @@ class StringConverter extends _$jni.JObject { abstract base mixin class $StringConverter { factory $StringConverter({ - required int Function(_$jni.JString s) parseToInt, + required int Function(jni$_.JString? string) parseToInt, }) = _$StringConverter; - int parseToInt(_$jni.JString s); + int parseToInt(jni$_.JString? string); } final class _$StringConverter with $StringConverter { _$StringConverter({ - required int Function(_$jni.JString s) parseToInt, + required int Function(jni$_.JString? string) parseToInt, }) : _parseToInt = parseToInt; - final int Function(_$jni.JString s) _parseToInt; + final int Function(jni$_.JString? string) _parseToInt; - int parseToInt(_$jni.JString s) { - return _parseToInt(s); + int parseToInt(jni$_.JString? string) { + return _parseToInt(string); } } -final class $StringConverter$Type extends _$jni.JObjType { - @_$jni.internal - const $StringConverter$Type(); +final class $StringConverter$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $StringConverter$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/StringConverter;'; - @_$jni.internal - @_$core.override - StringConverter fromReference(_$jni.JReference reference) => - StringConverter.fromReference(reference); + @jni$_.internal + @core$_.override + StringConverter? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : StringConverter.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($StringConverter$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringConverter$NullableType) && + other is $StringConverter$NullableType; + } +} + +final class $StringConverter$Type extends jni$_.JObjType { + @jni$_.internal + const $StringConverter$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/StringConverter;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringConverter fromReference(jni$_.JReference reference) => + StringConverter.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $StringConverter$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($StringConverter$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringConverter$Type) && other is $StringConverter$Type; @@ -6290,43 +8027,44 @@ final class $StringConverter$Type extends _$jni.JObjType { } /// from: `com.github.dart_lang.jnigen.interfaces.StringConverterConsumer` -class StringConverterConsumer extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class StringConverterConsumer extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal StringConverterConsumer.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/interfaces/StringConverterConsumer'); /// The type which includes information such as the signature of this class. + static const nullableType = $StringConverterConsumer$NullableType(); static const type = $StringConverterConsumer$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory StringConverterConsumer() { return StringConverterConsumer.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } @@ -6335,35 +8073,38 @@ class StringConverterConsumer extends _$jni.JObject { r'(Lcom/github/dart_lang/jnigen/interfaces/StringConverter;Ljava/lang/String;)Ljava/lang/Integer;', ); - static final _consumeOnSameThread = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _consumeOnSameThread = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `static public java.lang.Integer consumeOnSameThread(com.github.dart_lang.jnigen.interfaces.StringConverter stringConverter, java.lang.String s)` + /// from: `static public java.lang.Integer consumeOnSameThread(com.github.dart_lang.jnigen.interfaces.StringConverter stringConverter, java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JInteger consumeOnSameThread( - StringConverter stringConverter, - _$jni.JString s, + static jni$_.JInteger? consumeOnSameThread( + StringConverter? stringConverter, + jni$_.JString? string, ) { + final _$stringConverter = + stringConverter?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; return _consumeOnSameThread( _class.reference.pointer, - _id_consumeOnSameThread as _$jni.JMethodIDPtr, - stringConverter.reference.pointer, - s.reference.pointer) - .object(const _$jni.JIntegerType()); + _id_consumeOnSameThread as jni$_.JMethodIDPtr, + _$stringConverter.pointer, + _$string.pointer) + .object(const jni$_.JIntegerNullableType()); } static final _id_consumeOnAnotherThread = _class.staticMethodId( @@ -6371,65 +8112,114 @@ class StringConverterConsumer extends _$jni.JObject { r'(Lcom/github/dart_lang/jnigen/interfaces/StringConverter;Ljava/lang/String;)Ljava/util/concurrent/Future;', ); - static final _consumeOnAnotherThread = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< + static final _consumeOnAnotherThread = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> + jni$_.Pointer, + jni$_.Pointer )>)>>('globalEnv_CallStaticObjectMethod') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `static public java.util.concurrent.Future consumeOnAnotherThread(com.github.dart_lang.jnigen.interfaces.StringConverter stringConverter, java.lang.String s)` + /// from: `static public java.util.concurrent.Future consumeOnAnotherThread(com.github.dart_lang.jnigen.interfaces.StringConverter stringConverter, java.lang.String string)` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JObject consumeOnAnotherThread( - StringConverter stringConverter, - _$jni.JString s, + static jni$_.JObject? consumeOnAnotherThread( + StringConverter? stringConverter, + jni$_.JString? string, ) { + final _$stringConverter = + stringConverter?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; return _consumeOnAnotherThread( _class.reference.pointer, - _id_consumeOnAnotherThread as _$jni.JMethodIDPtr, - stringConverter.reference.pointer, - s.reference.pointer) - .object(const _$jni.JObjectType()); + _id_consumeOnAnotherThread as jni$_.JMethodIDPtr, + _$stringConverter.pointer, + _$string.pointer) + .object(const jni$_.JObjectNullableType()); } } -final class $StringConverterConsumer$Type - extends _$jni.JObjType { - @_$jni.internal - const $StringConverterConsumer$Type(); +final class $StringConverterConsumer$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $StringConverterConsumer$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/interfaces/StringConverterConsumer;'; - @_$jni.internal - @_$core.override - StringConverterConsumer fromReference(_$jni.JReference reference) => - StringConverterConsumer.fromReference(reference); + @jni$_.internal + @core$_.override + StringConverterConsumer? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : StringConverterConsumer.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($StringConverterConsumer$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($StringConverterConsumer$NullableType) && + other is $StringConverterConsumer$NullableType; + } +} + +final class $StringConverterConsumer$Type + extends jni$_.JObjType { + @jni$_.internal + const $StringConverterConsumer$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/interfaces/StringConverterConsumer;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + StringConverterConsumer fromReference(jni$_.JReference reference) => + StringConverterConsumer.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $StringConverterConsumer$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($StringConverterConsumer$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($StringConverterConsumer$Type) && other is $StringConverterConsumer$Type; @@ -6437,29 +8227,37 @@ final class $StringConverterConsumer$Type } /// from: `com.github.dart_lang.jnigen.inheritance.BaseClass` -class BaseClass<$T extends _$jni.JObject> extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class BaseClass<$T extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal BaseClass.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), + jni$_.JReference reference, + ) : $type = type<$T>(T), super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/inheritance/BaseClass'); /// The type which includes information such as the signature of this class. - static $BaseClass$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $BaseClass$NullableType<$T> nullableType<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + ) { + return $BaseClass$NullableType<$T>( + T, + ); + } + + static $BaseClass$Type<$T> type<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, ) { - return $BaseClass$Type( + return $BaseClass$Type<$T>( T, ); } @@ -6468,62 +8266,115 @@ class BaseClass<$T extends _$jni.JObject> extends _$jni.JObject { r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory BaseClass({ - required _$jni.JObjType<$T> T, + required jni$_.JObjType<$T> T, }) { - return BaseClass.fromReference( + return BaseClass<$T>.fromReference( T, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $BaseClass$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $BaseClass$NullableType<$T extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $BaseClass$Type( + @jni$_.internal + const $BaseClass$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/inheritance/BaseClass;'; - @_$jni.internal - @_$core.override - BaseClass<$T> fromReference(_$jni.JReference reference) => - BaseClass.fromReference(T, reference); + @jni$_.internal + @core$_.override + BaseClass<$T>? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : BaseClass<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($BaseClass$NullableType, T); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($BaseClass$NullableType<$T>) && + other is $BaseClass$NullableType<$T> && + T == other.T; + } +} + +final class $BaseClass$Type<$T extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + const $BaseClass$Type( + this.T, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/inheritance/BaseClass;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + BaseClass<$T> fromReference(jni$_.JReference reference) => + BaseClass<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $BaseClass$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => Object.hash($BaseClass$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($BaseClass$Type<$T>) && other is $BaseClass$Type<$T> && @@ -6532,29 +8383,38 @@ final class $BaseClass$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.inheritance.GenericDerivedClass` -class GenericDerivedClass<$T extends _$jni.JObject> extends BaseClass<$T> { - @_$jni.internal - @_$core.override - final _$jni.JObjType> $type; +class GenericDerivedClass<$T extends jni$_.JObject?> extends BaseClass<$T?> { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; - @_$jni.internal - final _$jni.JObjType<$T> T; + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal + @jni$_.internal GenericDerivedClass.fromReference( this.T, - _$jni.JReference reference, - ) : $type = type(T), - super.fromReference(T, reference); + jni$_.JReference reference, + ) : $type = type<$T>(T), + super.fromReference(T.nullableType, reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/inheritance/GenericDerivedClass'); /// The type which includes information such as the signature of this class. - static $GenericDerivedClass$Type<$T> type<$T extends _$jni.JObject>( - _$jni.JObjType<$T> T, + static $GenericDerivedClass$NullableType<$T> + nullableType<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + ) { + return $GenericDerivedClass$NullableType<$T>( + T, + ); + } + + static $GenericDerivedClass$Type<$T> type<$T extends jni$_.JObject?>( + jni$_.JObjType<$T> T, ) { - return $GenericDerivedClass$Type( + return $GenericDerivedClass$Type<$T>( T, ); } @@ -6563,62 +8423,116 @@ class GenericDerivedClass<$T extends _$jni.JObject> extends BaseClass<$T> { r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory GenericDerivedClass({ - required _$jni.JObjType<$T> T, + required jni$_.JObjType<$T> T, }) { - return GenericDerivedClass.fromReference( + return GenericDerivedClass<$T>.fromReference( T, - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $GenericDerivedClass$Type<$T extends _$jni.JObject> - extends _$jni.JObjType> { - @_$jni.internal - final _$jni.JObjType<$T> T; +final class $GenericDerivedClass$NullableType<$T extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - const $GenericDerivedClass$Type( + @jni$_.internal + const $GenericDerivedClass$NullableType( this.T, ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/inheritance/GenericDerivedClass;'; - @_$jni.internal - @_$core.override - GenericDerivedClass<$T> fromReference(_$jni.JReference reference) => - GenericDerivedClass.fromReference(T, reference); + @jni$_.internal + @core$_.override + GenericDerivedClass<$T>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : GenericDerivedClass<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => $BaseClass$NullableType<$T?>(T.nullableType); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => Object.hash($GenericDerivedClass$NullableType, T); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($GenericDerivedClass$NullableType<$T>) && + other is $GenericDerivedClass$NullableType<$T> && + T == other.T; + } +} + +final class $GenericDerivedClass$Type<$T extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + const $GenericDerivedClass$Type( + this.T, + ); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => $BaseClass$Type(T); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/inheritance/GenericDerivedClass;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + GenericDerivedClass<$T> fromReference(jni$_.JReference reference) => + GenericDerivedClass<$T>.fromReference( + T, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => $BaseClass$NullableType<$T?>(T.nullableType); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $GenericDerivedClass$NullableType<$T>(T); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => Object.hash($GenericDerivedClass$Type, T); - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($GenericDerivedClass$Type<$T>) && other is $GenericDerivedClass$Type<$T> && @@ -6627,280 +8541,2602 @@ final class $GenericDerivedClass$Type<$T extends _$jni.JObject> } /// from: `com.github.dart_lang.jnigen.inheritance.SpecificDerivedClass` -class SpecificDerivedClass extends BaseClass<_$jni.JString> { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class SpecificDerivedClass extends BaseClass { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal SpecificDerivedClass.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, - super.fromReference(const _$jni.JStringType(), reference); + super.fromReference(const jni$_.JStringNullableType(), reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/inheritance/SpecificDerivedClass'); /// The type which includes information such as the signature of this class. + static const nullableType = $SpecificDerivedClass$NullableType(); static const type = $SpecificDerivedClass$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory SpecificDerivedClass() { return SpecificDerivedClass.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $SpecificDerivedClass$Type - extends _$jni.JObjType { - @_$jni.internal - const $SpecificDerivedClass$Type(); +final class $SpecificDerivedClass$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SpecificDerivedClass$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/inheritance/SpecificDerivedClass;'; - @_$jni.internal - @_$core.override - SpecificDerivedClass fromReference(_$jni.JReference reference) => - SpecificDerivedClass.fromReference(reference); + @jni$_.internal + @core$_.override + SpecificDerivedClass? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SpecificDerivedClass.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $BaseClass$NullableType( + jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($SpecificDerivedClass$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SpecificDerivedClass$NullableType) && + other is $SpecificDerivedClass$NullableType; + } +} + +final class $SpecificDerivedClass$Type + extends jni$_.JObjType { + @jni$_.internal + const $SpecificDerivedClass$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const $BaseClass$Type(_$jni.JStringType()); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/inheritance/SpecificDerivedClass;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + SpecificDerivedClass fromReference(jni$_.JReference reference) => + SpecificDerivedClass.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $BaseClass$NullableType( + jni$_.JStringNullableType()); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SpecificDerivedClass$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 2; - @_$core.override + @core$_.override int get hashCode => ($SpecificDerivedClass$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($SpecificDerivedClass$Type) && other is $SpecificDerivedClass$Type; } } -/// from: `com.github.dart_lang.jnigen.annotations.JsonSerializable$Case` -class JsonSerializable_Case extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; - - @_$jni.internal - JsonSerializable_Case.fromReference( - _$jni.JReference reference, - ) : $type = type, +/// from: `com.github.dart_lang.jnigen.annotations.Annotated$Nested` +class Annotated$Nested<$T extends jni$_.JObject?, $U extends jni$_.JObject, + $W extends jni$_.JObject, $V extends jni$_.JObject?> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; + + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$W> W; + + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + Annotated$Nested.fromReference( + this.T, + this.U, + this.W, + this.V, + jni$_.JReference reference, + ) : $type = type<$T, $U, $W, $V>(T, U, W, V), super.fromReference(reference); - static final _class = _$jni.JClass.forName( - r'com/github/dart_lang/jnigen/annotations/JsonSerializable$Case'); + static final _class = jni$_.JClass.forName( + r'com/github/dart_lang/jnigen/annotations/Annotated$Nested'); /// The type which includes information such as the signature of this class. - static const type = $JsonSerializable_Case$Type(); - static final _id_values = _class.staticMethodId( - r'values', - r'()[Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + static $Annotated$Nested$NullableType<$T, $U, $W, $V> nullableType< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $W extends jni$_.JObject, + $V extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + jni$_.JObjType<$W> W, + jni$_.JObjType<$V> V, + ) { + return $Annotated$Nested$NullableType<$T, $U, $W, $V>( + T, + U, + W, + V, + ); + } + + static $Annotated$Nested$Type<$T, $U, $W, $V> type< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $W extends jni$_.JObject, + $V extends jni$_.JObject?>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + jni$_.JObjType<$W> W, + jni$_.JObjType<$V> V, + ) { + return $Annotated$Nested$Type<$T, $U, $W, $V>( + T, + U, + W, + V, + ); + } + + static final _id_v = _class.instanceFieldId( + r'v', + r'Ljava/lang/Object;', ); - static final _values = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>>('globalEnv_CallStaticObjectMethod') - .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>(); + /// from: `public V v` + /// The returned object must be released after use, by calling the [release] method. + $V? get v => _id_v.get(this, V.nullableType); - /// from: `static public com.github.dart_lang.jnigen.annotations.JsonSerializable.Case[] values()` + /// from: `public V v` /// The returned object must be released after use, by calling the [release] method. - static _$jni.JArray values() { - return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) - .object(const _$jni.JArrayType($JsonSerializable_Case$Type())); - } + set v($V? value) => _id_v.set(this, V.nullableType, value); - static final _id_valueOf = _class.staticMethodId( - r'valueOf', - r'(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + static final _id_u = _class.instanceFieldId( + r'u', + r'Ljava/lang/Object;', ); - static final _valueOf = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( - 'globalEnv_CallStaticObjectMethod') + /// from: `public U u` + /// The returned object must be released after use, by calling the [release] method. + $U get u => _id_u.get(this, U); + + /// from: `public U u` + /// The returned object must be released after use, by calling the [release] method. + set u($U value) => _id_u.set(this, U, value); + + static final _id_new$ = _class.constructorId( + r'(Lcom/github/dart_lang/jnigen/annotations/Annotated;Ljava/lang/Object;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); - /// from: `static public com.github.dart_lang.jnigen.annotations.JsonSerializable.Case valueOf(java.lang.String name)` + /// from: `public void (com.github.dart_lang.jnigen.annotations.Annotated $outerClass, V object)` /// The returned object must be released after use, by calling the [release] method. - static JsonSerializable_Case valueOf( - _$jni.JString name, - ) { - return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, - name.reference.pointer) - .object(const $JsonSerializable_Case$Type()); + factory Annotated$Nested( + Annotated<$T?, $U, $W> $outerClass, + $V? object, { + jni$_.JObjType<$T>? T, + jni$_.JObjType<$U>? U, + jni$_.JObjType<$W>? W, + required jni$_.JObjType<$V> V, + }) { + T ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $Annotated$Type) + .T, + ]) as jni$_.JObjType<$T>; + U ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $Annotated$Type) + .U, + ]) as jni$_.JObjType<$U>; + W ??= jni$_.lowestCommonSuperType([ + ($outerClass.$type as $Annotated$Type) + .W, + ]) as jni$_.JObjType<$W>; + final _$$outerClass = $outerClass.reference; + final _$object = object?.reference ?? jni$_.jNullReference; + return Annotated$Nested<$T, $U, $W, $V>.fromReference( + T, + U, + W, + V, + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$$outerClass.pointer, _$object.pointer) + .reference); } } -final class $JsonSerializable_Case$Type - extends _$jni.JObjType { - @_$jni.internal - const $JsonSerializable_Case$Type(); +final class $Annotated$Nested$NullableType< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $W extends jni$_.JObject, + $V extends jni$_.JObject?> + extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - @_$core.override - String get signature => - r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;'; + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$W> W; - @_$jni.internal - @_$core.override - JsonSerializable_Case fromReference(_$jni.JReference reference) => - JsonSerializable_Case.fromReference(reference); + @jni$_.internal + final jni$_.JObjType<$V> V; - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + const $Annotated$Nested$NullableType( + this.T, + this.U, + this.W, + this.V, + ); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/Annotated$Nested;'; + + @jni$_.internal + @core$_.override + Annotated$Nested<$T, $U, $W, $V>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Annotated$Nested<$T, $U, $W, $V>.fromReference( + T, + U, + W, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override - int get hashCode => ($JsonSerializable_Case$Type).hashCode; + @core$_.override + int get hashCode => Object.hash($Annotated$Nested$NullableType, T, U, W, V); - @_$core.override + @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($JsonSerializable_Case$Type) && - other is $JsonSerializable_Case$Type; + return other.runtimeType == + ($Annotated$Nested$NullableType<$T, $U, $W, $V>) && + other is $Annotated$Nested$NullableType<$T, $U, $W, $V> && + T == other.T && + U == other.U && + W == other.W && + V == other.V; } } -/// from: `com.github.dart_lang.jnigen.annotations.JsonSerializable` -class JsonSerializable extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +final class $Annotated$Nested$Type< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $W extends jni$_.JObject, + $V extends jni$_.JObject?> + extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; - @_$jni.internal - JsonSerializable.fromReference( - _$jni.JReference reference, - ) : $type = type, - super.fromReference(reference); + @jni$_.internal + final jni$_.JObjType<$U> U; - static final _class = _$jni.JClass.forName( - r'com/github/dart_lang/jnigen/annotations/JsonSerializable'); + @jni$_.internal + final jni$_.JObjType<$W> W; - /// The type which includes information such as the signature of this class. - static const type = $JsonSerializable$Type(); - static final _id_value = _class.instanceMethodId( - r'value', - r'()Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + @jni$_.internal + final jni$_.JObjType<$V> V; + + @jni$_.internal + const $Annotated$Nested$Type( + this.T, + this.U, + this.W, + this.V, ); - static final _value = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/Annotated$Nested;'; - /// from: `public abstract com.github.dart_lang.jnigen.annotations.JsonSerializable$Case value()` - /// The returned object must be released after use, by calling the [release] method. - JsonSerializable_Case value() { - return _value(reference.pointer, _id_value as _$jni.JMethodIDPtr) - .object(const $JsonSerializable_Case$Type()); + @jni$_.internal + @core$_.override + Annotated$Nested<$T, $U, $W, $V> fromReference(jni$_.JReference reference) => + Annotated$Nested<$T, $U, $W, $V>.fromReference( + T, + U, + W, + V, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $Annotated$Nested$NullableType<$T, $U, $W, $V>(T, U, W, V); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Annotated$Nested$Type, T, U, W, V); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Annotated$Nested$Type<$T, $U, $W, $V>) && + other is $Annotated$Nested$Type<$T, $U, $W, $V> && + T == other.T && + U == other.U && + W == other.W && + V == other.V; } +} - /// Maps a specific port to the implemented interface. - static final _$core.Map _$impls = {}; - static _$jni.JObjectPtr _$invoke( - int port, - _$jni.JObjectPtr descriptor, - _$jni.JObjectPtr args, +/// from: `com.github.dart_lang.jnigen.annotations.Annotated` +class Annotated<$T extends jni$_.JObject?, $U extends jni$_.JObject, + $W extends jni$_.JObject> extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType> $type; + + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$W> W; + + @jni$_.internal + Annotated.fromReference( + this.T, + this.U, + this.W, + jni$_.JReference reference, + ) : $type = type<$T, $U, $W>(T, U, W), + super.fromReference(reference); + + static final _class = jni$_.JClass.forName( + r'com/github/dart_lang/jnigen/annotations/Annotated'); + + /// The type which includes information such as the signature of this class. + static $Annotated$NullableType<$T, $U, $W> nullableType< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $W extends jni$_.JObject>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + jni$_.JObjType<$W> W, ) { - return _$invokeMethod( - port, - _$jni.MethodInvocation.fromAddresses( - 0, - descriptor.address, - args.address, - ), + return $Annotated$NullableType<$T, $U, $W>( + T, + U, + W, ); } - static final _$jni.Pointer< - _$jni.NativeFunction< - _$jni.JObjectPtr Function( - _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> - _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); - - static _$jni.Pointer<_$jni.Void> _$invokeMethod( - int $p, - _$jni.MethodInvocation $i, + static $Annotated$Type<$T, $U, $W> type<$T extends jni$_.JObject?, + $U extends jni$_.JObject, $W extends jni$_.JObject>( + jni$_.JObjType<$T> T, + jni$_.JObjType<$U> U, + jni$_.JObjType<$W> W, ) { - try { - final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + return $Annotated$Type<$T, $U, $W>( + T, + U, + W, + ); + } + + static final _id_t = _class.instanceFieldId( + r't', + r'Ljava/lang/Object;', + ); + + /// from: `public T t` + /// The returned object must be released after use, by calling the [release] method. + $T? get t => _id_t.get(this, T.nullableType); + + /// from: `public T t` + /// The returned object must be released after use, by calling the [release] method. + set t($T? value) => _id_t.set(this, T.nullableType, value); + + static final _id_u = _class.instanceFieldId( + r'u', + r'Ljava/lang/Object;', + ); + + /// from: `public U u` + /// The returned object must be released after use, by calling the [release] method. + $U get u => _id_u.get(this, U); + + /// from: `public U u` + /// The returned object must be released after use, by calling the [release] method. + set u($U value) => _id_u.set(this, U, value); + + static final _id_w = _class.instanceFieldId( + r'w', + r'Ljava/lang/Object;', + ); + + /// from: `public W w` + /// The returned object must be released after use, by calling the [release] method. + $W get w => _id_w.get(this, W); + + /// from: `public W w` + /// The returned object must be released after use, by calling the [release] method. + set w($W value) => _id_w.set(this, W, value); + + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (T object, U object1, W object2)` + /// The returned object must be released after use, by calling the [release] method. + factory Annotated( + $T? object, + $U object1, + $W object2, { + required jni$_.JObjType<$T> T, + jni$_.JObjType<$U>? U, + jni$_.JObjType<$W>? W, + }) { + U ??= jni$_.lowestCommonSuperType([ + object1.$type, + ]) as jni$_.JObjType<$U>; + W ??= jni$_.lowestCommonSuperType([ + object2.$type, + ]) as jni$_.JObjType<$W>; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$object1 = object1.reference; + final _$object2 = object2.reference; + return Annotated<$T, $U, $W>.fromReference( + T, + U, + W, + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr, + _$object.pointer, _$object1.pointer, _$object2.pointer) + .reference); + } + + static final _id_hello = _class.instanceMethodId( + r'hello', + r'()Ljava/lang/String;', + ); + + static final _hello = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String hello()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString hello() { + return _hello(reference.pointer, _id_hello as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); + } + + static final _id_nullableHello = _class.instanceMethodId( + r'nullableHello', + r'(Z)Ljava/lang/String;', + ); + + static final _nullableHello = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.lang.String nullableHello(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? nullableHello( + bool z, + ) { + return _nullableHello(reference.pointer, + _id_nullableHello as jni$_.JMethodIDPtr, z ? 1 : 0) + .object(const jni$_.JStringNullableType()); + } + + static final _id_echo = _class.instanceMethodId( + r'echo', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _echo = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.String echo(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString echo( + jni$_.JString string, + ) { + final _$string = string.reference; + return _echo( + reference.pointer, _id_echo as jni$_.JMethodIDPtr, _$string.pointer) + .object(const jni$_.JStringType()); + } + + static final _id_nullableEcho = _class.instanceMethodId( + r'nullableEcho', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _nullableEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.String nullableEcho(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? nullableEcho( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _nullableEcho(reference.pointer, + _id_nullableEcho as jni$_.JMethodIDPtr, _$string.pointer) + .object(const jni$_.JStringNullableType()); + } + + static final _id_array = _class.instanceMethodId( + r'array', + r'()[Ljava/lang/String;', + ); + + static final _array = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String[] array()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray array() { + return _array(reference.pointer, _id_array as jni$_.JMethodIDPtr) + .object>( + const jni$_.JArrayType(jni$_.JStringType())); + } + + static final _id_arrayOfNullable = _class.instanceMethodId( + r'arrayOfNullable', + r'()[Ljava/lang/String;', + ); + + static final _arrayOfNullable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String[] arrayOfNullable()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray arrayOfNullable() { + return _arrayOfNullable( + reference.pointer, _id_arrayOfNullable as jni$_.JMethodIDPtr) + .object>( + const jni$_.JArrayType( + jni$_.JStringNullableType())); + } + + static final _id_nullableArray = _class.instanceMethodId( + r'nullableArray', + r'(Z)[Ljava/lang/String;', + ); + + static final _nullableArray = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.lang.String[] nullableArray(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? nullableArray( + bool z, + ) { + return _nullableArray(reference.pointer, + _id_nullableArray as jni$_.JMethodIDPtr, z ? 1 : 0) + .object?>( + const jni$_.JArrayNullableType(jni$_.JStringType())); + } + + static final _id_nullableArrayOfNullable = _class.instanceMethodId( + r'nullableArrayOfNullable', + r'(Z)[Ljava/lang/String;', + ); + + static final _nullableArrayOfNullable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.lang.String[] nullableArrayOfNullable(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? nullableArrayOfNullable( + bool z, + ) { + return _nullableArrayOfNullable(reference.pointer, + _id_nullableArrayOfNullable as jni$_.JMethodIDPtr, z ? 1 : 0) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JStringNullableType())); + } + + static final _id_list = _class.instanceMethodId( + r'list', + r'()Ljava/util/List;', + ); + + static final _list = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List list()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList list() { + return _list(reference.pointer, _id_list as jni$_.JMethodIDPtr) + .object>( + const jni$_.JListType(jni$_.JStringType())); + } + + static final _id_listOfNullable = _class.instanceMethodId( + r'listOfNullable', + r'()Ljava/util/List;', + ); + + static final _listOfNullable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List listOfNullable()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList listOfNullable() { + return _listOfNullable( + reference.pointer, _id_listOfNullable as jni$_.JMethodIDPtr) + .object>( + const jni$_.JListType(jni$_.JStringNullableType())); + } + + static final _id_nullableList = _class.instanceMethodId( + r'nullableList', + r'(Z)Ljava/util/List;', + ); + + static final _nullableList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List nullableList(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList? nullableList( + bool z, + ) { + return _nullableList(reference.pointer, + _id_nullableList as jni$_.JMethodIDPtr, z ? 1 : 0) + .object?>( + const jni$_.JListNullableType(jni$_.JStringType())); + } + + static final _id_nullableListOfNullable = _class.instanceMethodId( + r'nullableListOfNullable', + r'(Z)Ljava/util/List;', + ); + + static final _nullableListOfNullable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List nullableListOfNullable(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList? nullableListOfNullable( + bool z, + ) { + return _nullableListOfNullable(reference.pointer, + _id_nullableListOfNullable as jni$_.JMethodIDPtr, z ? 1 : 0) + .object?>( + const jni$_.JListNullableType( + jni$_.JStringNullableType())); + } + + static final _id_classGenericEcho = _class.instanceMethodId( + r'classGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _classGenericEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T classGenericEcho(T object)` + /// The returned object must be released after use, by calling the [release] method. + $T classGenericEcho( + $T object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _classGenericEcho(reference.pointer, + _id_classGenericEcho as jni$_.JMethodIDPtr, _$object.pointer) + .object<$T>(T); + } + + static final _id_nullableClassGenericEcho = _class.instanceMethodId( + r'nullableClassGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _nullableClassGenericEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T nullableClassGenericEcho(T object)` + /// The returned object must be released after use, by calling the [release] method. + $T? nullableClassGenericEcho( + $T? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _nullableClassGenericEcho( + reference.pointer, + _id_nullableClassGenericEcho as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_methodGenericEcho = _class.instanceMethodId( + r'methodGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _methodGenericEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V methodGenericEcho(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericEcho<$V extends jni$_.JObject?>( + $V object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _methodGenericEcho(reference.pointer, + _id_methodGenericEcho as jni$_.JMethodIDPtr, _$object.pointer) + .object<$V>(V); + } + + static final _id_methodGenericEcho2 = _class.instanceMethodId( + r'methodGenericEcho2', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _methodGenericEcho2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V methodGenericEcho2(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericEcho2<$V extends jni$_.JObject>( + $V object, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + object.$type, + ]) as jni$_.JObjType<$V>; + final _$object = object.reference; + return _methodGenericEcho2(reference.pointer, + _id_methodGenericEcho2 as jni$_.JMethodIDPtr, _$object.pointer) + .object<$V>(V); + } + + static final _id_methodGenericEcho3 = _class.instanceMethodId( + r'methodGenericEcho3', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _methodGenericEcho3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V methodGenericEcho3(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V methodGenericEcho3<$V extends jni$_.JObject>( + $V object, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + object.$type, + ]) as jni$_.JObjType<$V>; + final _$object = object.reference; + return _methodGenericEcho3(reference.pointer, + _id_methodGenericEcho3 as jni$_.JMethodIDPtr, _$object.pointer) + .object<$V>(V); + } + + static final _id_nullableReturnMethodGenericEcho = _class.instanceMethodId( + r'nullableReturnMethodGenericEcho', + r'(Ljava/lang/Object;Z)Ljava/lang/Object;', + ); + + static final _nullableReturnMethodGenericEcho = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); + + /// from: `public V nullableReturnMethodGenericEcho(V object, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + $V? nullableReturnMethodGenericEcho<$V extends jni$_.JObject?>( + $V object, + bool z, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _nullableReturnMethodGenericEcho( + reference.pointer, + _id_nullableReturnMethodGenericEcho as jni$_.JMethodIDPtr, + _$object.pointer, + z ? 1 : 0) + .object<$V?>(V.nullableType); + } + + static final _id_nullableReturnMethodGenericEcho2 = _class.instanceMethodId( + r'nullableReturnMethodGenericEcho2', + r'(Ljava/lang/Object;Z)Ljava/lang/Object;', + ); + + static final _nullableReturnMethodGenericEcho2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); + + /// from: `public V nullableReturnMethodGenericEcho2(V object, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + $V? nullableReturnMethodGenericEcho2<$V extends jni$_.JObject>( + $V object, + bool z, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + object.$type, + ]) as jni$_.JObjType<$V>; + final _$object = object.reference; + return _nullableReturnMethodGenericEcho2( + reference.pointer, + _id_nullableReturnMethodGenericEcho2 as jni$_.JMethodIDPtr, + _$object.pointer, + z ? 1 : 0) + .object<$V?>(V.nullableType); + } + + static final _id_nullableMethodGenericEcho = _class.instanceMethodId( + r'nullableMethodGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _nullableMethodGenericEcho = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V nullableMethodGenericEcho(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V nullableMethodGenericEcho<$V extends jni$_.JObject?>( + $V object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _nullableMethodGenericEcho( + reference.pointer, + _id_nullableMethodGenericEcho as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$V>(V); + } + + static final _id_noAnnotationMethodGenericEcho = _class.instanceMethodId( + r'noAnnotationMethodGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _noAnnotationMethodGenericEcho = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V noAnnotationMethodGenericEcho(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V? noAnnotationMethodGenericEcho<$V extends jni$_.JObject?>( + $V? object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _noAnnotationMethodGenericEcho( + reference.pointer, + _id_noAnnotationMethodGenericEcho as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_nullableArgMethodGenericEcho = _class.instanceMethodId( + r'nullableArgMethodGenericEcho', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _nullableArgMethodGenericEcho = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V nullableArgMethodGenericEcho(V object)` + /// The returned object must be released after use, by calling the [release] method. + $V nullableArgMethodGenericEcho<$V extends jni$_.JObject>( + $V? object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _nullableArgMethodGenericEcho( + reference.pointer, + _id_nullableArgMethodGenericEcho as jni$_.JMethodIDPtr, + _$object.pointer) + .object<$V>(V); + } + + static final _id_classGenericList = _class.instanceMethodId( + r'classGenericList', + r'()Ljava/util/List;', + ); + + static final _classGenericList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List classGenericList()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$T> classGenericList() { + return _classGenericList( + reference.pointer, _id_classGenericList as jni$_.JMethodIDPtr) + .object>(jni$_.JListType<$T>(T)); + } + + static final _id_classGenericListOfNullable = _class.instanceMethodId( + r'classGenericListOfNullable', + r'()Ljava/util/List;', + ); + + static final _classGenericListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List classGenericListOfNullable()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$T?> classGenericListOfNullable() { + return _classGenericListOfNullable(reference.pointer, + _id_classGenericListOfNullable as jni$_.JMethodIDPtr) + .object>(jni$_.JListType<$T?>(T.nullableType)); + } + + static final _id_nullableClassGenericList = _class.instanceMethodId( + r'nullableClassGenericList', + r'(Z)Ljava/util/List;', + ); + + static final _nullableClassGenericList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List nullableClassGenericList(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$T>? nullableClassGenericList( + bool z, + ) { + return _nullableClassGenericList(reference.pointer, + _id_nullableClassGenericList as jni$_.JMethodIDPtr, z ? 1 : 0) + .object?>(jni$_.JListNullableType<$T>(T)); + } + + static final _id_nullableClassGenericListOfNullable = _class.instanceMethodId( + r'nullableClassGenericListOfNullable', + r'(Z)Ljava/util/List;', + ); + + static final _nullableClassGenericListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List nullableClassGenericListOfNullable(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$T?>? nullableClassGenericListOfNullable( + bool z, + ) { + return _nullableClassGenericListOfNullable( + reference.pointer, + _id_nullableClassGenericListOfNullable as jni$_.JMethodIDPtr, + z ? 1 : 0) + .object?>( + jni$_.JListNullableType<$T?>(T.nullableType)); + } + + static final _id_methodGenericList = _class.instanceMethodId( + r'methodGenericList', + r'(Ljava/lang/Object;)Ljava/util/List;', + ); + + static final _methodGenericList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.util.List methodGenericList(V object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$V> methodGenericList<$V extends jni$_.JObject?>( + $V object, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _methodGenericList(reference.pointer, + _id_methodGenericList as jni$_.JMethodIDPtr, _$object.pointer) + .object>(jni$_.JListType<$V>(V)); + } + + static final _id_methodGenericListOfNullable = _class.instanceMethodId( + r'methodGenericListOfNullable', + r'()Ljava/util/List;', + ); + + static final _methodGenericListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List methodGenericListOfNullable()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$V?> methodGenericListOfNullable<$V extends jni$_.JObject?>({ + required jni$_.JObjType<$V> V, + }) { + return _methodGenericListOfNullable(reference.pointer, + _id_methodGenericListOfNullable as jni$_.JMethodIDPtr) + .object>(jni$_.JListType<$V?>(V.nullableType)); + } + + static final _id_nullableMethodGenericList = _class.instanceMethodId( + r'nullableMethodGenericList', + r'(Ljava/lang/Object;Z)Ljava/util/List;', + ); + + static final _nullableMethodGenericList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); + + /// from: `public java.util.List nullableMethodGenericList(V object, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$V>? nullableMethodGenericList<$V extends jni$_.JObject?>( + $V object, + bool z, { + required jni$_.JObjType<$V> V, + }) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _nullableMethodGenericList( + reference.pointer, + _id_nullableMethodGenericList as jni$_.JMethodIDPtr, + _$object.pointer, + z ? 1 : 0) + .object?>(jni$_.JListNullableType<$V>(V)); + } + + static final _id_nullableMethodGenericListOfNullable = + _class.instanceMethodId( + r'nullableMethodGenericListOfNullable', + r'(Z)Ljava/util/List;', + ); + + static final _nullableMethodGenericListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List nullableMethodGenericListOfNullable(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList<$V?>? + nullableMethodGenericListOfNullable<$V extends jni$_.JObject?>( + bool z, { + required jni$_.JObjType<$V> V, + }) { + return _nullableMethodGenericListOfNullable( + reference.pointer, + _id_nullableMethodGenericListOfNullable as jni$_.JMethodIDPtr, + z ? 1 : 0) + .object?>( + jni$_.JListNullableType<$V?>(V.nullableType)); + } + + static final _id_firstOfClassGenericList = _class.instanceMethodId( + r'firstOfClassGenericList', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfClassGenericList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstOfClassGenericList(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstOfClassGenericList( + jni$_.JList<$T> list, + ) { + final _$list = list.reference; + return _firstOfClassGenericList(reference.pointer, + _id_firstOfClassGenericList as jni$_.JMethodIDPtr, _$list.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstOfClassGenericNullableList = _class.instanceMethodId( + r'firstOfClassGenericNullableList', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfClassGenericNullableList = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstOfClassGenericNullableList(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstOfClassGenericNullableList( + jni$_.JList<$T>? list, + ) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _firstOfClassGenericNullableList( + reference.pointer, + _id_firstOfClassGenericNullableList as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstOfClassGenericListOfNullable = _class.instanceMethodId( + r'firstOfClassGenericListOfNullable', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfClassGenericListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstOfClassGenericListOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstOfClassGenericListOfNullable( + jni$_.JList<$T?> list, + ) { + final _$list = list.reference; + return _firstOfClassGenericListOfNullable( + reference.pointer, + _id_firstOfClassGenericListOfNullable as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstOfClassGenericNullableListOfNullable = + _class.instanceMethodId( + r'firstOfClassGenericNullableListOfNullable', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfClassGenericNullableListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstOfClassGenericNullableListOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstOfClassGenericNullableListOfNullable( + jni$_.JList<$T?>? list, + ) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _firstOfClassGenericNullableListOfNullable( + reference.pointer, + _id_firstOfClassGenericNullableListOfNullable as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstOfMethodGenericList = _class.instanceMethodId( + r'firstOfMethodGenericList', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfMethodGenericList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstOfMethodGenericList(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstOfMethodGenericList<$V extends jni$_.JObject?>( + jni$_.JList<$V> list, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (list.$type as jni$_.JListType).E, + ]) as jni$_.JObjType<$V>; + final _$list = list.reference; + return _firstOfMethodGenericList(reference.pointer, + _id_firstOfMethodGenericList as jni$_.JMethodIDPtr, _$list.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstOfMethodGenericNullableList = _class.instanceMethodId( + r'firstOfMethodGenericNullableList', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfMethodGenericNullableList = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstOfMethodGenericNullableList(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstOfMethodGenericNullableList<$V extends jni$_.JObject?>( + jni$_.JList<$V>? list, { + required jni$_.JObjType<$V> V, + }) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _firstOfMethodGenericNullableList( + reference.pointer, + _id_firstOfMethodGenericNullableList as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstOfMethodGenericListOfNullable = _class.instanceMethodId( + r'firstOfMethodGenericListOfNullable', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfMethodGenericListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstOfMethodGenericListOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstOfMethodGenericListOfNullable<$V extends jni$_.JObject?>( + jni$_.JList<$V?> list, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (list.$type as jni$_.JListType).E, + ]) as jni$_.JObjType<$V>; + final _$list = list.reference; + return _firstOfMethodGenericListOfNullable( + reference.pointer, + _id_firstOfMethodGenericListOfNullable as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstOfMethodGenericNullableListOfNullable = + _class.instanceMethodId( + r'firstOfMethodGenericNullableListOfNullable', + r'(Ljava/util/List;)Ljava/lang/Object;', + ); + + static final _firstOfMethodGenericNullableListOfNullable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstOfMethodGenericNullableListOfNullable(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstOfMethodGenericNullableListOfNullable<$V extends jni$_.JObject?>( + jni$_.JList<$V?>? list, { + required jni$_.JObjType<$V> V, + }) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _firstOfMethodGenericNullableListOfNullable( + reference.pointer, + _id_firstOfMethodGenericNullableListOfNullable + as jni$_.JMethodIDPtr, + _$list.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstKeyOfComboMap = _class.instanceMethodId( + r'firstKeyOfComboMap', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstKeyOfComboMap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstKeyOfComboMap(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstKeyOfComboMap<$V extends jni$_.JObject?>( + jni$_.JMap<$T, $V> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstKeyOfComboMap(reference.pointer, + _id_firstKeyOfComboMap as jni$_.JMethodIDPtr, _$map.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstValueOfComboMap = _class.instanceMethodId( + r'firstValueOfComboMap', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstValueOfComboMap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstValueOfComboMap(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstValueOfComboMap<$V extends jni$_.JObject?>( + jni$_.JMap<$T, $V> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstValueOfComboMap(reference.pointer, + _id_firstValueOfComboMap as jni$_.JMethodIDPtr, _$map.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstKeyOfComboMapNullableKey = _class.instanceMethodId( + r'firstKeyOfComboMapNullableKey', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstKeyOfComboMapNullableKey = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstKeyOfComboMapNullableKey(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstKeyOfComboMapNullableKey<$V extends jni$_.JObject?>( + jni$_.JMap<$T?, $V> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstKeyOfComboMapNullableKey( + reference.pointer, + _id_firstKeyOfComboMapNullableKey as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstValueOfComboMapNullableKey = _class.instanceMethodId( + r'firstValueOfComboMapNullableKey', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstValueOfComboMapNullableKey = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstValueOfComboMapNullableKey(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstValueOfComboMapNullableKey<$V extends jni$_.JObject?>( + jni$_.JMap<$T?, $V> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstValueOfComboMapNullableKey( + reference.pointer, + _id_firstValueOfComboMapNullableKey as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstKeyOfComboMapNullableValue = _class.instanceMethodId( + r'firstKeyOfComboMapNullableValue', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstKeyOfComboMapNullableValue = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstKeyOfComboMapNullableValue(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstKeyOfComboMapNullableValue<$V extends jni$_.JObject?>( + jni$_.JMap<$T, $V?> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstKeyOfComboMapNullableValue( + reference.pointer, + _id_firstKeyOfComboMapNullableValue as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstValueOfComboMapNullableValue = _class.instanceMethodId( + r'firstValueOfComboMapNullableValue', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstValueOfComboMapNullableValue = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstValueOfComboMapNullableValue(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstValueOfComboMapNullableValue<$V extends jni$_.JObject?>( + jni$_.JMap<$T, $V?> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstValueOfComboMapNullableValue( + reference.pointer, + _id_firstValueOfComboMapNullableValue as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstKeyOfComboMapNullableKeyAndValue = + _class.instanceMethodId( + r'firstKeyOfComboMapNullableKeyAndValue', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstKeyOfComboMapNullableKeyAndValue = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public T firstKeyOfComboMapNullableKeyAndValue(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $T? firstKeyOfComboMapNullableKeyAndValue<$V extends jni$_.JObject?>( + jni$_.JMap<$T?, $V?> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstKeyOfComboMapNullableKeyAndValue( + reference.pointer, + _id_firstKeyOfComboMapNullableKeyAndValue as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$T?>(T.nullableType); + } + + static final _id_firstValueOfComboMapNullableKeyAndValue = + _class.instanceMethodId( + r'firstValueOfComboMapNullableKeyAndValue', + r'(Ljava/util/Map;)Ljava/lang/Object;', + ); + + static final _firstValueOfComboMapNullableKeyAndValue = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public V firstValueOfComboMapNullableKeyAndValue(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + $V? firstValueOfComboMapNullableKeyAndValue<$V extends jni$_.JObject?>( + jni$_.JMap<$T?, $V?> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstValueOfComboMapNullableKeyAndValue( + reference.pointer, + _id_firstValueOfComboMapNullableKeyAndValue as jni$_.JMethodIDPtr, + _$map.pointer) + .object<$V?>(V.nullableType); + } + + static final _id_firstEntryOfComboMap = _class.instanceMethodId( + r'firstEntryOfComboMap', + r'(Ljava/util/Map;)Ljava/util/Map$Entry;', + ); + + static final _firstEntryOfComboMap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.util.Map$Entry firstEntryOfComboMap(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? firstEntryOfComboMap<$V extends jni$_.JObject?>( + jni$_.JMap<$T, $V> map, { + jni$_.JObjType<$V>? V, + }) { + V ??= jni$_.lowestCommonSuperType([ + (map.$type as jni$_.JMapType).V, + ]) as jni$_.JObjType<$V>; + final _$map = map.reference; + return _firstEntryOfComboMap(reference.pointer, + _id_firstEntryOfComboMap as jni$_.JMethodIDPtr, _$map.pointer) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_getW = _class.instanceMethodId( + r'getW', + r'()Ljava/lang/Object;', + ); + + static final _getW = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public W getW()` + /// The returned object must be released after use, by calling the [release] method. + $W getW() { + return _getW(reference.pointer, _id_getW as jni$_.JMethodIDPtr) + .object<$W>(W); + } + + static final _id_nullableGetW = _class.instanceMethodId( + r'nullableGetW', + r'(Z)Ljava/lang/Object;', + ); + + static final _nullableGetW = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public W nullableGetW(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + $W? nullableGetW( + bool z, + ) { + return _nullableGetW(reference.pointer, + _id_nullableGetW as jni$_.JMethodIDPtr, z ? 1 : 0) + .object<$W?>(W.nullableType); + } + + static final _id_list3dOfT = _class.instanceMethodId( + r'list3dOfT', + r'()Ljava/util/List;', + ); + + static final _list3dOfT = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List list3dOfT()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList>> list3dOfT() { + return _list3dOfT(reference.pointer, _id_list3dOfT as jni$_.JMethodIDPtr) + .object>>>( + jni$_.JListType>>( + jni$_.JListType>( + jni$_.JListType<$T?>(T.nullableType)))); + } + + static final _id_list3dOfU = _class.instanceMethodId( + r'list3dOfU', + r'()Ljava/util/List;', + ); + + static final _list3dOfU = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List list3dOfU()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList>> list3dOfU() { + return _list3dOfU(reference.pointer, _id_list3dOfU as jni$_.JMethodIDPtr) + .object>>>( + jni$_.JListType>>( + jni$_.JListType>(jni$_.JListType<$U>(U)))); + } + + static final _id_list3dOfW = _class.instanceMethodId( + r'list3dOfW', + r'()Ljava/util/List;', + ); + + static final _list3dOfW = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List list3dOfW()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList>> list3dOfW() { + return _list3dOfW(reference.pointer, _id_list3dOfW as jni$_.JMethodIDPtr) + .object>>>( + jni$_.JListType>>( + jni$_.JListType>(jni$_.JListType<$W>(W)))); + } + + static final _id_list3dOfNullableU = _class.instanceMethodId( + r'list3dOfNullableU', + r'(Z)Ljava/util/List;', + ); + + static final _list3dOfNullableU = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List list3dOfNullableU(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList>> list3dOfNullableU( + bool z, + ) { + return _list3dOfNullableU(reference.pointer, + _id_list3dOfNullableU as jni$_.JMethodIDPtr, z ? 1 : 0) + .object>>>( + jni$_.JListType>>( + jni$_.JListType>( + jni$_.JListType<$U?>(U.nullableType)))); + } + + static final _id_list3dOfNullableW = _class.instanceMethodId( + r'list3dOfNullableW', + r'(Z)Ljava/util/List;', + ); + + static final _list3dOfNullableW = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public java.util.List list3dOfNullableW(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList>> list3dOfNullableW( + bool z, + ) { + return _list3dOfNullableW(reference.pointer, + _id_list3dOfNullableW as jni$_.JMethodIDPtr, z ? 1 : 0) + .object>>>( + jni$_.JListType>>( + jni$_.JListType>( + jni$_.JListType<$W?>(W.nullableType)))); + } + + static final _id_nested = _class.instanceMethodId( + r'nested', + r'()Lcom/github/dart_lang/jnigen/annotations/Annotated$Nested;', + ); + + static final _nested = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public com.github.dart_lang.jnigen.annotations.Annotated.Nested nested()` + /// The returned object must be released after use, by calling the [release] method. + Annotated$Nested<$T?, $U, $W, jni$_.JInteger>? nested() { + return _nested(reference.pointer, _id_nested as jni$_.JMethodIDPtr) + .object?>( + $Annotated$Nested$NullableType<$T?, $U, $W, jni$_.JInteger>( + T.nullableType, U, W, const jni$_.JIntegerType())); + } + + static final _id_intList = _class.instanceMethodId( + r'intList', + r'()Ljava/util/List;', + ); + + static final _intList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.util.List intList()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList intList() { + return _intList(reference.pointer, _id_intList as jni$_.JMethodIDPtr) + .object>( + const jni$_.JListType(jni$_.JIntegerType())); + } +} + +final class $Annotated$NullableType< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $W extends jni$_.JObject> extends jni$_.JObjType?> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$W> W; + + @jni$_.internal + const $Annotated$NullableType( + this.T, + this.U, + this.W, + ); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/Annotated;'; + + @jni$_.internal + @core$_.override + Annotated<$T, $U, $W>? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Annotated<$T, $U, $W>.fromReference( + T, + U, + W, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Annotated$NullableType, T, U, W); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Annotated$NullableType<$T, $U, $W>) && + other is $Annotated$NullableType<$T, $U, $W> && + T == other.T && + U == other.U && + W == other.W; + } +} + +final class $Annotated$Type<$T extends jni$_.JObject?, $U extends jni$_.JObject, + $W extends jni$_.JObject> extends jni$_.JObjType> { + @jni$_.internal + final jni$_.JObjType<$T> T; + + @jni$_.internal + final jni$_.JObjType<$U> U; + + @jni$_.internal + final jni$_.JObjType<$W> W; + + @jni$_.internal + const $Annotated$Type( + this.T, + this.U, + this.W, + ); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/Annotated;'; + + @jni$_.internal + @core$_.override + Annotated<$T, $U, $W> fromReference(jni$_.JReference reference) => + Annotated<$T, $U, $W>.fromReference( + T, + U, + W, + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType?> get nullableType => + $Annotated$NullableType<$T, $U, $W>(T, U, W); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => Object.hash($Annotated$Type, T, U, W); + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Annotated$Type<$T, $U, $W>) && + other is $Annotated$Type<$T, $U, $W> && + T == other.T && + U == other.U && + W == other.W; + } +} + +/// from: `com.github.dart_lang.jnigen.annotations.JsonSerializable$Case` +class JsonSerializable$Case extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JsonSerializable$Case.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName( + r'com/github/dart_lang/jnigen/annotations/JsonSerializable$Case'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JsonSerializable$Case$NullableType(); + static const type = $JsonSerializable$Case$Type(); + static final _id_SNAKE_CASE = _class.staticFieldId( + r'SNAKE_CASE', + r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.annotations.JsonSerializable$Case SNAKE_CASE` + /// The returned object must be released after use, by calling the [release] method. + static JsonSerializable$Case? get SNAKE_CASE => + _id_SNAKE_CASE.get(_class, const $JsonSerializable$Case$NullableType()); + + static final _id_KEBAB_CASE = _class.staticFieldId( + r'KEBAB_CASE', + r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.annotations.JsonSerializable$Case KEBAB_CASE` + /// The returned object must be released after use, by calling the [release] method. + static JsonSerializable$Case? get KEBAB_CASE => + _id_KEBAB_CASE.get(_class, const $JsonSerializable$Case$NullableType()); + + static final _id_CAMEL_CASE = _class.staticFieldId( + r'CAMEL_CASE', + r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + ); + + /// from: `static public final com.github.dart_lang.jnigen.annotations.JsonSerializable$Case CAMEL_CASE` + /// The returned object must be released after use, by calling the [release] method. + static JsonSerializable$Case? get CAMEL_CASE => + _id_CAMEL_CASE.get(_class, const $JsonSerializable$Case$NullableType()); + + static final _id_values = _class.staticMethodId( + r'values', + r'()[Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + ); + + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `static public com.github.dart_lang.jnigen.annotations.JsonSerializable$Case[] values()` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $JsonSerializable$Case$NullableType())); + } + + static final _id_valueOf = _class.staticMethodId( + r'valueOf', + r'(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + ); + + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `static public com.github.dart_lang.jnigen.annotations.JsonSerializable$Case valueOf(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static JsonSerializable$Case? valueOf( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$string.pointer) + .object( + const $JsonSerializable$Case$NullableType()); + } +} + +final class $JsonSerializable$Case$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JsonSerializable$Case$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;'; + + @jni$_.internal + @core$_.override + JsonSerializable$Case? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JsonSerializable$Case.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonSerializable$Case$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonSerializable$Case$NullableType) && + other is $JsonSerializable$Case$NullableType; + } +} + +final class $JsonSerializable$Case$Type + extends jni$_.JObjType { + @jni$_.internal + const $JsonSerializable$Case$Type(); + + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;'; + + @jni$_.internal + @core$_.override + JsonSerializable$Case fromReference(jni$_.JReference reference) => + JsonSerializable$Case.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonSerializable$Case$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonSerializable$Case$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonSerializable$Case$Type) && + other is $JsonSerializable$Case$Type; + } +} + +/// from: `com.github.dart_lang.jnigen.annotations.JsonSerializable` +class JsonSerializable extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JsonSerializable.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName( + r'com/github/dart_lang/jnigen/annotations/JsonSerializable'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JsonSerializable$NullableType(); + static const type = $JsonSerializable$Type(); + static final _id_value = _class.instanceMethodId( + r'value', + r'()Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;', + ); + + static final _value = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public abstract com.github.dart_lang.jnigen.annotations.JsonSerializable$Case value()` + /// The returned object must be released after use, by calling the [release] method. + JsonSerializable$Case? value() { + return _value(reference.pointer, _id_value as jni$_.JMethodIDPtr) + .object( + const $JsonSerializable$Case$NullableType()); + } + + /// Maps a specific port to the implemented interface. + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( + int port, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, + ) { + return _$invokeMethod( + port, + jni$_.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); + + static jni$_.Pointer _$invokeMethod( + int $p, + jni$_.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); final $a = $i.args; if ($d == r'value()Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;') { final $r = _$impls[$p]!.value(); - return ($r as _$jni.JObject) - .as(const _$jni.JObjectType()) - .reference - .toPointer(); + return ($r as jni$_.JObject?) + ?.as(const jni$_.JObjectType()) + .reference + .toPointer() ?? + jni$_.nullptr; } } catch (e) { - return _$jni.ProtectedJniExtensions.newDartException(e); + return jni$_.ProtectedJniExtensions.newDartException(e); } - return _$jni.nullptr; + return jni$_.nullptr; } static void implementIn( - _$jni.JImplementer implementer, + jni$_.JImplementer implementer, $JsonSerializable $impl, ) { - late final _$jni.RawReceivePort $p; - $p = _$jni.RawReceivePort(($m) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { if ($m == null) { _$impls.remove($p.sendPort.nativePort); $p.close(); return; } - final $i = _$jni.MethodInvocation.fromMessage($m); + final $i = jni$_.MethodInvocation.fromMessage($m); final $r = _$invokeMethod($p.sendPort.nativePort, $i); - _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); }); implementer.add( r'com.github.dart_lang.jnigen.annotations.JsonSerializable', @@ -6915,7 +11151,7 @@ class JsonSerializable extends _$jni.JObject { factory JsonSerializable.implement( $JsonSerializable $impl, ) { - final $i = _$jni.JImplementer(); + final $i = jni$_.JImplementer(); implementIn($i, $impl); return JsonSerializable.fromReference( $i.implementReference(), @@ -6925,50 +11161,96 @@ class JsonSerializable extends _$jni.JObject { abstract base mixin class $JsonSerializable { factory $JsonSerializable({ - required JsonSerializable_Case Function() value, + required JsonSerializable$Case? Function() value, }) = _$JsonSerializable; - JsonSerializable_Case value(); + JsonSerializable$Case? value(); } final class _$JsonSerializable with $JsonSerializable { _$JsonSerializable({ - required JsonSerializable_Case Function() value, + required JsonSerializable$Case? Function() value, }) : _value = value; - final JsonSerializable_Case Function() _value; + final JsonSerializable$Case? Function() _value; - JsonSerializable_Case value() { + JsonSerializable$Case? value() { return _value(); } } -final class $JsonSerializable$Type extends _$jni.JObjType { - @_$jni.internal - const $JsonSerializable$Type(); +final class $JsonSerializable$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JsonSerializable$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable;'; - @_$jni.internal - @_$core.override - JsonSerializable fromReference(_$jni.JReference reference) => - JsonSerializable.fromReference(reference); + @jni$_.internal + @core$_.override + JsonSerializable? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JsonSerializable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JsonSerializable$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JsonSerializable$NullableType) && + other is $JsonSerializable$NullableType; + } +} + +final class $JsonSerializable$Type extends jni$_.JObjType { + @jni$_.internal + const $JsonSerializable$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/JsonSerializable;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + JsonSerializable fromReference(jni$_.JReference reference) => + JsonSerializable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JsonSerializable$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($JsonSerializable$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($JsonSerializable$Type) && other is $JsonSerializable$Type; @@ -6976,75 +11258,460 @@ final class $JsonSerializable$Type extends _$jni.JObjType { } /// from: `com.github.dart_lang.jnigen.annotations.MyDataClass` -class MyDataClass extends _$jni.JObject { - @_$jni.internal - @_$core.override - final _$jni.JObjType $type; +class MyDataClass extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - @_$jni.internal + @jni$_.internal MyDataClass.fromReference( - _$jni.JReference reference, + jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = _$jni.JClass.forName( + static final _class = jni$_.JClass.forName( r'com/github/dart_lang/jnigen/annotations/MyDataClass'); /// The type which includes information such as the signature of this class. + static const nullableType = $MyDataClass$NullableType(); static const type = $MyDataClass$Type(); static final _id_new$ = _class.constructorId( r'()V', ); - static final _new$ = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>>('globalEnv_NewObject') .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, )>(); /// from: `public void ()` /// The returned object must be released after use, by calling the [release] method. factory MyDataClass() { return MyDataClass.fromReference( - _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) .reference); } } -final class $MyDataClass$Type extends _$jni.JObjType { - @_$jni.internal - const $MyDataClass$Type(); +final class $MyDataClass$NullableType extends jni$_.JObjType { + @jni$_.internal + const $MyDataClass$NullableType(); - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override String get signature => r'Lcom/github/dart_lang/jnigen/annotations/MyDataClass;'; - @_$jni.internal - @_$core.override - MyDataClass fromReference(_$jni.JReference reference) => - MyDataClass.fromReference(reference); + @jni$_.internal + @core$_.override + MyDataClass? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : MyDataClass.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($MyDataClass$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($MyDataClass$NullableType) && + other is $MyDataClass$NullableType; + } +} + +final class $MyDataClass$Type extends jni$_.JObjType { + @jni$_.internal + const $MyDataClass$Type(); - @_$jni.internal - @_$core.override - _$jni.JObjType get superType => const _$jni.JObjectType(); + @jni$_.internal + @core$_.override + String get signature => + r'Lcom/github/dart_lang/jnigen/annotations/MyDataClass;'; - @_$jni.internal - @_$core.override + @jni$_.internal + @core$_.override + MyDataClass fromReference(jni$_.JReference reference) => + MyDataClass.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $MyDataClass$NullableType(); + + @jni$_.internal + @core$_.override final superCount = 1; - @_$core.override + @core$_.override int get hashCode => ($MyDataClass$Type).hashCode; - @_$core.override + @core$_.override bool operator ==(Object other) { return other.runtimeType == ($MyDataClass$Type) && other is $MyDataClass$Type; } } + +/// from: `com.github.dart_lang.jnigen.annotations.NotNull` +class NotNull extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + NotNull.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/annotations/NotNull'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $NotNull$NullableType(); + static const type = $NotNull$Type(); + + /// Maps a specific port to the implemented interface. + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( + int port, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, + ) { + return _$invokeMethod( + port, + jni$_.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); + + static jni$_.Pointer _$invokeMethod( + int $p, + jni$_.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + } catch (e) { + return jni$_.ProtectedJniExtensions.newDartException(e); + } + return jni$_.nullptr; + } + + static void implementIn( + jni$_.JImplementer implementer, + $NotNull $impl, + ) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = jni$_.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'com.github.dart_lang.jnigen.annotations.NotNull', + $p, + _$invokePointer, + [], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory NotNull.implement( + $NotNull $impl, + ) { + final $i = jni$_.JImplementer(); + implementIn($i, $impl); + return NotNull.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $NotNull { + factory $NotNull() = _$NotNull; +} + +final class _$NotNull with $NotNull { + _$NotNull(); +} + +final class $NotNull$NullableType extends jni$_.JObjType { + @jni$_.internal + const $NotNull$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/annotations/NotNull;'; + + @jni$_.internal + @core$_.override + NotNull? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : NotNull.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($NotNull$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($NotNull$NullableType) && + other is $NotNull$NullableType; + } +} + +final class $NotNull$Type extends jni$_.JObjType { + @jni$_.internal + const $NotNull$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/annotations/NotNull;'; + + @jni$_.internal + @core$_.override + NotNull fromReference(jni$_.JReference reference) => NotNull.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $NotNull$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($NotNull$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($NotNull$Type) && other is $NotNull$Type; + } +} + +/// from: `com.github.dart_lang.jnigen.annotations.Nullable` +class Nullable extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Nullable.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'com/github/dart_lang/jnigen/annotations/Nullable'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $Nullable$NullableType(); + static const type = $Nullable$Type(); + + /// Maps a specific port to the implemented interface. + static final core$_.Map _$impls = {}; + static jni$_.JObjectPtr _$invoke( + int port, + jni$_.JObjectPtr descriptor, + jni$_.JObjectPtr args, + ) { + return _$invokeMethod( + port, + jni$_.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final jni$_.Pointer< + jni$_.NativeFunction< + jni$_.JObjectPtr Function( + jni$_.Int64, jni$_.JObjectPtr, jni$_.JObjectPtr)>> + _$invokePointer = jni$_.Pointer.fromFunction(_$invoke); + + static jni$_.Pointer _$invokeMethod( + int $p, + jni$_.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + } catch (e) { + return jni$_.ProtectedJniExtensions.newDartException(e); + } + return jni$_.nullptr; + } + + static void implementIn( + jni$_.JImplementer implementer, + $Nullable $impl, + ) { + late final jni$_.RawReceivePort $p; + $p = jni$_.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = jni$_.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + jni$_.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'com.github.dart_lang.jnigen.annotations.Nullable', + $p, + _$invokePointer, + [], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory Nullable.implement( + $Nullable $impl, + ) { + final $i = jni$_.JImplementer(); + implementIn($i, $impl); + return Nullable.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $Nullable { + factory $Nullable() = _$Nullable; +} + +final class _$Nullable with $Nullable { + _$Nullable(); +} + +final class $Nullable$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Nullable$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/annotations/Nullable;'; + + @jni$_.internal + @core$_.override + Nullable? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Nullable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Nullable$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Nullable$NullableType) && + other is $Nullable$NullableType; + } +} + +final class $Nullable$Type extends jni$_.JObjType { + @jni$_.internal + const $Nullable$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/annotations/Nullable;'; + + @jni$_.internal + @core$_.override + Nullable fromReference(jni$_.JReference reference) => Nullable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $Nullable$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Nullable$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Nullable$Type) && other is $Nullable$Type; + } +} diff --git a/pkgs/jnigen/test/simple_package_test/generate.dart b/pkgs/jnigen/test/simple_package_test/generate.dart index 78fdbbe8d..96b692adc 100644 --- a/pkgs/jnigen/test/simple_package_test/generate.dart +++ b/pkgs/jnigen/test/simple_package_test/generate.dart @@ -23,8 +23,11 @@ const preamble = ''' final javaPrefix = join('com', 'github', 'dart_lang', 'jnigen'); final javaFiles = [ + join(javaPrefix, 'annotations', 'Annotated.java'), join(javaPrefix, 'annotations', 'JsonSerializable.java'), join(javaPrefix, 'annotations', 'MyDataClass.java'), + join(javaPrefix, 'annotations', 'NotNull.java'), + join(javaPrefix, 'annotations', 'Nullable.java'), join(javaPrefix, 'simple_package', 'Color.java'), join(javaPrefix, 'simple_package', 'Example.java'), join(javaPrefix, 'simple_package', 'Exceptions.java'), @@ -68,6 +71,7 @@ Config getConfig() { final config = Config( sourcePath: [Uri.directory(javaPath)], classPath: [Uri.directory(javaPath)], + summarizerOptions: SummarizerOptions(backend: SummarizerBackend.asm), classes: [ 'com.github.dart_lang.jnigen.simple_package', 'com.github.dart_lang.jnigen.pkg2', @@ -77,12 +81,14 @@ Config getConfig() { 'com.github.dart_lang.jnigen.annotations', ], logLevel: Level.INFO, + nonNullAnnotations: ['com.github.dart_lang.jnigen.annotations.NotNull'], + nullableAnnotations: ['com.github.dart_lang.jnigen.annotations.Nullable'], customClassBody: { 'com.github.dart_lang.jnigen.interfaces.MyInterface': r''' - static _$core.Map get $impls => _$impls; + static core$_.Map get $impls => _$impls; ''', 'com.github.dart_lang.jnigen.interfaces.MyRunnable': r''' - static _$core.Map get $impls => _$impls; + static core$_.Map get $impls => _$impls; ''' }, outputConfig: OutputConfig( diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/Annotated.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/Annotated.java new file mode 100644 index 000000000..75acfc351 --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/Annotated.java @@ -0,0 +1,297 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.github.dart_lang.jnigen.annotations; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class Annotated { + public T t; + public U u; + public W w; + + public Annotated(T t, U u, W w) { + this.t = t; + this.u = u; + this.w = w; + } + + public @NotNull String hello() { + return "hello"; + } + + public String nullableHello(boolean returnNull) { + return returnNull ? null : hello(); + } + + public @NotNull String echo(@NotNull String string) { + return string; + } + + public String nullableEcho(String string) { + return string; + } + + public @NotNull String @NotNull [] array() { + return new String[] {"hello"}; + } + + public String @NotNull [] arrayOfNullable() { + return new String[] {null}; + } + + public @NotNull String[] nullableArray(boolean returnNull) { + return returnNull ? null : array(); + } + + public String[] nullableArrayOfNullable(boolean returnNull) { + return returnNull ? null : arrayOfNullable(); + } + + public @NotNull List<@NotNull String> list() { + return List.of("hello"); + } + + public @NotNull List listOfNullable() { + var list = new ArrayList(); + list.add(null); + return list; + } + + public List<@NotNull String> nullableList(boolean returnNull) { + return returnNull ? null : list(); + } + + public List nullableListOfNullable(boolean returnNull) { + return returnNull ? null : listOfNullable(); + } + + public @NotNull T classGenericEcho(@NotNull T value) { + return value; + } + + public T nullableClassGenericEcho(T value) { + return value; + } + + public @NotNull V methodGenericEcho(@NotNull V value) { + return value; + } + + public <@NotNull V> V methodGenericEcho2(V value) { + return value; + } + + public V methodGenericEcho3(V value) { + return value; + } + + public V nullableReturnMethodGenericEcho(@NotNull V value, boolean returnNull) { + return returnNull ? null : value; + } + + public <@NotNull V> @Nullable V nullableReturnMethodGenericEcho2(V value, boolean returnNull) { + return returnNull ? null : value; + } + + public <@Nullable V> V nullableMethodGenericEcho(V value) { + return value; + } + + public V noAnnotationMethodGenericEcho(V value) { + return value; + } + + public <@NotNull V> V nullableArgMethodGenericEcho(@Nullable V value) { + if (value == null) { + throw new NullPointerException(); + } + return value; + } + + public @NotNull List<@NotNull T> classGenericList() { + return List.of(t); + } + + public @NotNull List classGenericListOfNullable() { + var list = new ArrayList(); + list.add(null); + return list; + } + + public List<@NotNull T> nullableClassGenericList(boolean returnNull) { + return returnNull ? null : classGenericList(); + } + + public List nullableClassGenericListOfNullable(boolean returnNull) { + return returnNull ? null : classGenericListOfNullable(); + } + + public @NotNull List<@NotNull V> methodGenericList(@NotNull V value) { + return List.of(value); + } + + public @NotNull List methodGenericListOfNullable() { + var list = new ArrayList(); + list.add(null); + return list; + } + + public List<@NotNull V> nullableMethodGenericList(@NotNull V value, boolean returnNull) { + return returnNull ? null : methodGenericList(value); + } + + public List nullableMethodGenericListOfNullable(boolean returnNull) { + return returnNull ? null : methodGenericListOfNullable(); + } + + public T firstOfClassGenericList(@NotNull List<@NotNull T> list) { + if (list.isEmpty()) { + return null; + } + return list.get(0); + } + + public T firstOfClassGenericNullableList(List<@NotNull T> list) { + if (list == null || list.isEmpty()) { + return null; + } + return list.get(0); + } + + public T firstOfClassGenericListOfNullable(@NotNull List list) { + if (list.isEmpty()) { + return null; + } + return list.get(0); + } + + public T firstOfClassGenericNullableListOfNullable(List list) { + if (list == null || list.isEmpty()) { + return null; + } + return list.get(0); + } + + public V firstOfMethodGenericList(@NotNull List<@NotNull V> list) { + if (list.isEmpty()) { + return null; + } + return list.get(0); + } + + public V firstOfMethodGenericNullableList(List<@NotNull V> list) { + if (list == null || list.isEmpty()) { + return null; + } + return list.get(0); + } + + public V firstOfMethodGenericListOfNullable(@NotNull List list) { + if (list.isEmpty()) { + return null; + } + return list.get(0); + } + + public V firstOfMethodGenericNullableListOfNullable(List list) { + if (list == null || list.isEmpty()) { + return null; + } + return list.get(0); + } + + public T firstKeyOfComboMap(@NotNull Map<@NotNull T, @NotNull V> map) { + return map.keySet().stream().findFirst().orElse(null); + } + + public V firstValueOfComboMap(@NotNull Map<@NotNull T, @NotNull V> map) { + return map.values().stream().findFirst().orElse(null); + } + + public T firstKeyOfComboMapNullableKey(@NotNull Map map) { + return map.keySet().stream().findFirst().orElse(null); + } + + public V firstValueOfComboMapNullableKey(@NotNull Map map) { + return map.values().stream().findFirst().orElse(null); + } + + public T firstKeyOfComboMapNullableValue(@NotNull Map<@NotNull T, V> map) { + return map.keySet().stream().findFirst().orElse(null); + } + + public V firstValueOfComboMapNullableValue(@NotNull Map<@NotNull T, V> map) { + return map.values().stream().findFirst().orElse(null); + } + + public T firstKeyOfComboMapNullableKeyAndValue(@NotNull Map map) { + return map.keySet().stream().findFirst().orElse(null); + } + + public V firstValueOfComboMapNullableKeyAndValue(@NotNull Map map) { + return map.values().stream().findFirst().orElse(null); + } + + public Map.Entry<@NotNull T, @NotNull V> firstEntryOfComboMap( + @NotNull Map<@NotNull T, @NotNull V> map) { + return map.entrySet().stream().findFirst().orElse(null); + } + + public W getW() { + return w; + } + + public @Nullable W nullableGetW(boolean returnNull) { + return returnNull ? null : w; + } + + public @NotNull List<@NotNull List<@NotNull List>> list3dOfT() { + List list = new ArrayList<>(); + list.add(t); + return List.of(List.of(list)); + } + + public @NotNull List<@NotNull List<@NotNull List>> list3dOfU() { + return List.of(List.of(List.of(u))); + } + + public @NotNull List<@NotNull List<@NotNull List>> list3dOfW() { + return List.of(List.of(List.of(w))); + } + + public @NotNull List<@NotNull List<@NotNull List<@Nullable U>>> list3dOfNullableU( + boolean returnNull) { + List<@Nullable U> list = new ArrayList<>(); + list.add(returnNull ? null : u); + return List.of(List.of(list)); + } + + public @NotNull List<@NotNull List<@NotNull List<@Nullable W>>> list3dOfNullableW( + boolean returnNull) { + List<@Nullable W> list = new ArrayList<>(); + list.add(returnNull ? null : w); + return List.of(List.of(list)); + } + + public class Nested { + public V v; + public @NotNull U u; + + public Nested(V v) { + this.v = v; + this.u = Annotated.this.u; + } + } + + public Annotated.Nested<@NotNull Integer> nested() { + return new Nested<>(42); + } + + public @NotNull List intList() { + return List.of(42); + } +} diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/NotNull.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/NotNull.java new file mode 100644 index 000000000..2ce438d22 --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/NotNull.java @@ -0,0 +1,17 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.github.dart_lang.jnigen.annotations; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +@Target({ + ElementType.METHOD, + ElementType.FIELD, + ElementType.PARAMETER, + ElementType.LOCAL_VARIABLE, + ElementType.TYPE_USE +}) +public @interface NotNull {} diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/Nullable.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/Nullable.java new file mode 100644 index 000000000..bee4fd60d --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/Nullable.java @@ -0,0 +1,17 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.github.dart_lang.jnigen.annotations; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +@Target({ + ElementType.METHOD, + ElementType.FIELD, + ElementType.PARAMETER, + ElementType.LOCAL_VARIABLE, + ElementType.TYPE_USE +}) +public @interface Nullable {} diff --git a/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart b/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart index fdabd98d5..b410005a2 100644 --- a/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart +++ b/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart @@ -33,6 +33,15 @@ void _runJavaGC() { } while (result.exitCode != 0); } +Future _waitUntil(bool Function() predicate) async { + for (var i = 0; i < 8; ++i) { + await Future.delayed(Duration(milliseconds: (1 << i) * 100)); + if (predicate()) { + return; + } + } +} + void registerTests(String groupName, TestRunnerCallback test) { group(groupName, () { test('static final fields - int', () { @@ -40,7 +49,7 @@ void registerTests(String groupName, TestRunnerCallback test) { expect(Example.OFF, equals(0)); expect(Example.PI, closeTo(pi, fpDelta)); expect(Example.SEMICOLON, equals(';'.codeUnitAt(0))); - expect(Example.SEMICOLON_STRING.toDartString(releaseOriginal: true), + expect(Example.SEMICOLON_STRING!.toDartString(releaseOriginal: true), equals(';')); }); @@ -56,18 +65,18 @@ void registerTests(String groupName, TestRunnerCallback test) { test('Static fields & methods - string', () { expect( - Example.getName().toDartString(releaseOriginal: true), + Example.getName()!.toDartString(releaseOriginal: true), isIn(['Ragnar Lothbrok', 'Theseus']), ); Example.setName('Theseus'.toJString()); expect( - Example.getName().toDartString(releaseOriginal: true), + Example.getName()!.toDartString(releaseOriginal: true), equals('Theseus'), ); }); test('Static fields and methods - Object', () { - final nested = Example.getNestedInstance(); + final nested = Example.getNestedInstance()!; expect(nested.getValue(), isIn([true, false])); nested.setValue(false); expect(nested.getValue(), isFalse); @@ -83,13 +92,13 @@ void registerTests(String groupName, TestRunnerCallback test) { final e = Example(); expect(e.getNumber(), equals(0)); expect(e.getIsUp(), true); - expect(e.getCodename().toDartString(), equals('achilles')); + expect(e.getCodename()!.toDartString(), equals('achilles')); e.setNumber(1); e.setUp(false); e.setCodename('spartan'.toJString()); expect(e.getIsUp(), false); expect(e.getNumber(), 1); - expect(e.getCodename().toDartString(), equals('spartan')); + expect(e.getCodename()!.toDartString(), equals('spartan')); e.release(); }); @@ -112,14 +121,14 @@ void registerTests(String groupName, TestRunnerCallback test) { test('Misc. instance methods', () { final e = Example(); final rand = e.getRandom(); - expect(rand.isNull, isFalse); + expect(rand, isNotNull); final _ = e.getRandomLong(); final id = - e.getRandomNumericString(rand).toDartString(releaseOriginal: true); + e.getRandomNumericString(rand)!.toDartString(releaseOriginal: true); expect(int.parse(id), lessThan(10000)); e.setNumber(145); expect( - e.getSelf().getSelf().getSelf().getSelf().getNumber(), + e.getSelf()!.getSelf()!.getSelf()!.getSelf()!.getNumber(), equals(145), ); e.release(); @@ -129,19 +138,19 @@ void registerTests(String groupName, TestRunnerCallback test) { final e0 = Example(); expect(e0.getNumber(), 0); expect(e0.getIsUp(), true); - expect(e0.getCodename().toDartString(), equals('achilles')); + expect(e0.getCodename()!.toDartString(), equals('achilles')); final e1 = Example.new$1(111); expect(e1.getNumber(), equals(111)); expect(e1.getIsUp(), true); - expect(e1.getCodename().toDartString(), 'achilles'); + expect(e1.getCodename()!.toDartString(), 'achilles'); final e2 = Example.new$2(122, false); expect(e2.getNumber(), equals(122)); expect(e2.getIsUp(), false); - expect(e2.getCodename().toDartString(), 'achilles'); + expect(e2.getCodename()!.toDartString(), 'achilles'); final e3 = Example.new$3(133, false, 'spartan'.toJString()); expect(e3.getNumber(), equals(133)); expect(e3.getIsUp(), false); - expect(e3.getCodename().toDartString(), 'spartan'); + expect(e3.getCodename()!.toDartString(), 'spartan'); }); test('Static (non-final) fields', () { @@ -154,12 +163,12 @@ void registerTests(String groupName, TestRunnerCallback test) { expect(Fields.asterisk, equals('*'.codeUnitAt(0))); expect( - Fields.name.toDartString(), + Fields.name!.toDartString(), isIn(['Earl Haraldson', 'Ragnar Lothbrok']), ); Fields.name = 'Ragnar Lothbrok'.toJString(); - expect(Fields.name.toDartString(), equals('Ragnar Lothbrok')); + expect(Fields.name!.toDartString(), equals('Ragnar Lothbrok')); expect(Fields.pi, closeTo(pi, fpDelta)); }); @@ -169,24 +178,24 @@ void registerTests(String groupName, TestRunnerCallback test) { expect(f.trillion, equals(trillion)); expect(f.isAchillesDead, isFalse); - expect(f.bestFighterInGreece.toDartString(), equals('Achilles')); + expect(f.bestFighterInGreece!.toDartString(), equals('Achilles')); // "For your glory walks hand-in-hand with your doom." - Thetis. f.isAchillesDead = true; // I don't know much Greek mythology. But Troy was released in 2004, // and 300 was released in 2006, so it's Leonidas I. f.bestFighterInGreece = 'Leonidas I'.toJString(); expect(f.isAchillesDead, isTrue); - expect(f.bestFighterInGreece.toDartString(), 'Leonidas I'); + expect(f.bestFighterInGreece!.toDartString(), 'Leonidas I'); }); test('Fields from nested class', () { - expect(Fields_Nested().hundred, equals(100)); + expect(Fields$Nested().hundred, equals(100)); // Hector of Troy may disagree. - expect(Fields_Nested.BEST_GOD.toDartString(), equals('Pallas Athena')); + expect(Fields$Nested.BEST_GOD!.toDartString(), equals('Pallas Athena')); }); test('static methods arrays', () { - final array = Example.getArr(); + final array = Example.getArr()!; expect(array[0], 1); expect(array[1], 2); expect(array[2], 3); @@ -200,11 +209,11 @@ void registerTests(String groupName, TestRunnerCallback test) { final ex2 = Example(); ex1.setNumber(1); ex2.setNumber(2); - final array = JArray(Example.type, 2); + final array = JArray(Example.nullableType, 2); array[0] = ex1; array[1] = ex2; - expect(array[0].getNumber(), 1); - expect(array[1].getNumber(), 2); + expect(array[0]!.getNumber(), 1); + expect(array[1]!.getNumber(), 2); array.release(); ex1.release(); ex2.release(); @@ -267,13 +276,14 @@ void registerTests(String groupName, TestRunnerCallback test) { group('generics', () { test('GrandParent constructor', () { using((arena) { - final grandParent = - GrandParent('Hello'.toJString()..releasedBy(arena)) - ..releasedBy(arena); + final grandParent = GrandParent( + 'Hello'.toJString()..releasedBy(arena), + T: JString.type) + ..releasedBy(arena); expect(grandParent, isA>()); expect(grandParent.$type, isA<$GrandParent$Type>()); expect( - grandParent.value.toDartString(releaseOriginal: true), 'Hello'); + grandParent.value!.toDartString(releaseOriginal: true), 'Hello'); }); }); test('MyStack', () { @@ -281,8 +291,8 @@ void registerTests(String groupName, TestRunnerCallback test) { final stack = MyStack(T: JString.type)..releasedBy(arena); stack.push('Hello'.toJString()..releasedBy(arena)); stack.push('World'.toJString()..releasedBy(arena)); - expect(stack.pop().toDartString(releaseOriginal: true), 'World'); - expect(stack.pop().toDartString(releaseOriginal: true), 'Hello'); + expect(stack.pop()!.toDartString(releaseOriginal: true), 'World'); + expect(stack.pop()!.toDartString(releaseOriginal: true), 'Hello'); }); }); test('Different stacks have different types, same stacks have same types', @@ -313,18 +323,20 @@ void registerTests(String groupName, TestRunnerCallback test) { map.put('Hello'.toJString()..releasedBy(arena), helloExample); map.put('World'.toJString()..releasedBy(arena), worldExample); expect( - (map.get('Hello'.toJString()..releasedBy(arena))..releasedBy(arena)) + (map.get('Hello'.toJString()..releasedBy(arena))! + ..releasedBy(arena)) .getNumber(), 1, ); expect( - (map.get('World'.toJString()..releasedBy(arena))..releasedBy(arena)) + (map.get('World'.toJString()..releasedBy(arena))! + ..releasedBy(arena)) .getNumber(), 2, ); expect( - ((map.entryStack()..releasedBy(arena)).pop()..releasedBy(arena)) - .key + ((map.entryStack()!..releasedBy(arena)).pop()!..releasedBy(arena)) + .key! .as(JString.type, releaseOriginal: true) .toDartString(releaseOriginal: true), anyOf('Hello', 'World'), @@ -336,8 +348,8 @@ void registerTests(String groupName, TestRunnerCallback test) { using((arena) { final stringStack = StringStack()..releasedBy(arena); stringStack.push('Hello'.toJString()..releasedBy(arena)); - expect( - stringStack.pop().toDartString(releaseOriginal: true), 'Hello'); + expect(stringStack.pop()!.toDartString(releaseOriginal: true), + 'Hello'); }); }); test('StringKeyedMap', () { @@ -346,7 +358,7 @@ void registerTests(String groupName, TestRunnerCallback test) { final example = Example()..releasedBy(arena); map.put('Hello'.toJString()..releasedBy(arena), example); expect( - (map.get('Hello'.toJString()..releasedBy(arena)) + (map.get('Hello'.toJString()..releasedBy(arena))! ..releasedBy(arena)) .getNumber(), 0, @@ -359,7 +371,7 @@ void registerTests(String groupName, TestRunnerCallback test) { final example = Example()..releasedBy(arena); map.put(example, 'Hello'.toJString()..releasedBy(arena)); expect( - map.get(example).toDartString(releaseOriginal: true), + map.get(example)!.toDartString(releaseOriginal: true), 'Hello', ); }); @@ -371,7 +383,7 @@ void registerTests(String groupName, TestRunnerCallback test) { 'world'.toJString()..releasedBy(arena)); expect( map - .get('hello'.toJString()..releasedBy(arena)) + .get('hello'.toJString()..releasedBy(arena))! .toDartString(releaseOriginal: true), 'world', ); @@ -391,48 +403,48 @@ void registerTests(String groupName, TestRunnerCallback test) { GrandParent(T: JString.type, '!'.toJString()..releasedBy(arena)) ..releasedBy(arena); expect( - grandParent.value.toDartString(releaseOriginal: true), + grandParent.value!.toDartString(releaseOriginal: true), '!', ); - final strStaticParent = GrandParent.stringStaticParent() + final strStaticParent = GrandParent.stringStaticParent()! ..releasedBy(arena); expect( - strStaticParent.value.toDartString(releaseOriginal: true), + strStaticParent.value!.toDartString(releaseOriginal: true), 'Hello', ); final exampleStaticParent = GrandParent.varStaticParent( - S: Example.type, Example()..releasedBy(arena)) + S: Example.type, Example()..releasedBy(arena))! ..releasedBy(arena); expect( - (exampleStaticParent.value..releasedBy(arena)).getNumber(), + (exampleStaticParent.value!..releasedBy(arena)).getNumber(), 0, ); - final strParent = grandParent.stringParent()..releasedBy(arena); + final strParent = grandParent.stringParent()!..releasedBy(arena); expect( - strParent.parentValue + strParent.parentValue! .as(JString.type, releaseOriginal: true) .toDartString(releaseOriginal: true), '!', ); expect( - strParent.value.toDartString(releaseOriginal: true), + strParent.value!.toDartString(releaseOriginal: true), 'Hello', ); final exampleParent = grandParent.varParent( - S: Example.type, Example()..releasedBy(arena)) + S: Example.type, Example()..releasedBy(arena))! ..releasedBy(arena); expect( - exampleParent.parentValue + exampleParent.parentValue! .as(JString.type, releaseOriginal: true) .toDartString(releaseOriginal: true), '!', ); expect( - (exampleParent.value..releasedBy(arena)).getNumber(), + (exampleParent.value!..releasedBy(arena)).getNumber(), 0, ); // TODO(#139): test constructing Child, currently does not work due @@ -442,17 +454,20 @@ void registerTests(String groupName, TestRunnerCallback test) { }); test('Constructing non-static nested classes', () { using((arena) { - final grandParent = GrandParent(1.toJInteger())..releasedBy(arena); - final parent = GrandParent_Parent(grandParent, 2.toJInteger()) - ..releasedBy(arena); - final child = GrandParent_Parent_Child(parent, 3.toJInteger()) + final grandParent = GrandParent(1.toJInteger(), T: JInteger.type) ..releasedBy(arena); - expect(grandParent.value.intValue(releaseOriginal: true), 1); - expect(parent.parentValue.intValue(releaseOriginal: true), 1); - expect(parent.value.intValue(releaseOriginal: true), 2); - expect(child.grandParentValue.intValue(releaseOriginal: true), 1); - expect(child.parentValue.intValue(releaseOriginal: true), 2); - expect(child.value.intValue(releaseOriginal: true), 3); + final parent = + GrandParent$Parent(grandParent, 2.toJInteger(), S: JInteger.type) + ..releasedBy(arena); + final child = + GrandParent$Parent$Child(parent, 3.toJInteger(), U: JInteger.type) + ..releasedBy(arena); + expect(grandParent.value!.intValue(releaseOriginal: true), 1); + expect(parent.parentValue!.intValue(releaseOriginal: true), 1); + expect(parent.value!.intValue(releaseOriginal: true), 2); + expect(child.grandParentValue!.intValue(releaseOriginal: true), 1); + expect(child.parentValue!.intValue(releaseOriginal: true), 2); + expect(child.value!.intValue(releaseOriginal: true), 3); }); }); @@ -463,11 +478,13 @@ void registerTests(String groupName, TestRunnerCallback test) { expect(emptyStack.size(), 0); final stack = MyStack.of$1( 'Hello'.toJString()..releasedBy(arena), - )..releasedBy(arena); - expect(stack, isA>()); - expect(stack.$type, isA<$MyStack$Type>()); + T: JString.type, + )! + ..releasedBy(arena); + expect(stack, isA>()); + expect(stack.$type, isA<$MyStack$Type>()); expect( - stack.pop().toDartString(releaseOriginal: true), + stack.pop()!.toDartString(releaseOriginal: true), 'Hello', ); }); @@ -477,15 +494,17 @@ void registerTests(String groupName, TestRunnerCallback test) { final stack = MyStack.of$2( 'Hello'.toJString()..releasedBy(arena), 'World'.toJString()..releasedBy(arena), - )..releasedBy(arena); - expect(stack, isA>()); - expect(stack.$type, isA<$MyStack$Type>()); + T: JString.type, + )! + ..releasedBy(arena); + expect(stack, isA>()); + expect(stack.$type, isA<$MyStack$Type>()); expect( - stack.pop().toDartString(releaseOriginal: true), + stack.pop()!.toDartString(releaseOriginal: true), 'World', ); expect( - stack.pop().toDartString(releaseOriginal: true), + stack.pop()!.toDartString(releaseOriginal: true), 'Hello', ); }); @@ -495,21 +514,23 @@ void registerTests(String groupName, TestRunnerCallback test) { final array = JArray.filled(1, 'World'.toJString()..releasedBy(arena)) ..releasedBy(arena); final stack = MyStack.of$2( + T: JObject.type, 'Hello'.toJString()..releasedBy(arena), array, - )..releasedBy(arena); - expect(stack, isA>()); - expect(stack.$type, isA<$MyStack$Type>()); + )! + ..releasedBy(arena); + expect(stack, isA>()); + expect(stack.$type, isA<$MyStack$Type>()); expect( stack - .pop() + .pop()! .as(JArray.type(JString.type), releaseOriginal: true)[0] .toDartString(releaseOriginal: true), 'World', ); expect( stack - .pop() + .pop()! .as(JString.type, releaseOriginal: true) .toDartString(releaseOriginal: true), 'Hello', @@ -520,11 +541,12 @@ void registerTests(String groupName, TestRunnerCallback test) { using((arena) { final array = JArray.filled(1, 'Hello'.toJString()..releasedBy(arena)) ..releasedBy(arena); - final stack = MyStack.fromArray(array)..releasedBy(arena); - expect(stack, isA>()); - expect(stack.$type, isA<$MyStack$Type>()); + final stack = MyStack.fromArray(T: JString.type, array)! + ..releasedBy(arena); + expect(stack, isA>()); + expect(stack.$type, isA<$MyStack$Type>()); expect( - stack.pop().toDartString(releaseOriginal: true), + stack.pop()!.toDartString(releaseOriginal: true), 'Hello', ); }); @@ -533,18 +555,18 @@ void registerTests(String groupName, TestRunnerCallback test) { using((arena) { final firstDimention = JArray.filled( 1, - GrandParent('Hello'.toJString()..releasedBy(arena)) + GrandParent(T: JString.type, 'Hello'.toJString()..releasedBy(arena)) ..releasedBy(arena), )..releasedBy(arena); final twoDimentionalArray = JArray.filled(1, firstDimention) ..releasedBy(arena); - final stack = - MyStack.fromArrayOfArrayOfGrandParents(twoDimentionalArray) - ..releasedBy(arena); - expect(stack, isA>()); - expect(stack.$type, isA<$MyStack$Type>()); + final stack = MyStack.fromArrayOfArrayOfGrandParents( + S: JString.type, twoDimentionalArray)! + ..releasedBy(arena); + expect(stack, isA>()); + expect(stack.$type, isA<$MyStack$Type>()); expect( - stack.pop().toDartString(releaseOriginal: true), + stack.pop()!.toDartString(releaseOriginal: true), 'Hello', ); }); @@ -568,11 +590,11 @@ void registerTests(String groupName, TestRunnerCallback test) { $MyInterface( voidCallback: voidCallbackResult.complete, stringCallback: (s) { - return (s.toDartString(releaseOriginal: true) * 2).toJString(); + return (s!.toDartString(releaseOriginal: true) * 2).toJString(); }, - varCallback: (JInteger t) { + varCallback: (JInteger? t) { final result = - (t.intValue(releaseOriginal: true) * 2).toJInteger(); + (t!.intValue(releaseOriginal: true) * 2).toJInteger(); varCallbackResult.complete(result); return result; }, @@ -595,6 +617,7 @@ void registerTests(String groupName, TestRunnerCallback test) { // The other two methods will be called individually using the passed // arguments afterwards. consume( + T: JInteger.type, myInterface, // For stringCallback: 'hello'.toJString(), @@ -622,14 +645,7 @@ void registerTests(String groupName, TestRunnerCallback test) { // Running garbage collection does not work on Android. Skipping this // test for android. _runJavaGC(); - for (var i = 0; i < 8; ++i) { - await Future.delayed(Duration(milliseconds: (1 << i) * 100)); - if (MyInterface.$impls.isEmpty) { - break; - } - } - // Since the interface is now deleted, the cleaner must signal to Dart - // to clean up. + await _waitUntil(() => MyInterface.$impls.isEmpty); expect(MyInterface.$impls, isEmpty); } }); @@ -674,12 +690,7 @@ void registerTests(String groupName, TestRunnerCallback test) { // Running garbage collection does not work on Android. Skipping this // test for android. _runJavaGC(); - for (var i = 0; i < 8; ++i) { - await Future.delayed(Duration(milliseconds: (1 << i) * 100)); - if (MyInterface.$impls.isEmpty) { - break; - } - } + await _waitUntil(() => MyInterface.$impls.isEmpty); // Since the interface is now deleted, the cleaner must signal to Dart // to clean up. expect(MyInterface.$impls, isEmpty); @@ -695,10 +706,10 @@ void registerTests(String groupName, TestRunnerCallback test) { StringConverter.implement(DartStringToIntParser(radix: 10)) ..releasedBy(arena); final fifteen = StringConverterConsumer.consumeOnSameThread( - hexParser, 'F'.toJString()..releasedBy(arena)); + hexParser, 'F'.toJString()..releasedBy(arena))!; expect(fifteen.intValue(releaseOriginal: true), 15); final fortyTwo = StringConverterConsumer.consumeOnSameThread( - decimalParser, '42'.toJString()..releasedBy(arena)); + decimalParser, '42'.toJString()..releasedBy(arena))!; expect(fortyTwo.intValue(releaseOriginal: true), 42); }); }); @@ -727,19 +738,31 @@ void registerTests(String groupName, TestRunnerCallback test) { // Running garbage collection does not work on Android. Skipping // this test for android. _runJavaGC(); - for (var i = 0; i < 8; ++i) { - await Future.delayed( - Duration(milliseconds: (1 << i) * 100)); - if (MyInterface.$impls.isEmpty) { - break; - } - } + await _waitUntil(() => MyInterface.$impls.isEmpty); // Since the interface is now deleted, the cleaner must signal to // Dart to clean up. expect(MyRunnable.$impls, isEmpty); } }); } + test('Object methods work', () async { + final runnable = MyRunnable.implement($MyRunnable( + run: () {}, + )); + expect(runnable == runnable, true); + expect(runnable != runnable, false); + expect(runnable.hashCode, runnable.hashCode); + expect(runnable.toString(), runnable.toString()); + expect(MyRunnable.$impls, hasLength(1)); + runnable.release(); + if (!Platform.isAndroid) { + // Running garbage collection does not work on Android. Skipping + // this test for android. + _runJavaGC(); + await _waitUntil(() => MyInterface.$impls.isEmpty); + expect(MyRunnable.$impls, isEmpty); + } + }); } group('Dart exceptions are handled', () { for (final exception in [UnimplementedError(), 'Hello!']) { @@ -762,13 +785,13 @@ void registerTests(String groupName, TestRunnerCallback test) { } else { runner.runOnAnotherThread(); } - while (runner.error.isNull) { + while (runner.error == null) { await Future.delayed(const Duration(milliseconds: 100)); } expect( Jni.env.IsInstanceOf( // ignore: invalid_use_of_internal_member - runner.error.reference.pointer, + runner.error!.reference.pointer, JClass.forName( 'java/lang/reflect/UndeclaredThrowableException') // ignore: invalid_use_of_internal_member @@ -777,10 +800,10 @@ void registerTests(String groupName, TestRunnerCallback test) { ), isTrue, ); - final throwableClass = runner.error.jClass; + final throwableClass = runner.error!.jClass; final cause = throwableClass .instanceMethodId('getCause', '()Ljava/lang/Throwable;') - .call(runner.error, JObject.type, []); + .call(runner.error!, JObject.type, []); expect( Jni.env.IsInstanceOf( // ignore: invalid_use_of_internal_member @@ -811,7 +834,7 @@ void registerTests(String groupName, TestRunnerCallback test) { test('StringConverter.implement on $threading ', () async { final stringConverter = StringConverter.implement($StringConverter( parseToInt: (s) { - final value = int.tryParse(s.toDartString()); + final value = int.tryParse(s!.toDartString()); if (value == null) { // ignore: only_throw_errors throw StringConversionException( @@ -844,7 +867,8 @@ void registerTests(String groupName, TestRunnerCallback test) { return (await receivePort.first) as $T; } - final sevenHundredBoxed = consume(stringConverter, '700'.toJString()); + final sevenHundredBoxed = + consume(stringConverter, '700'.toJString())!; final int sevenHundred; if (sevenHundredBoxed is JInteger) { sevenHundred = sevenHundredBoxed.intValue(); @@ -855,7 +879,7 @@ void registerTests(String groupName, TestRunnerCallback test) { } expect(sevenHundred, 700); - final fooBoxed = consume(stringConverter, 'foo'.toJString()); + final fooBoxed = consume(stringConverter, 'foo'.toJString())!; final int foo; if (fooBoxed is JInteger) { foo = fooBoxed.intValue(); @@ -873,42 +897,46 @@ void registerTests(String groupName, TestRunnerCallback test) { final genericInterface = GenericInterface.implement( $GenericInterface( T: JString.type, - arrayOf: (element) => JArray(JString.type, 1)..[0] = element, - firstKeyOf: (map) => map.keys.first.as(JString.type), - firstValueOf: (map) => map.values.first, - firstOfArray: (array) => array[0].as(JString.type), - firstOfGenericArray: (array) => array[0], - genericArrayOf: (element) => JArray(JObject.type, 1)..[0] = element, + arrayOf: (element) => + JArray(JString.nullableType, 1)..[0] = element!, + firstKeyOf: (map) => map!.keys.first!.as(JString.type), + firstValueOf: (map) => map!.values.first, + firstOfArray: (array) => array![0]!.as(JString.type), + firstOfGenericArray: (array) => array![0], + genericArrayOf: (element) => + JArray(JObject.nullableType, 1)..[0] = element, mapOf: (key, value) => - JMap.hash(JString.type, JObject.type)..[key] = value, + JMap.hash(JString.type, JObject.type)..[key!] = value, ), )..releasedBy(arena); final stringArray = genericInterface - .arrayOf('hello'.toJString()..releasedBy(arena)) + .arrayOf('hello'.toJString()..releasedBy(arena))! ..releasedBy(arena); expect(stringArray, hasLength(1)); - expect(stringArray[0].toDartString(releaseOriginal: true), 'hello'); + expect(stringArray[0]!.toDartString(releaseOriginal: true), 'hello'); expect( genericInterface - .firstOfArray(stringArray) + .firstOfArray(stringArray)! .toDartString(releaseOriginal: true), 'hello', ); - final intArray = genericInterface - .genericArrayOf(42.toJInteger()..releasedBy(arena)) + final intArray = genericInterface.genericArrayOf( + U: JInteger.type, 42.toJInteger()..releasedBy(arena))! ..releasedBy(arena); expect( genericInterface - .firstOfGenericArray(intArray) + .firstOfGenericArray(U: JInteger.type, intArray)! .intValue(releaseOriginal: true), 42, ); final jmap = genericInterface.mapOf( + U: JInteger.type, 'hello'.toJString()..releasedBy(arena), 42.toJInteger()..releasedBy(arena), - )..releasedBy(arena); + )! + ..releasedBy(arena); expect( jmap['hello'.toJString()..releasedBy(arena)]! .intValue(releaseOriginal: true), @@ -916,19 +944,332 @@ void registerTests(String groupName, TestRunnerCallback test) { ); expect( genericInterface - .firstKeyOf(jmap) + .firstKeyOf(U: JInteger.type, jmap)! .as(JString.type) .toDartString(releaseOriginal: true), 'hello', ); expect( - genericInterface.firstValueOf(jmap).intValue(releaseOriginal: true), + genericInterface + .firstValueOf(U: JInteger.type, jmap)! + .intValue(releaseOriginal: true), 42, ); }); }); }); + group('Nullablity annotations', () { + Annotated newTestObject(Arena arena) { + return Annotated( + null, + 'hello'.toJString()..releasedBy(arena), + 'world'.toJString()..releasedBy(arena), + T: JString.nullableType, + )..releasedBy(arena); + } + + Annotated newNonNullTestObject(Arena arena) { + return Annotated( + 'hello'.toJString()..releasedBy(arena), + 'hello'.toJString()..releasedBy(arena), + 'world'.toJString()..releasedBy(arena), + T: JString.type, + )..releasedBy(arena); + } + + test('Field access', () { + using((arena) { + final annotated = newTestObject(arena); + expect(annotated.t, isNull); + expect(annotated.u.toDartString(releaseOriginal: true), 'hello'); + expect(annotated.w.toDartString(releaseOriginal: true), 'world'); + }); + }); + + test('Field setting', () { + using((arena) { + final annotated = newTestObject(arena); + annotated.t = 'hello'.toJString()..releasedBy(arena); + expect( + annotated.t! + .as(JString.type, releaseOriginal: true) + .toDartString(releaseOriginal: true), + 'hello', + ); + }); + }); + + test('Methods with no object args', () { + using((arena) { + final annotated = newTestObject(arena); + expect(annotated.hello().toDartString(releaseOriginal: true), 'hello'); + expect(annotated.nullableHello(true), isNull); + expect( + annotated.nullableHello(false)!.toDartString(releaseOriginal: true), + 'hello', + ); + }); + }); + + test('Methods returning arrays', () { + using((arena) { + final annotated = newTestObject(arena); + expect( + (annotated.array()..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect((annotated.arrayOfNullable()..releasedBy(arena))[0], isNull); + expect(annotated.nullableArray(true), isNull); + expect( + (annotated.nullableArray(false)!..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect(annotated.nullableArrayOfNullable(true), isNull); + expect( + (annotated.nullableArrayOfNullable(false)!..releasedBy(arena))[0], + isNull, + ); + }); + }); + + test('Methods returning lists', () { + using((arena) { + final annotated = newTestObject(arena); + expect( + (annotated.list()..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect((annotated.listOfNullable()..releasedBy(arena))[0], isNull); + expect(annotated.nullableList(true), isNull); + expect( + (annotated.nullableList(false)!..releasedBy(arena))[0] + .toDartString(releaseOriginal: true), + 'hello', + ); + expect(annotated.nullableListOfNullable(true), isNull); + expect( + (annotated.nullableListOfNullable(false)!..releasedBy(arena))[0], + isNull, + ); + }); + }); + + test('Methods with one object arg', () { + using((arena) { + final annotated = newTestObject(arena); + final object = 'hello'.toJString()..releasedBy(arena); + expect( + annotated.echo(object).toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated.nullableEcho(object)!.toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated.nullableEcho(null), + isNull, + ); + }); + }); + + test('Class generic methods with one object arg', () { + using((arena) { + final annotatedNullableT = newTestObject(arena); + final object = 'hello'.toJString()..releasedBy(arena); + expect( + annotatedNullableT + .classGenericEcho(object)! // Cannot make it non-nullable. + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotatedNullableT + .nullableClassGenericEcho(object)! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotatedNullableT.nullableClassGenericEcho(null), + isNull, + ); + + final annotatedNonNullableT = newNonNullTestObject(arena); + expect( + annotatedNonNullableT + .classGenericEcho(object) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotatedNonNullableT + .nullableClassGenericEcho(object)! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotatedNonNullableT.nullableClassGenericEcho(null), + isNull, + ); + }); + }); + + test('Method generic methods with one object arg', () { + using((arena) { + final annotated = newTestObject(arena); + final object = 'hello'.toJString()..releasedBy(arena); + expect( + annotated + .methodGenericEcho(object, V: JString.nullableType)! + // Cannot make it non-nullable. + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + .methodGenericEcho(object, V: JString.type) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + .methodGenericEcho2(object) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + .methodGenericEcho3(object) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + // Requires `V`. + .nullableReturnMethodGenericEcho(object, false, V: JString.type)! + // Cannot make it non-nullable. + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + // Requires `V`. + .nullableReturnMethodGenericEcho(object, true, V: JString.type), + isNull, + ); + expect( + annotated + // `V` is optional. + .nullableReturnMethodGenericEcho2(object, false)! + // Cannot make it non-nullable. + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + // `V` is optional. + .nullableReturnMethodGenericEcho2(object, true), + isNull, + ); + expect( + annotated.nullableMethodGenericEcho(null, V: JString.nullableType), + isNull, + ); + expect( + annotated + .nullableMethodGenericEcho(object, V: JString.nullableType)! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + .nullableMethodGenericEcho(object, V: JString.type) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated.noAnnotationMethodGenericEcho(null, + V: JString.nullableType), + isNull, + ); + expect( + annotated + .noAnnotationMethodGenericEcho(object, V: JString.nullableType)! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + // With no annotations, specifying a non-nullable type still + // requires `!`. + .noAnnotationMethodGenericEcho(object, V: JString.type)! + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated + .nullableArgMethodGenericEcho(object, V: JString.type) + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + () => annotated.nullableArgMethodGenericEcho(null, + V: JString.type), + throwsA(isA()), + ); + expect( + annotated + .nullableArgMethodGenericEcho( + object, + V: JString.type, + ) + .toDartString(releaseOriginal: true), + 'hello', + ); + }); + }); + + test('Class generic list methods', () { + using((arena) { + final annotated = newNonNullTestObject(arena); + expect( + (annotated.classGenericList()..releasedBy(arena)) + .first + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + (annotated.classGenericListOfNullable()..releasedBy(arena)).first, + isNull, + ); + expect( + annotated.nullableClassGenericList(true), + isNull, + ); + expect( + (annotated.nullableClassGenericList(false)!..releasedBy(arena)) + .first + .toDartString(releaseOriginal: true), + 'hello', + ); + expect( + annotated.nullableClassGenericListOfNullable(true), + isNull, + ); + expect( + (annotated.nullableClassGenericListOfNullable(false)! + ..releasedBy(arena)) + .first, + isNull, + ); + }); + }); + }); + group('$groupName (load tests)', () { const k4 = 4 * 1024; // This is a round number, unlike say 4000 const k256 = 256 * 1024; @@ -999,8 +1340,8 @@ final class DartStringToIntParser with $StringConverter { DartStringToIntParser({required this.radix}); @override - int parseToInt(JString s) { - return int.parse(s.toDartString(releaseOriginal: true), radix: radix); + int parseToInt(JString? s) { + return int.parse(s!.toDartString(releaseOriginal: true), radix: radix); } } diff --git a/pkgs/jnigen/test/summary_test.dart b/pkgs/jnigen/test/summary_test.dart index d8d608196..6987af425 100644 --- a/pkgs/jnigen/test/summary_test.dart +++ b/pkgs/jnigen/test/summary_test.dart @@ -19,7 +19,7 @@ const simplePackage = '$jnigenPackage.simple_package'; extension on Classes { ClassDecl getClassBySimpleName(String simpleName) { - return decls.values.firstWhere((c) => c.name == simpleName); + return decls.values.firstWhere((c) => c.binaryName.endsWith(simpleName)); } ClassDecl getClass(String dirName, String className) { @@ -127,7 +127,7 @@ void registerCommonTests(Classes classes) { final arrayParam = method.params[2]; expect(arrayParam.type.kind, equals(Kind.array)); - expect((arrayParam.type.type as ArrayType).type.name, equals('int')); + expect((arrayParam.type.type as ArrayType).elementType.name, equals('int')); final typeVarParam = method.params[3]; expect(typeVarParam.type.kind, equals(Kind.typeVariable)); diff --git a/pkgs/jnigen/test/type_path_test.dart b/pkgs/jnigen/test/type_path_test.dart new file mode 100644 index 000000000..19ea448cf --- /dev/null +++ b/pkgs/jnigen/test/type_path_test.dart @@ -0,0 +1,18 @@ +import 'package:jnigen/jnigen.dart'; +import 'package:test/test.dart'; + +void main() { + test('Type path parsing', () { + const string = '0;.3;[14;*'; + final typePath = typePathFromString(string); + expect(typePath, const [ + ToTypeParam(0), + ToInnerClass(), + ToTypeParam(3), + ToArrayElement(), + ToTypeParam(14), + ToWildcardBound(), + ]); + expect(typePath.join(), string); + }); +} diff --git a/pkgs/jnigen/test/user_excluder.dart b/pkgs/jnigen/test/user_excluder.dart new file mode 100644 index 000000000..f13adcda4 --- /dev/null +++ b/pkgs/jnigen/test/user_excluder.dart @@ -0,0 +1,86 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:jnigen/src/elements/elements.dart' as ast; +import 'package:jnigen/src/elements/j_elements.dart'; +import 'package:test/test.dart'; + +extension on Iterable { + List get isExcludedValues => map((c) => c.isExcluded).toList(); +} + +extension on Iterable { + List get isExcludedValues => map((c) => c.isExcluded).toList(); +} + +// This is customizable by the user +class UserExcluder extends Visitor { + @override + void visitClass(ClassDecl c) { + if (c.binaryName.contains('y')) { + c.isExcluded = true; + } + } + + @override + void visitMethod(Method method) { + if (method.name == 'Bar') { + method.isExcluded = true; + } + } + + @override + void visitField(Field field) { + if (field.name == 'Bar') { + field.isExcluded = true; + } + } +} + +void main() { + test('Exclude something using the user excluder, Simple AST', () async { + final classes = ast.Classes({ + 'Foo': ast.ClassDecl( + binaryName: 'Foo', + declKind: ast.DeclKind.classKind, + superclass: ast.TypeUsage.object, + methods: [ + ast.Method(name: 'foo', returnType: ast.TypeUsage.object), + ast.Method(name: 'Bar', returnType: ast.TypeUsage.object), + ast.Method(name: 'foo1', returnType: ast.TypeUsage.object), + ast.Method(name: 'Bar', returnType: ast.TypeUsage.object), + ], + fields: [ + ast.Field(name: 'foo', type: ast.TypeUsage.object), + ast.Field(name: 'Bar', type: ast.TypeUsage.object), + ast.Field(name: 'foo1', type: ast.TypeUsage.object), + ast.Field(name: 'Bar', type: ast.TypeUsage.object), + ], + ), + 'y.Foo': ast.ClassDecl( + binaryName: 'y.Foo', + declKind: ast.DeclKind.classKind, + superclass: ast.TypeUsage.object, + methods: [ + ast.Method(name: 'foo', returnType: ast.TypeUsage.object), + ast.Method(name: 'Bar', returnType: ast.TypeUsage.object), + ], + fields: [ + ast.Field(name: 'foo', type: ast.TypeUsage.object), + ast.Field(name: 'Bar', type: ast.TypeUsage.object), + ]), + }); + + final simpleClasses = Classes(classes); + simpleClasses.accept(UserExcluder()); + + expect(classes.decls['y.Foo']?.isExcluded, true); + expect(classes.decls['Foo']?.isExcluded, false); + + expect(classes.decls['Foo']?.fields.isExcludedValues, + [false, true, false, true]); + expect(classes.decls['Foo']?.methods.isExcludedValues, + [false, true, false, true]); + }); +} diff --git a/pkgs/native_assets_builder/CHANGELOG.md b/pkgs/native_assets_builder/CHANGELOG.md index f70d95e62..d10ec539d 100644 --- a/pkgs/native_assets_builder/CHANGELOG.md +++ b/pkgs/native_assets_builder/CHANGELOG.md @@ -1,4 +1,11 @@ -## 0.8.4-wip +## 0.10.0-wip + +- Removed support for dry run (Flutter no long requires it). +- Various fixes to caching. +- **Breaking change** `BuildConfig.targetOS` is now only provided if + `buildAssetTypes` contains the code asset. + +## 0.9.0 - Also lock `BuildConfig` and `LinkConfig` `outputDirectoryShared` when invoking hooks to prevent concurrency issues with shared output caching. @@ -21,6 +28,11 @@ consistency of the sum of those parts. Effectively this means: Any asset that doesn't have an explicit linker will get a NOP linker that emits as outputs it's inputs. +- **Breaking change** Removes knowledge about code & data assets from + `package:native_assets_builder`. Users of this package can know hook into the + build/link hook configuration that is used and e.g. initialize code + configuration. Similarly users of this package now have to provide a callback + to verify the consistency of the used hook configuration. ## 0.8.3 diff --git a/pkgs/native_assets_builder/lib/native_assets_builder.dart b/pkgs/native_assets_builder/lib/native_assets_builder.dart index ec69de6cd..b71f7a6f2 100644 --- a/pkgs/native_assets_builder/lib/native_assets_builder.dart +++ b/pkgs/native_assets_builder/lib/native_assets_builder.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. export 'package:native_assets_builder/src/build_runner/build_runner.dart'; -export 'package:native_assets_builder/src/model/build_dry_run_result.dart'; export 'package:native_assets_builder/src/model/build_result.dart'; export 'package:native_assets_builder/src/model/kernel_assets.dart'; export 'package:native_assets_builder/src/model/link_result.dart'; diff --git a/pkgs/native_assets_builder/lib/src/build_runner/build_planner.dart b/pkgs/native_assets_builder/lib/src/build_runner/build_planner.dart index e6e129518..7b6d93780 100644 --- a/pkgs/native_assets_builder/lib/src/build_runner/build_planner.dart +++ b/pkgs/native_assets_builder/lib/src/build_runner/build_planner.dart @@ -47,7 +47,7 @@ class NativeAssetsBuildPlanner { ); } - (List packages, bool success) plan({ + List? plan({ String? runPackageName, }) { final PackageGraph packageGraph; @@ -62,7 +62,6 @@ class NativeAssetsBuildPlanner { final packagesToBuild = packageMap.keys.toSet(); final stronglyConnectedComponents = packageGraph.computeStrongComponents(); final result = []; - var success = true; for (final stronglyConnectedComponent in stronglyConnectedComponents) { final stronglyConnectedComponentWithNativeAssets = [ for (final packageName in stronglyConnectedComponent) @@ -73,13 +72,13 @@ class NativeAssetsBuildPlanner { 'Cyclic dependency for native asset builds in the following ' 'packages: $stronglyConnectedComponentWithNativeAssets.', ); - success = false; + return null; } else if (stronglyConnectedComponentWithNativeAssets.length == 1) { result.add( packageMap[stronglyConnectedComponentWithNativeAssets.single]!); } } - return (result, success); + return result; } } diff --git a/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart b/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart index 12afbcb11..8f86b49f9 100644 --- a/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart +++ b/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart @@ -3,28 +3,40 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; +import 'dart:convert'; import 'dart:io'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart' as api; import 'package:native_assets_cli/native_assets_cli_internal.dart'; import 'package:package_config/package_config.dart'; +import '../dependencies_hash_file/dependencies_hash_file.dart'; import '../locking/locking.dart'; -import '../model/build_dry_run_result.dart'; import '../model/build_result.dart'; import '../model/hook_result.dart'; import '../model/link_result.dart'; import '../package_layout/package_layout.dart'; -import '../utils/file.dart'; import '../utils/run_process.dart'; -import '../utils/uri.dart'; import 'build_planner.dart'; typedef DependencyMetadata = Map; +typedef ConfigCreator = HookConfigBuilder Function(); + +typedef BuildConfigCreator = BuildConfigBuilder Function(); + +typedef LinkConfigCreator = LinkConfigBuilder Function(); + typedef _HookValidator = Future Function( - HookConfig config, HookOutputImpl output); + HookConfig config, HookOutput output); + +// A callback that validates the invariants of the [BuildConfig]. +typedef BuildConfigValidator = Future Function( + BuildConfig config); + +// A callback that validates the invariants of the [LinkConfig]. +typedef LinkConfigValidator = Future Function( + LinkConfig config); // A callback that validates the output of a `hook/link.dart` invocation is // valid (it may valid asset-type specific information). @@ -48,7 +60,7 @@ typedef ApplicationAssetValidator = Future Function( /// and flutter_tools (for `flutter run` and `flutter build`). /// /// The native assets build runner does not support reentrancy for identical -/// [api.BuildConfig] and [api.LinkConfig]! For more info see: +/// [BuildConfig] and [LinkConfig]! For more info see: /// https://github.com/dart-lang/native/issues/1319 class NativeAssetsBuildRunner { final Logger logger; @@ -69,48 +81,104 @@ class NativeAssetsBuildRunner { /// If provided, only assets of all transitive dependencies of /// [runPackageName] are built. /// + /// The given [applicationAssetValidator] is only used if the build is + /// performed without linking (i.e. [linkingEnabled] is `false`). + /// /// The native assets build runner does not support reentrancy for identical - /// [api.BuildConfig] and [api.LinkConfig]! For more info see: + /// [BuildConfig] and [LinkConfig]! For more info see: /// https://github.com/dart-lang/native/issues/1319 - Future build({ - required LinkModePreference linkModePreference, - required Target target, - required Uri workingDirectory, - required BuildMode buildMode, + Future build({ + required BuildConfigCreator configCreator, + required BuildConfigValidator configValidator, required BuildValidator buildValidator, required ApplicationAssetValidator applicationAssetValidator, - CCompilerConfig? cCompilerConfig, - IOSSdk? targetIOSSdk, - int? targetIOSVersion, - int? targetMacOSVersion, - int? targetAndroidNdkApi, - required bool includeParentEnvironment, + required Uri workingDirectory, PackageLayout? packageLayout, String? runPackageName, - required Iterable supportedAssetTypes, + required List buildAssetTypes, required bool linkingEnabled, - }) async => - _run( - validator: (HookConfig config, HookOutputImpl output) => + }) async { + packageLayout ??= await PackageLayout.fromRootPackageRoot(workingDirectory); + + final (buildPlan, packageGraph) = await _makePlan( + hook: Hook.build, + packageLayout: packageLayout, + buildResult: null, + runPackageName: runPackageName, + ); + if (buildPlan == null) return null; + + var hookResult = HookResult(); + final globalMetadata = {}; + for (final package in buildPlan) { + final metadata = {}; + _metadataForPackage( + packageGraph: packageGraph!, + packageName: package.name, + targetMetadata: globalMetadata, + )?.forEach((key, value) => metadata[key] = value); + + final configBuilder = configCreator() + ..setupHookConfig( + buildAssetTypes: buildAssetTypes, + packageName: package.name, + packageRoot: packageLayout.packageRoot(package.name), + ) + ..setupBuildConfig( + dryRun: false, + linkingEnabled: linkingEnabled, + metadata: metadata, + ); + + final (buildDirUri, outDirUri, outDirSharedUri) = await _setupDirectories( + Hook.build, + packageLayout, + configBuilder, + package, + ); + + configBuilder.setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outDirSharedUri, + ); + + final config = BuildConfig(configBuilder.json); + final errors = [ + ...await validateBuildConfig(config), + ...await configValidator(config), + ]; + if (errors.isNotEmpty) { + return _printErrors( + 'Build configuration for ${package.name} contains errors', errors); + } + + final result = await _runHookForPackageCached( + Hook.build, + config, + (config, output) => buildValidator(config as BuildConfig, output as BuildOutput), - applicationAssetValidator: (assets) async => - linkingEnabled ? [] : applicationAssetValidator(assets), - hook: Hook.build, - linkModePreference: linkModePreference, - target: target, - workingDirectory: workingDirectory, - buildMode: buildMode, - cCompilerConfig: cCompilerConfig, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, - includeParentEnvironment: includeParentEnvironment, - packageLayout: packageLayout, - runPackageName: runPackageName, - supportedAssetTypes: supportedAssetTypes, - linkingEnabled: linkingEnabled, + packageLayout.packageConfigUri, + workingDirectory, + null, + packageLayout, ); + if (result == null) return null; + final (hookOutput, hookDeps) = result; + hookResult = hookResult.copyAdd(hookOutput, hookDeps); + globalMetadata[package.name] = (hookOutput as BuildOutput).metadata; + } + + // We only perform application wide validation in the final result of + // building all assets (i.e. in the build step if linking is not enabled or + // in the link step if linking is enableD). + if (linkingEnabled) return hookResult; + + final errors = await applicationAssetValidator(hookResult.encodedAssets); + if (errors.isEmpty) return hookResult; + + _printErrors('Application asset verification failed', errors); + return null; + } /// [workingDirectory] is expected to contain `.dart_tool`. /// @@ -121,368 +189,133 @@ class NativeAssetsBuildRunner { /// [runPackageName] are linked. /// /// The native assets build runner does not support reentrancy for identical - /// [api.BuildConfig] and [api.LinkConfig]! For more info see: + /// [BuildConfig] and [LinkConfig]! For more info see: /// https://github.com/dart-lang/native/issues/1319 - Future link({ - required LinkModePreference linkModePreference, - required Target target, - required Uri workingDirectory, - required BuildMode buildMode, + Future link({ + required LinkConfigCreator configCreator, + required LinkConfigValidator configValidator, required LinkValidator linkValidator, - required ApplicationAssetValidator applicationAssetValidator, - CCompilerConfig? cCompilerConfig, - IOSSdk? targetIOSSdk, - int? targetIOSVersion, - int? targetMacOSVersion, - int? targetAndroidNdkApi, - required bool includeParentEnvironment, - PackageLayout? packageLayout, - Uri? resourceIdentifiers, - String? runPackageName, - required Iterable supportedAssetTypes, - required BuildResult buildResult, - }) async => - _run( - validator: (HookConfig config, HookOutputImpl output) => - linkValidator(config as LinkConfig, output as LinkOutput), - applicationAssetValidator: (assets) async => - applicationAssetValidator(assets), - hook: Hook.link, - linkModePreference: linkModePreference, - target: target, - workingDirectory: workingDirectory, - buildMode: buildMode, - cCompilerConfig: cCompilerConfig, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, - includeParentEnvironment: includeParentEnvironment, - packageLayout: packageLayout, - runPackageName: runPackageName, - resourceIdentifiers: resourceIdentifiers, - supportedAssetTypes: supportedAssetTypes, - buildResult: buildResult, - ); - - /// The common method for running building or linking of assets. - Future _run({ - required Hook hook, - required LinkModePreference linkModePreference, - required Target target, required Uri workingDirectory, - required BuildMode buildMode, - required _HookValidator validator, required ApplicationAssetValidator applicationAssetValidator, - CCompilerConfig? cCompilerConfig, - IOSSdk? targetIOSSdk, - int? targetIOSVersion, - int? targetMacOSVersion, - int? targetAndroidNdkApi, - required bool includeParentEnvironment, PackageLayout? packageLayout, Uri? resourceIdentifiers, String? runPackageName, - required Iterable supportedAssetTypes, - BuildResult? buildResult, - bool? linkingEnabled, + required List buildAssetTypes, + required BuildResult buildResult, }) async { - assert(hook == Hook.link || buildResult == null); - assert(hook == Hook.build || linkingEnabled == null); - - // Specifically for running our tests on Dart CI with the test runner, we - // recognize specific variables to setup the C Compiler configuration. - if (cCompilerConfig == null) { - final env = Platform.environment; - final cc = env['DART_HOOK_TESTING_C_COMPILER__CC']; - final ar = env['DART_HOOK_TESTING_C_COMPILER__AR']; - final ld = env['DART_HOOK_TESTING_C_COMPILER__LD']; - final envScript = env['DART_HOOK_TESTING_C_COMPILER__ENV_SCRIPT']; - final envScriptArgs = - env['DART_HOOK_TESTING_C_COMPILER__ENV_SCRIPT_ARGUMENTS'] - ?.split(' ') - .map((arg) => arg.trim()) - .where((arg) => arg.isNotEmpty) - .toList(); - final hasEnvScriptArgs = - envScriptArgs != null && envScriptArgs.isNotEmpty; - - if (cc != null || - ar != null || - ld != null || - envScript != null || - hasEnvScriptArgs) { - cCompilerConfig = CCompilerConfig( - archiver: ar != null ? Uri.file(ar) : null, - compiler: cc != null ? Uri.file(cc) : null, - envScript: envScript != null ? Uri.file(envScript) : null, - envScriptArgs: hasEnvScriptArgs ? envScriptArgs : null, - linker: ld != null ? Uri.file(ld) : null, - ); - } - } - packageLayout ??= await PackageLayout.fromRootPackageRoot(workingDirectory); - final (buildPlan, packageGraph, planSuccess) = await _makePlan( - hook: hook, + + final (buildPlan, packageGraph) = await _makePlan( + hook: Hook.link, packageLayout: packageLayout, buildResult: buildResult, runPackageName: runPackageName, ); - if (!planSuccess) { - return HookResult.failure(); - } + if (buildPlan == null) return null; - var hookResult = HookResult(); - if (hook == Hook.link) { - hookResult.encodedAssets.addAll(buildResult!.encodedAssets); - } - final metadata = {}; + var hookResult = HookResult(encodedAssets: buildResult.encodedAssets); for (final package in buildPlan) { - final DependencyMetadata? dependencyMetadata; - switch (hook) { - case Hook.build: - dependencyMetadata = _metadataForPackage( - packageGraph: packageGraph!, - packageName: package.name, - targetMetadata: metadata, - ); - case Hook.link: - dependencyMetadata = null; + final configBuilder = configCreator() + ..setupHookConfig( + buildAssetTypes: buildAssetTypes, + packageName: package.name, + packageRoot: packageLayout.packageRoot(package.name), + ); + + final (buildDirUri, outDirUri, outDirSharedUri) = await _setupDirectories( + Hook.link, packageLayout, configBuilder, package); + + configBuilder.setupLinkConfig( + assets: buildResult.encodedAssetsForLinking[package.name] ?? [], + ); + + File? resourcesFile; + if (resourceIdentifiers != null) { + resourcesFile = File.fromUri(buildDirUri.resolve('resources.json')); + await resourcesFile.create(); + await File.fromUri(resourceIdentifiers).copy(resourcesFile.path); } - final config = await _cliConfig( - package, - packageLayout, - target, - buildMode, - linkModePreference, - dependencyMetadata, - linkingEnabled, - cCompilerConfig, - targetIOSSdk, - targetAndroidNdkApi, - targetIOSVersion, - targetMacOSVersion, - supportedAssetTypes, - hook, - resourceIdentifiers, - buildResult, + configBuilder.setupLinkRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outDirSharedUri, + recordedUsesFile: resourcesFile?.uri, ); - final (hookOutput, packageSuccess) = await _runHookForPackageCached( - hook, + final config = LinkConfig(configBuilder.json); + final errors = [ + ...await validateLinkConfig(config), + ...await configValidator(config), + ]; + if (errors.isNotEmpty) { + return _printErrors( + 'Link configuration for ${package.name} contains errors', errors); + } + + final result = await _runHookForPackageCached( + Hook.link, config, - validator, + (config, output) => + linkValidator(config as LinkConfig, output as LinkOutput), packageLayout.packageConfigUri, workingDirectory, - includeParentEnvironment, resourceIdentifiers, packageLayout, ); - hookResult = hookResult.copyAdd(hookOutput, packageSuccess); - metadata[config.packageName] = hookOutput.metadata; + if (result == null) return null; + final (hookOutput, hookDeps) = result; + hookResult = hookResult.copyAdd(hookOutput, hookDeps); } final errors = await applicationAssetValidator(hookResult.encodedAssets); if (errors.isEmpty) return hookResult; - logger.severe('Application asset verification failed:'); + _printErrors('Application asset verification failed', errors); + return null; + } + + Null _printErrors(String message, ValidationErrors errors) { + assert(errors.isNotEmpty); + logger.severe(message); for (final error in errors) { logger.severe('- $error'); } - return HookResult.failure(); + return null; } - static Future _cliConfig( - Package package, - PackageLayout packageLayout, - Target target, - BuildMode buildMode, - LinkModePreference linkModePreference, - DependencyMetadata? dependencyMetadata, - bool? linkingEnabled, - CCompilerConfig? cCompilerConfig, - IOSSdk? targetIOSSdk, - int? targetAndroidNdkApi, - int? targetIOSVersion, - int? targetMacOSVersion, - Iterable supportedAssetTypes, - Hook hook, - Uri? resourceIdentifiers, - BuildResult? buildResult, - ) async { - final buildDirName = HookConfigImpl.checksum( - packageName: package.name, - packageRoot: package.root, - targetOS: target.os, - targetArchitecture: target.architecture, - buildMode: buildMode, - linkModePreference: linkModePreference, - targetIOSSdk: targetIOSSdk, - cCompiler: cCompilerConfig, - dependencyMetadata: dependencyMetadata, - targetAndroidNdkApi: targetAndroidNdkApi, - supportedAssetTypes: supportedAssetTypes, - hook: hook, - linkingEnabled: linkingEnabled, - ); + Future<(Uri, Uri, Uri)> _setupDirectories( + Hook hook, + PackageLayout packageLayout, + HookConfigBuilder configBuilder, + Package package) async { + final buildDirName = configBuilder.computeChecksum(); final buildDirUri = packageLayout.dartToolNativeAssetsBuilder.resolve('$buildDirName/'); - final outputDirectory = buildDirUri.resolve('out/'); - final outDir = Directory.fromUri(outputDirectory); + final outDirUri = buildDirUri.resolve('out/'); + final outDir = Directory.fromUri(outDirUri); if (!await outDir.exists()) { // TODO(https://dartbug.com/50565): Purge old or unused folders. await outDir.create(recursive: true); } - - final outputDirectoryShared = packageLayout.dartToolNativeAssetsBuilder + final outDirSharedUri = packageLayout.dartToolNativeAssetsBuilder .resolve('shared/${package.name}/$hook/'); - final outDirShared = Directory.fromUri(outputDirectoryShared); + final outDirShared = Directory.fromUri(outDirSharedUri); if (!await outDirShared.exists()) { // TODO(https://dartbug.com/50565): Purge old or unused folders. await outDirShared.create(recursive: true); } - - if (hook == Hook.link) { - File? resourcesFile; - if (resourceIdentifiers != null) { - resourcesFile = File.fromUri(buildDirUri.resolve('resources.json')); - await resourcesFile.create(); - await File.fromUri(resourceIdentifiers).copy(resourcesFile.path); - } - - return LinkConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: package.name, - packageRoot: package.root, - targetOS: target.os, - targetArchitecture: target.architecture, - buildMode: buildMode, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - cCompiler: cCompilerConfig, - targetAndroidNdkApi: targetAndroidNdkApi, - recordedUsagesFile: resourcesFile?.uri, - encodedAssets: buildResult!.encodedAssetsForLinking[package.name] ?? [], - supportedAssetTypes: supportedAssetTypes, - linkModePreference: linkModePreference, - ); - } else { - return BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: package.name, - packageRoot: package.root, - targetOS: target.os, - targetArchitecture: target.architecture, - buildMode: buildMode, - linkModePreference: linkModePreference, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - cCompiler: cCompilerConfig, - dependencyMetadata: dependencyMetadata, - linkingEnabled: linkingEnabled, - targetAndroidNdkApi: targetAndroidNdkApi, - supportedAssetTypes: supportedAssetTypes, - ); - } - } - - /// [workingDirectory] is expected to contain `.dart_tool`. - /// - /// This method is invoked by launchers such as dartdev (for `dart run`) and - /// flutter_tools (for `flutter run` and `flutter build`). - /// - /// If provided, only native assets of all transitive dependencies of - /// [runPackageName] are built. - Future buildDryRun({ - required LinkModePreference linkModePreference, - required OS targetOS, - required Uri workingDirectory, - required bool includeParentEnvironment, - required bool linkingEnabled, - required BuildValidator buildValidator, - PackageLayout? packageLayout, - String? runPackageName, - required Iterable supportedAssetTypes, - }) async { - const hook = Hook.build; - packageLayout ??= await PackageLayout.fromRootPackageRoot(workingDirectory); - final (buildPlan, _, planSuccess) = await _makePlan( - hook: hook, - packageLayout: packageLayout, - runPackageName: runPackageName, - ); - if (!planSuccess) { - return HookResult.failure(); - } - - var hookResult = HookResult(); - for (final package in buildPlan) { - final config = await _cliConfigDryRun( - package: package, - packageName: package.name, - packageRoot: packageLayout.packageRoot(package.name), - targetOS: targetOS, - linkMode: linkModePreference, - buildParentDir: packageLayout.dartToolNativeAssetsBuilder, - supportedAssetTypes: supportedAssetTypes, - linkingEnabled: linkingEnabled, - ); - final packageConfigUri = packageLayout.packageConfigUri; - final ( - compileSuccess, - hookKernelFile, - _, - ) = await _compileHookForPackageCached( - config, - packageConfigUri, - workingDirectory, - includeParentEnvironment, - ); - if (!compileSuccess) { - hookResult.copyAdd(HookOutputImpl(), false); - continue; - } - // TODO(https://github.com/dart-lang/native/issues/1321): Should dry runs be cached? - final (buildOutput, packageSuccess) = await runUnderDirectoriesLock( - [ - Directory.fromUri(config.outputDirectoryShared.parent), - Directory.fromUri(config.outputDirectory.parent), - ], - timeout: singleHookTimeout, - logger: logger, - () => _runHookForPackage( - hook, - config, - (HookConfig config, HookOutputImpl output) => - buildValidator(config as BuildConfig, output as BuildOutput), - packageConfigUri, - workingDirectory, - includeParentEnvironment, - null, - hookKernelFile, - packageLayout!, - ), - ); - hookResult = hookResult.copyAdd(buildOutput, packageSuccess); - } - return hookResult; + return (buildDirUri, outDirUri, outDirSharedUri); } - Future<_PackageBuildRecord> _runHookForPackageCached( + Future<(HookOutput, List)?> _runHookForPackageCached( Hook hook, - HookConfigImpl config, + HookConfig config, _HookValidator validator, Uri packageConfigUri, Uri workingDirectory, - bool includeParentEnvironment, Uri? resources, PackageLayout packageLayout, ) async { + final environment = _filteredEnvironment(_environmentVariablesFilter); final outDir = config.outputDirectory; return await runUnderDirectoriesLock( [ @@ -492,75 +325,133 @@ class NativeAssetsBuildRunner { timeout: singleHookTimeout, logger: logger, () async { - final ( - compileSuccess, - hookKernelFile, - hookLastSourceChange, - ) = await _compileHookForPackageCached( - config, + final hookCompileResult = await _compileHookForPackageCached( + config.packageName, + config.outputDirectory, + config.packageRoot.resolve('hook/${hook.scriptName}'), packageConfigUri, workingDirectory, - includeParentEnvironment, ); - if (!compileSuccess) { - return (HookOutputImpl(), false); + if (hookCompileResult == null) { + return null; } + final (hookKernelFile, hookHashes) = hookCompileResult; - final hookOutput = HookOutputImpl.readFromFile(file: config.outputFile); - if (hookOutput != null) { - final lastBuilt = hookOutput.timestamp.roundDownToSeconds(); - final dependenciesLastChange = - await hookOutput.dependenciesModel.lastModified(); - if (lastBuilt.isAfter(dependenciesLastChange) && - lastBuilt.isAfter(hookLastSourceChange)) { + final buildOutputFile = + File.fromUri(config.outputDirectory.resolve(hook.outputName)); + final dependenciesHashFile = File.fromUri( + config.outputDirectory + .resolve('../dependencies.dependencies_hash_file.json'), + ); + final dependenciesHashes = + DependenciesHashFile(file: dependenciesHashFile); + final lastModifiedCutoffTime = DateTime.now(); + if (buildOutputFile.existsSync() && dependenciesHashFile.existsSync()) { + late final HookOutput output; + try { + output = _readHookOutputFromUri(hook, buildOutputFile); + } on FormatException catch (e) { + logger.severe(''' +Building assets for package:${config.packageName} failed. +${hook.outputName} contained a format error. + +Contents: ${buildOutputFile.readAsStringSync()}. +${e.message} + '''); + return null; + } + + final outdatedDependency = + await dependenciesHashes.findOutdatedDependency(environment); + if (outdatedDependency == null) { logger.info( - [ - 'Skipping ${hook.name} for ${config.packageName} in $outDir.', - 'Last build on $lastBuilt.', - 'Last dependencies change on $dependenciesLastChange.', - 'Last hook change on $hookLastSourceChange.', - ].join(' '), + 'Skipping ${hook.name} for ${config.packageName}' + ' in ${outDir.toFilePath()}.' + ' Last build on ${output.timestamp}.', ); // All build flags go into [outDir]. Therefore we do not have to // check here whether the config is equal. - return (hookOutput, true); + return (output, hookHashes.fileSystemEntities); } + logger.info( + 'Rerunning ${hook.name} for ${config.packageName}' + ' in ${outDir.toFilePath()}. $outdatedDependency', + ); } - return await _runHookForPackage( + final result = await _runHookForPackage( hook, config, validator, packageConfigUri, workingDirectory, - includeParentEnvironment, resources, hookKernelFile, packageLayout, + environment, ); + if (result == null) { + if (await dependenciesHashFile.exists()) { + await dependenciesHashFile.delete(); + } + return null; + } else { + final modifiedDuringBuild = await dependenciesHashes.hashDependencies( + [ + ...result.dependencies, + // Also depend on the compiled hook. Don't depend on the sources, + // if only whitespace changes, we don't need to rerun the hook. + hookKernelFile.uri, + ], + lastModifiedCutoffTime, + environment, + ); + if (modifiedDuringBuild != null) { + logger.severe('File modified during build. Build must be rerun.'); + } + } + return (result, hookHashes.fileSystemEntities); }, ); } - Future<_PackageBuildRecord> _runHookForPackage( + /// Limit the environment that hook invocations get to see. + /// + /// This allowlist lists environment variables needed to run mainstream + /// compilers. + static const _environmentVariablesFilter = { + 'ANDROID_HOME', // Needed for the NDK. + 'HOME', // Needed to find tools in default install locations. + 'PATH', // Needed to invoke native tools. + 'PROGRAMDATA', // Needed for vswhere.exe. + 'SYSTEMROOT', // Needed for process invocations on Windows. + 'TEMP', // Needed for temp dirs in Dart process. + 'TMP', // Needed for temp dirs in Dart process. + 'TMPDIR', // Needed for temp dirs in Dart process. + 'USER_PROFILE', // Needed to find tools in default install locations. + }; + + Future _runHookForPackage( Hook hook, - HookConfigImpl config, + HookConfig config, _HookValidator validator, Uri packageConfigUri, Uri workingDirectory, - bool includeParentEnvironment, Uri? resources, File hookKernelFile, PackageLayout packageLayout, + Map environment, ) async { final configFile = config.outputDirectory.resolve('../config.json'); - final configFileContents = config.toJsonString(); + final configFileContents = + const JsonEncoder.withIndent(' ').convert(config.json); logger.info('config.json contents: $configFileContents'); await File.fromUri(configFile).writeAsString(configFileContents); - final buildOutputFile = File.fromUri(config.outputFile); - if (await buildOutputFile.exists()) { + final hookOutputUri = config.outputDirectory.resolve(hook.outputName); + final hookOutputFile = File.fromUri(hookOutputUri); + if (await hookOutputFile.exists()) { // Ensure we'll never read outdated build results. - await buildOutputFile.delete(); + await hookOutputFile.delete(); } final arguments = [ @@ -574,65 +465,70 @@ class NativeAssetsBuildRunner { executable: dartExecutable, arguments: arguments, logger: logger, - includeParentEnvironment: includeParentEnvironment, + includeParentEnvironment: false, + environment: environment, ); - var success = true; - if (result.exitCode != 0) { - final printWorkingDir = workingDirectory != Directory.current.uri; - final commandString = [ - if (printWorkingDir) '(cd ${workingDirectory.toFilePath()};', - dartExecutable.toFilePath(), - ...arguments.map((a) => a.contains(' ') ? "'$a'" : a), - if (printWorkingDir) ')', - ].join(' '); - logger.severe( - ''' -Building native assets for package:${config.packageName} failed. -${config.script} returned with exit code: ${result.exitCode}. -To reproduce run: -$commandString -stderr: -${result.stderr} -stdout: -${result.stdout} - ''', - ); - success = false; - } - + var deleteOutputIfExists = false; try { - final output = HookOutputImpl.readFromFile(file: config.outputFile) ?? - HookOutputImpl(); + if (result.exitCode != 0) { + final printWorkingDir = workingDirectory != Directory.current.uri; + final commandString = [ + if (printWorkingDir) '(cd ${workingDirectory.toFilePath()};', + dartExecutable.toFilePath(), + ...arguments.map((a) => a.contains(' ') ? "'$a'" : a), + if (printWorkingDir) ')', + ].join(' '); + logger.severe( + ''' + Building assets for package:${config.packageName} failed. + ${hook.scriptName} returned with exit code: ${result.exitCode}. + To reproduce run: + $commandString + stderr: + ${result.stderr} + stdout: + ${result.stdout} + ''', + ); + deleteOutputIfExists = true; + return null; + } + final output = _readHookOutputFromUri(hook, hookOutputFile); final errors = await _validate(config, output, packageLayout, validator); - success &= errors.isEmpty; if (errors.isNotEmpty) { - logger.severe('package:${config.packageName}` has invalid output.'); - } - for (final error in errors) { - logger.severe('- $error'); + _printErrors( + '$hook hook of package:${config.packageName} has invalid output', + errors); + deleteOutputIfExists = true; + return null; } - return (output, success); + return output; } on FormatException catch (e) { logger.severe(''' -Building native assets for package:${config.packageName} failed. -${config.outputName} contained a format error. +Building assets for package:${config.packageName} failed. +${hook.outputName} contained a format error. -Contents: ${File.fromUri(config.outputFile).readAsStringSync()}. +Contents: ${hookOutputFile.readAsStringSync()}. ${e.message} '''); - success = false; - return (HookOutputImpl(), false); + return null; } finally { - if (!success) { - if (await buildOutputFile.exists()) { - await buildOutputFile.delete(); + if (deleteOutputIfExists) { + if (await hookOutputFile.exists()) { + await hookOutputFile.delete(); } } } } + Map _filteredEnvironment(Set allowList) => { + for (final entry in Platform.environment.entries) + if (allowList.contains(entry.key.toUpperCase())) + entry.key: entry.value, + }; + /// Compiles the hook to kernel and caches the kernel. /// /// If any of the Dart source files, or the package config changed after @@ -646,67 +542,85 @@ ${e.message} /// one time too many, then not recompiling when recompilation should have /// happened. /// - /// It does not reuse the cached kernel for different [config]s, due to + /// It does not reuse the cached kernel for different configs due to /// reentrancy requirements. For more info see: /// https://github.com/dart-lang/native/issues/1319 - Future<(bool success, File kernelFile, DateTime lastSourceChange)> + /// + /// TODO(https://github.com/dart-lang/native/issues/1578): Compile only once + /// instead of per config. This requires more locking. + Future<(File kernelFile, DependenciesHashFile cacheFile)?> _compileHookForPackageCached( - HookConfigImpl config, + String packageName, + Uri outputDirectory, + Uri scriptUri, Uri packageConfigUri, Uri workingDirectory, - bool includeParentEnvironment, ) async { + // Don't invalidate cache with environment changes. + final environmentForCaching = {}; final kernelFile = File.fromUri( - config.outputDirectory.resolve('../hook.dill'), + outputDirectory.resolve('../hook.dill'), ); final depFile = File.fromUri( - config.outputDirectory.resolve('../hook.dill.d'), + outputDirectory.resolve('../hook.dill.d'), ); - final bool mustCompile; - final DateTime sourceLastChange; - if (!await depFile.exists()) { + final dependenciesHashFile = File.fromUri( + outputDirectory.resolve('../hook.dependencies_hash_file.json'), + ); + final dependenciesHashes = DependenciesHashFile(file: dependenciesHashFile); + final lastModifiedCutoffTime = DateTime.now(); + var mustCompile = false; + if (!await dependenciesHashFile.exists()) { mustCompile = true; - sourceLastChange = DateTime.now(); } else { - // Format: `path/to/my.dill: path/to/my.dart, path/to/more.dart` - final depFileContents = await depFile.readAsString(); - final dartSourceFiles = depFileContents - .trim() - .split(' ') - .skip(1) // ':' - .map((u) => Uri.file(u).fileSystemEntity) - .toList(); - final dartFilesLastChange = await dartSourceFiles.lastModified(); - final packageConfigLastChange = - await packageConfigUri.fileSystemEntity.lastModified(); - sourceLastChange = packageConfigLastChange.isAfter(dartFilesLastChange) - ? packageConfigLastChange - : dartFilesLastChange; - final kernelLastChange = await kernelFile.lastModified(); - mustCompile = sourceLastChange == kernelLastChange || - sourceLastChange.isAfter(kernelLastChange); + final outdatedDependency = await dependenciesHashes + .findOutdatedDependency(environmentForCaching); + if (outdatedDependency != null) { + mustCompile = true; + logger.info( + 'Recompiling ${scriptUri.toFilePath()}. $outdatedDependency', + ); + } } - final bool success; + if (!mustCompile) { - success = true; - } else { - success = await _compileHookForPackage( - config, - packageConfigUri, - workingDirectory, - includeParentEnvironment, - kernelFile, - depFile, - ); + return (kernelFile, dependenciesHashes); } - return (success, kernelFile, sourceLastChange); + + final success = await _compileHookForPackage( + packageName, + scriptUri, + packageConfigUri, + workingDirectory, + kernelFile, + depFile, + ); + if (!success) { + return null; + } + + final dartSources = await _readDepFile(depFile); + final modifiedDuringBuild = await dependenciesHashes.hashDependencies( + [ + ...dartSources, + // If the Dart version changed, recompile. + dartExecutable.resolve('../version'), + ], + lastModifiedCutoffTime, + environmentForCaching, + ); + if (modifiedDuringBuild != null) { + logger.severe('File modified during build. Build must be rerun.'); + } + + return (kernelFile, dependenciesHashes); } Future _compileHookForPackage( - HookConfigImpl config, + String packageName, + Uri scriptUri, Uri packageConfigUri, Uri workingDirectory, - bool includeParentEnvironment, File kernelFile, File depFile, ) async { @@ -716,14 +630,14 @@ ${e.message} '--packages=${packageConfigUri.toFilePath()}', '--output=${kernelFile.path}', '--depfile=${depFile.path}', - config.script.toFilePath(), + scriptUri.toFilePath(), ]; final compileResult = await runProcess( workingDirectory: workingDirectory, executable: dartExecutable, arguments: compileArguments, logger: logger, - includeParentEnvironment: includeParentEnvironment, + includeParentEnvironment: true, ); var success = true; if (compileResult.exitCode != 0) { @@ -736,7 +650,7 @@ ${e.message} ].join(' '); logger.severe( ''' -Building native assets for package:${config.packageName} failed. +Building native assets for package:$packageName failed. Compilation of hook returned with exit code: ${compileResult.exitCode}. To reproduce run: $commandString @@ -747,58 +661,16 @@ ${compileResult.stdout} ''', ); success = false; + if (await depFile.exists()) { + await depFile.delete(); + } + if (await kernelFile.exists()) { + await kernelFile.delete(); + } } return success; } - static Future _cliConfigDryRun({ - required Package package, - required String packageName, - required Uri packageRoot, - required OS targetOS, - required LinkModePreference linkMode, - required Uri buildParentDir, - required Iterable supportedAssetTypes, - required bool? linkingEnabled, - }) async { - const hook = Hook.build; - final buildDirName = HookConfigImpl.checksumDryRun( - packageName: package.name, - packageRoot: package.root, - targetOS: targetOS, - linkModePreference: linkMode, - supportedAssetTypes: supportedAssetTypes, - hook: hook, - linkingEnabled: linkingEnabled, - ); - - final outDirUri = buildParentDir.resolve('$buildDirName/out/'); - final outDir = Directory.fromUri(outDirUri); - if (!await outDir.exists()) { - await outDir.create(recursive: true); - } - - // Shared between dry run and wet run. - final outputDirectoryShared = - buildParentDir.resolve('shared/${package.name}/$hook/out/'); - final outDirShared = Directory.fromUri(outputDirectoryShared); - if (!await outDirShared.exists()) { - // TODO(https://dartbug.com/50565): Purge old or unused folders. - await outDirShared.create(recursive: true); - } - - return BuildConfigImpl.dryRun( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRoot, - targetOS: targetOS, - linkModePreference: linkMode, - supportedAssetTypes: supportedAssetTypes, - linkingEnabled: linkingEnabled, - ); - } - DependencyMetadata? _metadataForPackage({ required PackageGraph packageGraph, required String packageName, @@ -815,21 +687,22 @@ ${compileResult.stdout} } Future _validate( - HookConfigImpl config, - HookOutputImpl output, + HookConfig config, + HookOutput output, PackageLayout packageLayout, _HookValidator validator, ) async { - final errors = config is BuildConfigImpl - ? await validateBuildOutput(config, output) - : await validateLinkOutput(config as LinkConfig, output); + final errors = config is BuildConfig + ? await validateBuildOutput(config, output as BuildOutput) + : await validateLinkOutput(config as LinkConfig, output as LinkOutput); errors.addAll(await validator(config, output)); - if (config is BuildConfigImpl) { + if (config is BuildConfig) { final packagesWithLink = (await packageLayout.packagesWithAssets(Hook.link)) .map((p) => p.name); - for (final targetPackage in output.encodedAssetsForLinking.keys) { + for (final targetPackage + in (output as BuildOutput).encodedAssetsForLinking.keys) { if (!packagesWithLink.contains(targetPackage)) { for (final asset in output.encodedAssetsForLinking[targetPackage]!) { errors.add( @@ -843,8 +716,7 @@ ${compileResult.stdout} return errors; } - Future<(List plan, PackageGraph? dependencyGraph, bool success)> - _makePlan({ + Future<(List? plan, PackageGraph? dependencyGraph)> _makePlan({ required PackageLayout packageLayout, String? runPackageName, required Hook hook, @@ -861,7 +733,7 @@ ${compileResult.stdout} final dependencyGraph = PackageGraph({ for (final p in packagesWithHook) p.name: [], }); - return (packagesWithHook, dependencyGraph, true); + return (packagesWithHook, dependencyGraph); } else { final planner = await NativeAssetsBuildPlanner.fromRootPackageRoot( rootPackageRoot: packageLayout.rootPackageRoot, @@ -869,19 +741,19 @@ ${compileResult.stdout} dartExecutable: Uri.file(Platform.resolvedExecutable), logger: logger, ); - final (plan, planSuccess) = planner.plan( + final plan = planner.plan( runPackageName: runPackageName, ); - return (plan, planner.packageGraph, planSuccess); + return (plan, planner.packageGraph); } case Hook.link: // Link hooks are not run in any particular order. // Link hooks are skipped if no assets for linking are provided. buildPlan = []; final skipped = []; - final encodedAssetsForLinking = buildResult?.encodedAssetsForLinking; + final encodedAssetsForLinking = buildResult!.encodedAssetsForLinking; for (final package in packagesWithHook) { - if (encodedAssetsForLinking![package.name]?.isNotEmpty ?? false) { + if (encodedAssetsForLinking[package.name]?.isNotEmpty ?? false) { buildPlan.add(package); } else { skipped.add(package.name); @@ -895,58 +767,73 @@ ${compileResult.stdout} } packageGraph = null; } - return (buildPlan, packageGraph, true); + return (buildPlan, packageGraph); } -} - -typedef _PackageBuildRecord = (HookOutputImpl, bool success); -extension on DateTime { - DateTime roundDownToSeconds() => - DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch - - millisecondsSinceEpoch % const Duration(seconds: 1).inMilliseconds); + HookOutput _readHookOutputFromUri(Hook hook, File hookOutputFile) { + final decode = const Utf8Decoder().fuse(const JsonDecoder()).convert; + final hookOutputJson = + decode(hookOutputFile.readAsBytesSync()) as Map; + return hook == Hook.build + ? BuildOutput(hookOutputJson) + : LinkOutput(hookOutputJson); + } } extension on Uri { Uri get parent => File(toFilePath()).parent.uri; } -extension OSArchitectures on OS { - Set get architectures => _osTargets[this]!; +/// Parses depfile contents. +/// +/// Format: `path/to/my.dill: path/to/my.dart, path/to/more.dart` +/// +/// However, the spaces in paths are escaped with backslashes, and the +/// backslashes are escaped with backslashes: +/// +/// ```dart +/// String _escapePath(String path) { +/// return path.replaceAll('\\', '\\\\').replaceAll(' ', '\\ '); +/// } +/// ``` +List parseDepFileInputs(String contents) { + final output = contents.substring(0, contents.indexOf(': ')); + contents = contents.substring(output.length + ': '.length).trim(); + final pathsEscaped = _splitOnNonEscapedSpaces(contents); + return pathsEscaped.map(_unescapeDepsPath).toList(); +} + +String _unescapeDepsPath(String path) => + path.replaceAll(r'\ ', ' ').replaceAll(r'\\', r'\'); + +List _splitOnNonEscapedSpaces(String contents) { + var index = 0; + final result = []; + while (index < contents.length) { + final start = index; + while (index < contents.length) { + final u = contents.codeUnitAt(index); + if (u == ' '.codeUnitAt(0)) { + break; + } + if (u == r'\'.codeUnitAt(0)) { + index++; + if (index == contents.length) { + throw const FormatException('malformed, ending with backslash'); + } + final v = contents.codeUnitAt(index); + assert(v == ' '.codeUnitAt(0) || v == r'\'.codeUnitAt(0)); + } + index++; + } + result.add(contents.substring(start, index)); + index++; + } + return result; } -const _osTargets = { - OS.android: { - Architecture.arm, - Architecture.arm64, - Architecture.ia32, - Architecture.x64, - Architecture.riscv64, - }, - OS.fuchsia: { - Architecture.arm64, - Architecture.x64, - }, - OS.iOS: { - Architecture.arm, - Architecture.arm64, - Architecture.x64, - }, - OS.linux: { - Architecture.arm, - Architecture.arm64, - Architecture.ia32, - Architecture.riscv32, - Architecture.riscv64, - Architecture.x64, - }, - OS.macOS: { - Architecture.arm64, - Architecture.x64, - }, - OS.windows: { - Architecture.arm64, - Architecture.ia32, - Architecture.x64, - }, -}; +Future> _readDepFile(File depFile) async { + final depFileContents = await depFile.readAsString(); + final dartSources = parseDepFileInputs(depFileContents); + return dartSources.map(Uri.file).toList(); +} diff --git a/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart b/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart new file mode 100644 index 000000000..94449bf04 --- /dev/null +++ b/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart @@ -0,0 +1,280 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:crypto/crypto.dart'; + +import '../utils/file.dart'; +import '../utils/uri.dart'; + +class DependenciesHashFile { + DependenciesHashFile({ + required this.file, + }); + + final File file; + FileSystemHashes _hashes = FileSystemHashes(); + + List get fileSystemEntities => _hashes.files.map((e) => e.path).toList(); + + Future _readFile() async { + if (!await file.exists()) { + _hashes = FileSystemHashes(); + return; + } + final jsonObject = + (json.decode(utf8.decode(await file.readAsBytes())) as Map) + .cast(); + _hashes = FileSystemHashes.fromJson(jsonObject); + } + + void _reset() => _hashes = FileSystemHashes(); + + /// Populate the hashes and persist file with entries from + /// [fileSystemEntities] and [environment]. + /// + /// Any file system entities that were modified after + /// [fileSystemValidBeforeLastModified] will get a dummy hash so that they + /// will show up as outdated. If any such entity exists, its uri will be + /// returned. + Future hashDependencies( + List fileSystemEntities, + DateTime fileSystemValidBeforeLastModified, + Map environment, + ) async { + _reset(); + + Uri? modifiedAfterTimeStamp; + for (final uri in fileSystemEntities) { + int hash; + if ((await uri.fileSystemEntity.lastModified()) + .isAfter(fileSystemValidBeforeLastModified)) { + hash = _hashLastModifiedAfterCutoff; + modifiedAfterTimeStamp = uri; + } else { + if (_isDirectoryPath(uri.path)) { + hash = await _hashDirectory(uri); + } else { + hash = await _hashFile(uri); + } + } + _hashes.files.add(FilesystemEntityHash(uri, hash)); + } + for (final entry in environment.entries) { + _hashes.environment.add(EnvironmentVariableHash( + entry.key, _hashEnvironmentValue(entry.value))); + } + await _persist(); + return modifiedAfterTimeStamp; + } + + Future _persist() => file.writeAsString(json.encode(_hashes.toJson())); + + /// Reads the file with hashes and reports if there is an outdated file, + /// directory or environment variable. + Future findOutdatedDependency( + Map environment, + ) async { + await _readFile(); + + for (final savedHash in _hashes.files) { + final uri = savedHash.path; + final savedHashValue = savedHash.hash; + if (_isDirectoryPath(uri.path)) { + final hashValue = await _hashDirectory(uri); + if (savedHashValue != hashValue) { + return 'Directory contents changed: ${uri.toFilePath()}.'; + } + } else { + final hashValue = await _hashFile(uri); + if (savedHashValue != hashValue) { + return 'File contents changed: ${uri.toFilePath()}.'; + } + } + } + + // Check if env vars changed or were removed. + for (final savedHash in _hashes.environment) { + final hashValue = _hashEnvironmentValue(environment[savedHash.key]); + if (savedHash.hash != hashValue) { + return 'Environment variable changed: ${savedHash.key}.'; + } + } + + // Check if env vars were added. + final savedEnvKeys = _hashes.environment.map((e) => e.key).toSet(); + for (final envKey in environment.keys) { + if (!savedEnvKeys.contains(envKey)) { + return 'Environment variable changed: $envKey.'; + } + } + + return null; + } + + // A 64 bit hash from an md5 hash. + int _md5int64(Uint8List bytes) { + final md5bytes = md5.convert(bytes); + final md5ints = (md5bytes.bytes as Uint8List).buffer.asUint64List(); + return md5ints[0]; + } + + Future _hashFile(Uri uri) async { + final file = File.fromUri(uri); + if (!await file.exists()) { + return _hashNotExists; + } + return _md5int64(await file.readAsBytes()); + } + + Future _hashDirectory(Uri uri) async { + final directory = Directory.fromUri(uri); + if (!await directory.exists()) { + return _hashNotExists; + } + final children = directory.listSync(followLinks: true, recursive: false); + final childrenNames = children.map((e) => _pathBaseName(e.path)).toList() + ..sort(); + return _md5int64(utf8.encode(childrenNames.join(';'))); + } + + int _hashEnvironmentValue(String? value) { + if (value == null) return _hashNotExists; + return _md5int64(utf8.encode(value)); + } + + /// Predefined hash for files and directories that do not exist. + /// + /// There are two predefined hash values. The chance that a predefined hash + /// collides with a real hash is 2/2^64. + static const _hashNotExists = 0; + + /// Predefined hash for files and directories that were modified after the + /// time that the hashes file was created. + /// + /// There are two predefined hash values. The chance that a predefined hash + /// collides with a real hash is 2/2^64. + static const _hashLastModifiedAfterCutoff = 1; +} + +/// Storage format for file system entity hashes. +/// +/// [File] hashes are a hash of the file. +/// +/// [Directory] hashes are a hash of the names of the direct children. +class FileSystemHashes { + FileSystemHashes({ + List? files, + List? environment, + }) : files = files ?? [], + environment = environment ?? []; + + factory FileSystemHashes.fromJson(Map json) { + final rawFilesystemEntries = + (json[_filesystemKey] as List?)?.cast() ?? []; + final files = [ + for (final rawEntry in rawFilesystemEntries) + FilesystemEntityHash._fromJson((rawEntry as Map).cast()), + ]; + final rawEnvironmentEntries = + (json[_environmentKey] as List?)?.cast() ?? []; + final environment = [ + for (final rawEntry in rawEnvironmentEntries) + EnvironmentVariableHash._fromJson((rawEntry as Map).cast()), + ]; + return FileSystemHashes( + files: files, + environment: environment, + ); + } + + final List files; + final List environment; + + static const _filesystemKey = 'file_system'; + + static const _environmentKey = 'environment'; + + Map toJson() => { + _filesystemKey: [ + for (final FilesystemEntityHash file in files) file.toJson(), + ], + _environmentKey: [ + for (final EnvironmentVariableHash env in environment) env.toJson(), + ], + }; +} + +/// A stored file or directory hash and path. +/// +/// [File] hashes are a hash of the file. +/// +/// [Directory] hashes are a hash of the names of the direct children. +class FilesystemEntityHash { + FilesystemEntityHash( + this.path, + this.hash, + ); + + factory FilesystemEntityHash._fromJson(Map json) => + FilesystemEntityHash( + _fileSystemPathToUri(json[_pathKey] as String), + json[_hashKey] as int, + ); + + static const _pathKey = 'path'; + static const _hashKey = 'hash'; + + final Uri path; + + /// A 64 bit hash. + final int hash; + + Object toJson() => { + _pathKey: path.toFilePath(), + _hashKey: hash, + }; +} + +class EnvironmentVariableHash { + EnvironmentVariableHash( + this.key, + this.hash, + ); + + factory EnvironmentVariableHash._fromJson(Map json) => + EnvironmentVariableHash( + json[_keyKey] as String, + json[_hashKey] as int, + ); + + static const _keyKey = 'key'; + static const _hashKey = 'hash'; + + final String key; + + /// A 64 bit hash. + final int hash; + + Object toJson() => { + _keyKey: key, + _hashKey: hash, + }; +} + +bool _isDirectoryPath(String path) => + path.endsWith(Platform.pathSeparator) || path.endsWith('/'); + +Uri _fileSystemPathToUri(String path) { + if (_isDirectoryPath(path)) { + return Uri.directory(path); + } + return Uri.file(path); +} + +String _pathBaseName(String path) => + path.split(Platform.pathSeparator).where((e) => e.isNotEmpty).last; diff --git a/pkgs/native_assets_builder/lib/src/model/build_dry_run_result.dart b/pkgs/native_assets_builder/lib/src/model/build_dry_run_result.dart deleted file mode 100644 index 6a37448c5..000000000 --- a/pkgs/native_assets_builder/lib/src/model/build_dry_run_result.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:native_assets_cli/native_assets_cli_internal.dart'; - -import '../../native_assets_builder.dart'; - -/// The result of executing the build hooks in dry run mode from all packages in -/// the dependency tree of the entry point application. -abstract interface class BuildDryRunResult { - /// The native assets produced by the hooks, which should be bundled. - List get encodedAssets; - - /// Whether all hooks completed without errors. - /// - /// All error messages are streamed to [NativeAssetsBuildRunner.logger]. - bool get success; - - /// The native assets produced by the hooks, which should be linked. - Map> get encodedAssetsForLinking; -} diff --git a/pkgs/native_assets_builder/lib/src/model/build_result.dart b/pkgs/native_assets_builder/lib/src/model/build_result.dart index 96b2aac2d..a857e7622 100644 --- a/pkgs/native_assets_builder/lib/src/model/build_result.dart +++ b/pkgs/native_assets_builder/lib/src/model/build_result.dart @@ -4,19 +4,12 @@ import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import '../build_runner/build_runner.dart'; - /// The result of executing build hooks from all packages in the dependency tree /// of the entry point application. abstract class BuildResult { /// The files used by the hooks. List get dependencies; - /// Whether all hooks completed without errors. - /// - /// All error messages are streamed to [NativeAssetsBuildRunner.logger]. - bool get success; - /// The native assets produced by the hooks, which should be bundled. List get encodedAssets; diff --git a/pkgs/native_assets_builder/lib/src/model/hook_result.dart b/pkgs/native_assets_builder/lib/src/model/hook_result.dart index 52ec4d98f..5a157f1a4 100644 --- a/pkgs/native_assets_builder/lib/src/model/hook_result.dart +++ b/pkgs/native_assets_builder/lib/src/model/hook_result.dart @@ -9,7 +9,7 @@ import '../../native_assets_builder.dart'; /// The result from a [NativeAssetsBuildRunner.build] or /// [NativeAssetsBuildRunner.link]. -final class HookResult implements BuildResult, BuildDryRunResult, LinkResult { +final class HookResult implements BuildResult, LinkResult { /// The native encodedAssets produced by the hooks, which should be bundled. @override final List encodedAssets; @@ -22,61 +22,49 @@ final class HookResult implements BuildResult, BuildDryRunResult, LinkResult { @override final List dependencies; - /// Whether all hooks completed without errors. - /// - /// All error messages are streamed to [NativeAssetsBuildRunner.logger]. - @override - final bool success; - HookResult._({ required this.encodedAssets, required this.encodedAssetsForLinking, required this.dependencies, - required this.success, }); factory HookResult({ List? encodedAssets, Map>? encodedAssetsForLinking, List? dependencies, - bool success = true, }) => HookResult._( encodedAssets: encodedAssets ?? [], encodedAssetsForLinking: encodedAssetsForLinking ?? {}, dependencies: dependencies ?? [], - success: success, ); - factory HookResult.failure() => HookResult(success: false); - - HookResult copyAdd(HookOutputImpl hookOutput, bool hookSuccess) { - final mergedMaps = - mergeMaps(encodedAssetsForLinking, hookOutput.encodedAssetsForLinking, - value: (encodedAssets1, encodedAssets2) => [ - ...encodedAssets1, - ...encodedAssets2, - ]); + HookResult copyAdd(HookOutput hookOutput, List hookDependencies) { + final mergedMaps = mergeMaps( + encodedAssetsForLinking, + hookOutput is BuildOutput + ? hookOutput.encodedAssetsForLinking + : >{}, + value: (encodedAssets1, encodedAssets2) => [ + ...encodedAssets1, + ...encodedAssets2, + ]); + final hookOutputAssets = (hookOutput is BuildOutput) + ? hookOutput.encodedAssets + : (hookOutput as LinkOutput).encodedAssets; return HookResult( encodedAssets: [ ...encodedAssets, - ...hookOutput.encodedAssets, + ...hookOutputAssets, ], encodedAssetsForLinking: mergedMaps, dependencies: [ ...dependencies, ...hookOutput.dependencies, + ...hookDependencies, ]..sort(_uriCompare), - success: success && hookSuccess, ); } - - HookResult withSuccess(bool success) => HookResult( - encodedAssets: encodedAssets, - encodedAssetsForLinking: encodedAssetsForLinking, - dependencies: dependencies, - success: success, - ); } int _uriCompare(Uri u1, Uri u2) => u1.toString().compareTo(u2.toString()); diff --git a/pkgs/native_assets_builder/lib/src/model/link_result.dart b/pkgs/native_assets_builder/lib/src/model/link_result.dart index 7b72ef951..b2bb578a4 100644 --- a/pkgs/native_assets_builder/lib/src/model/link_result.dart +++ b/pkgs/native_assets_builder/lib/src/model/link_result.dart @@ -4,8 +4,6 @@ import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import '../build_runner/build_runner.dart'; - /// The result of executing the link hooks in dry run mode from all packages in /// the dependency tree of the entry point application. abstract interface class LinkResult { @@ -15,9 +13,4 @@ abstract interface class LinkResult { /// The files used by the hooks. List get dependencies; - - /// Whether all hooks completed without errors. - /// - /// All error messages are streamed to [NativeAssetsBuildRunner.logger]. - bool get success; } diff --git a/pkgs/native_assets_builder/lib/src/utils/run_process.dart b/pkgs/native_assets_builder/lib/src/utils/run_process.dart index cb989c7bc..efb712012 100644 --- a/pkgs/native_assets_builder/lib/src/utils/run_process.dart +++ b/pkgs/native_assets_builder/lib/src/utils/run_process.dart @@ -25,19 +25,6 @@ Future runProcess({ int expectedExitCode = 0, bool throwOnUnexpectedExitCode = false, }) async { - if (Platform.isWindows && !includeParentEnvironment) { - const winEnvKeys = [ - 'SYSTEMROOT', - 'TEMP', - 'TMP', - ]; - environment = { - for (final winEnvKey in winEnvKeys) - winEnvKey: Platform.environment[winEnvKey]!, - ...?environment, - }; - } - final printWorkingDir = workingDirectory != null && workingDirectory != Directory.current.uri; final commandString = [ diff --git a/pkgs/native_assets_builder/pubspec.yaml b/pkgs/native_assets_builder/pubspec.yaml index f335ee763..e050da08c 100644 --- a/pkgs/native_assets_builder/pubspec.yaml +++ b/pkgs/native_assets_builder/pubspec.yaml @@ -1,7 +1,7 @@ name: native_assets_builder description: >- This package is the backend that invokes build hooks. -version: 0.8.4-wip +version: 0.10.0-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_builder publish_to: none @@ -11,9 +11,10 @@ environment: dependencies: collection: ^1.18.0 + crypto: ^3.0.6 graphs: ^2.3.1 logging: ^1.2.0 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../native_assets_cli/ package_config: ^2.1.0 diff --git a/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart b/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart index e5616093b..a9cce0ba3 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart @@ -26,15 +26,16 @@ void main() async { // Trigger a build, should invoke build for libraries with native assets. { final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect( logMessages.join('\n'), stringContainsInOrder( @@ -49,13 +50,28 @@ void main() async { expect(result.encodedAssets.length, 2); expect( result.dependencies, - [ - tempUri.resolve('native_add/').resolve('src/native_add.c'), - tempUri - .resolve('native_subtract/') - .resolve('src/native_subtract.c'), - ], + containsAll([ + tempUri.resolve('native_add/src/native_add.c'), + tempUri.resolve('native_subtract/src/native_subtract.c'), + if (!Platform.isWindows) ...[ + tempUri.resolve('native_add/hook/build.dart'), + tempUri.resolve('native_subtract/hook/build.dart'), + ], + ]), ); + if (Platform.isWindows) { + expect( + // https://github.com/dart-lang/sdk/issues/59657 + // Deps file on windows sometimes have lowercase drive letters. + // File.exists will work, but Uri equality doesn't. + result.dependencies + .map((e) => Uri.file(e.toFilePath().toLowerCase())), + containsAll([ + tempUri.resolve('native_add/hook/build.dart'), + tempUri.resolve('native_subtract/hook/build.dart'), + ].map((e) => Uri.file(e.toFilePath().toLowerCase()))), + ); + } } }); }); diff --git a/pkgs/native_assets_builder/test/build_runner/build_planner_test.dart b/pkgs/native_assets_builder/test/build_runner/build_planner_test.dart index 4eddad787..f4027b229 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_planner_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_planner_test.dart @@ -45,8 +45,8 @@ void main() async { dartExecutable: Uri.file(Platform.resolvedExecutable), logger: logger, ); - final (buildPlan, _) = planner.plan(); - expect(buildPlan.length, 1); + final buildPlan = planner.plan(); + expect(buildPlan!.length, 1); expect(buildPlan.single.name, 'native_add'); }); }); @@ -70,8 +70,8 @@ void main() async { dartExecutable: Uri.file(Platform.resolvedExecutable), logger: logger, ); - final (buildPlan, _) = nativeAssetsBuildPlanner.plan(); - expect(buildPlan.length, 1); + final buildPlan = nativeAssetsBuildPlanner.plan(); + expect(buildPlan!.length, 1); expect(buildPlan.single.name, 'native_add'); }); }); @@ -97,10 +97,10 @@ void main() async { dartExecutable: Uri.file(Platform.resolvedExecutable), logger: logger, ); - final (buildPlan, _) = nativeAssetsBuildPlanner.plan( + final buildPlan = nativeAssetsBuildPlanner.plan( runPackageName: runPackageName, ); - expect(buildPlan.length, 0); + expect(buildPlan!.length, 0); }); }); } diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart index 5f75a90ea..1563350df 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart @@ -27,12 +27,13 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); final fullLog = logMessages.join('\n'); - expect(result.success, false); + expect(result, isNull); expect( fullLog, contains('does not start with "package:wrong_namespace_asset/"'), @@ -62,11 +63,12 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); - expect(result.success, true); + expect(result, isNotNull); } }); }); diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart deleted file mode 100644 index 9e3fa7c4f..000000000 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:file_testing/file_testing.dart'; -import 'package:test/test.dart'; - -import '../helpers.dart'; -import 'helpers.dart'; - -const Timeout longTimeout = Timeout(Duration(minutes: 5)); - -void main() async { - test('dry_run', timeout: longTimeout, () async { - await inTempDir((tempUri) async { - await copyTestProjects(targetUri: tempUri); - final packageUri = tempUri.resolve('native_add/'); - - await runPubGet( - workingDirectory: packageUri, - logger: logger, - ); - - final dryRunResult = await buildDryRun( - packageUri, - logger, - dartExecutable, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - buildValidator: validateCodeAssetBuildOutput, - ); - final buildResult = await build( - packageUri, - logger, - dartExecutable, - supportedAssetTypes: [CodeAsset.type], - buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); - - expect(dryRunResult.encodedAssets.length, 1); - expect(buildResult.encodedAssets.length, 1); - - final dryRunAsset = dryRunResult.encodedAssets[0]; - expect(dryRunAsset.type, CodeAsset.type); - final dryRunCodeAsset = CodeAsset.fromEncoded(dryRunAsset); - - final buildAsset = buildResult.encodedAssets[0]; - final buildCodeAsset = CodeAsset.fromEncoded(buildAsset); - expect(buildAsset.type, CodeAsset.type); - - // Common across dry-run & build - expect(dryRunCodeAsset.id, buildCodeAsset.id); - expect(dryRunCodeAsset.os, buildCodeAsset.os); - expect(dryRunCodeAsset.linkMode, buildCodeAsset.linkMode); - expect(dryRunCodeAsset.file?.pathSegments.last, - buildCodeAsset.file?.pathSegments.last); - - // Different in dry-run: No architecture - expect(dryRunCodeAsset.architecture, isNull); - expect(buildCodeAsset.architecture, isNotNull); - - final nativeAssetsBuilderDirectory = - packageUri.resolve('.dart_tool/native_assets_builder/'); - final buildDirectories = - Directory.fromUri(nativeAssetsBuilderDirectory).list(); - await for (final directory in buildDirectories) { - if (directory is! Directory) { - expect( - File.fromUri(directory.uri.resolve('config.json')), - exists, - ); - expect( - File.fromUri(directory.uri.resolve('out/build_output.json')), - exists, - ); - } - } - }); - }); -} diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart index 827b9d0ea..65f766341 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart @@ -33,12 +33,13 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [], + buildAssetTypes: [], + configValidator: (config) async => [], buildValidator: (config, output) async => [], - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); final fullLog = logMessages.join('\n'); - expect(result.success, false); + expect(result, isNull); if (package == 'wrong_build_output_3') { // Should re-execute the process on second run. expect( diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart index c3ca4d278..37055392c 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; import 'package:test/test.dart'; @@ -21,22 +22,19 @@ void main() async { workingDirectory: packageUri, logger: logger, ); - // Make sure the first compile is at least one second after the - // package_config.json is written, otherwise dill compilation isn't - // cached. - await Future.delayed(const Duration(seconds: 1)); { final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect( logMessages.join('\n'), contains( @@ -46,22 +44,28 @@ void main() async { ); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } { final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, + ))!; + final hookUri = packageUri.resolve('hook/build.dart'); + expect( + logMessages.join('\n'), + isNot(contains('Recompiling ${hookUri.toFilePath()}')), ); expect( logMessages.join('\n'), @@ -76,9 +80,9 @@ void main() async { ); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } }); @@ -89,27 +93,29 @@ void main() async { await copyTestProjects(targetUri: tempUri); final packageUri = tempUri.resolve('native_add/'); + final logMessages = []; + final logger = createCapturingLogger(logMessages); + await runPubGet( workingDirectory: packageUri, logger: logger, ); - // Make sure the first compile is at least one second after the - // package_config.json is written, otherwise dill compilation isn't - // cached. - await Future.delayed(const Duration(seconds: 1)); + logMessages.clear(); { - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; await expectSymbols( asset: CodeAsset.fromEncoded(result.encodedAssets.single), symbols: ['add']); + logMessages.clear(); } await copyTestProjects( @@ -118,14 +124,27 @@ void main() async { ); { - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, + ))!; + + final cUri = packageUri.resolve('src/').resolve('native_add.c'); + expect( + logMessages.join('\n'), + stringContainsInOrder( + [ + 'Rerunning build for native_add in', + 'File contents changed: ${cUri.toFilePath()}.' + ], + ), ); + await expectSymbols( asset: CodeAsset.fromEncoded(result.encodedAssets.single), symbols: ['add', 'subtract'], @@ -147,19 +166,16 @@ void main() async { await runPubGet(workingDirectory: packageUri, logger: logger); logMessages.clear(); - // Make sure the first compile is at least one second after the - // package_config.json is written, otherwise dill compilation isn't - // cached. - await Future.delayed(const Duration(seconds: 1)); - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; { final compiledHook = logMessages .where((m) => @@ -179,22 +195,22 @@ void main() async { targetUri: packageUri); { - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, + ))!; + + final hookUri = packageUri.resolve('hook/build.dart'); + expect( + logMessages.join('\n'), + contains('Recompiling ${hookUri.toFilePath()}'), ); - { - final compiledHook = logMessages - .where((m) => - m.contains('dart compile kernel') || - m.contains('dart.exe compile kernel')) - .isNotEmpty; - expect(compiledHook, isTrue); - } + logMessages.clear(); await expectSymbols( asset: CodeAsset.fromEncoded(result.encodedAssets.single), @@ -204,4 +220,76 @@ void main() async { }); }, ); + + test( + 'change environment', + timeout: longTimeout, + () async { + await inTempDir((tempUri) async { + await copyTestProjects(targetUri: tempUri); + final packageUri = tempUri.resolve('native_add/'); + + final logMessages = []; + final logger = createCapturingLogger(logMessages); + + await runPubGet(workingDirectory: packageUri, logger: logger); + logMessages.clear(); + + final result = (await build( + packageUri, + logger, + dartExecutable, + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, + buildValidator: validateCodeAssetBuildOutput, + applicationAssetValidator: validateCodeAssetInApplication, + ))!; + logMessages.clear(); + + // Simulate that the environment variables changed by augmenting the + // persisted environment from the last invocation. + final dependenciesHashFile = File.fromUri( + CodeAsset.fromEncoded(result.encodedAssets.single) + .file! + .parent + .parent + .resolve('dependencies.dependencies_hash_file.json'), + ); + expect(await dependenciesHashFile.exists(), true); + final dependenciesContent = + jsonDecode(await dependenciesHashFile.readAsString()) + as Map; + const modifiedEnvKey = 'PATH'; + (dependenciesContent['environment'] as List).add({ + 'key': modifiedEnvKey, + 'hash': 123456789, + }); + await dependenciesHashFile + .writeAsString(jsonEncode(dependenciesContent)); + + (await build( + packageUri, + logger, + dartExecutable, + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, + buildValidator: validateCodeAssetBuildOutput, + applicationAssetValidator: validateCodeAssetInApplication, + ))!; + expect( + logMessages.join('\n'), + contains('hook.dill'), + ); + expect( + logMessages.join('\n'), + isNot(contains('Skipping build for native_add')), + ); + expect( + logMessages.join('\n'), + contains('Environment variable changed: $modifiedEnvKey.'), + ); + logMessages.clear(); + }); + }, + ); } diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart index 746cc2701..7e3f3a75c 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart @@ -20,26 +20,6 @@ void main() async { workingDirectory: packageUri, logger: logger, ); - { - final logMessages = []; - final result = await buildDryRun( - packageUri, - createCapturingLogger(logMessages, level: Level.SEVERE), - dartExecutable, - linkingEnabled: false, - supportedAssetTypes: [], - buildValidator: (config, output) async => [], - ); - final fullLog = logMessages.join('\n'); - expect(result.success, false); - expect( - fullLog, - contains( - 'Cyclic dependency for native asset builds in the following ' - 'packages: [cyclic_package_1, cyclic_package_2]', - ), - ); - } { final logMessages = []; @@ -47,12 +27,13 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [], + buildAssetTypes: [], + configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], ); final fullLog = logMessages.join('\n'); - expect(result.success, false); + expect(result, isNull); expect( fullLog, contains( diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart index f973b9c90..26059a5a1 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart @@ -24,23 +24,24 @@ void main() async { ); { - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect(result.encodedAssets.length, 1); await expectSymbols( asset: CodeAsset.fromEncoded(result.encodedAssets.single), symbols: ['add']); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } @@ -55,16 +56,17 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); final fullLog = logMessages.join('\n'); - expect(result.success, false); + expect(result, isNull); expect(fullLog, contains('To reproduce run:')); final reproCommand = fullLog .split('\n') - .skipWhile((l) => l != 'To reproduce run:') + .skipWhile((l) => !l.contains('To reproduce run:')) .skip(1) .first; final reproResult = @@ -78,25 +80,66 @@ void main() async { ); { - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect(result.encodedAssets.length, 1); await expectSymbols( asset: CodeAsset.fromEncoded(result.encodedAssets.single), symbols: ['add']); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } }); }); + + test('do not build dependees after build failure', timeout: longTimeout, + () async { + await inTempDir((tempUri) async { + await copyTestProjects(targetUri: tempUri); + final packageUri = tempUri.resolve('depend_on_fail_build_app/'); + + await runPubGet( + workingDirectory: packageUri, + logger: logger, + ); + + final logMessages = []; + await build( + packageUri, + logger, + capturedLogs: logMessages, + dartExecutable, + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, + buildValidator: validateCodeAssetBuildOutput, + applicationAssetValidator: validateCodeAssetInApplication, + ); + Matcher stringContainsBuildHookCompilation(String packageName) => + stringContainsInOrder([ + 'Running', + 'hook.dill', + '$packageName${Platform.pathSeparator}' + 'hook${Platform.pathSeparator}build.dart', + ]); + expect( + logMessages.join('\n'), + stringContainsBuildHookCompilation('fail_build'), + ); + expect( + logMessages.join('\n'), + isNot(stringContainsBuildHookCompilation('depends_on_fail_build')), + ); + }); + }); } diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart index c34013ae3..29381b67c 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart @@ -24,38 +24,40 @@ void main() async { { final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, runPackageName: 'some_dev_dep', - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect(result.encodedAssets, isEmpty); expect(result.dependencies, isEmpty); } { final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, runPackageName: 'native_add', - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect(result.encodedAssets, isNotEmpty); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); expect( logMessages.join('\n'), diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart index a19cffb95..aa7356a6c 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart @@ -11,7 +11,7 @@ import 'helpers.dart'; const Timeout longTimeout = Timeout(Duration(minutes: 5)); void main() async { - test('multiple dryRun and build invocations', timeout: longTimeout, () async { + test('multiple build invocations', timeout: longTimeout, () async { await inTempDir((tempUri) async { await copyTestProjects(targetUri: tempUri); final packageUri = tempUri.resolve('package_reading_metadata/'); @@ -27,43 +27,28 @@ void main() async { dartExecutable: dartExecutable, ); - await buildRunner.buildDryRun( - targetOS: Target.current.os, - linkModePreference: LinkModePreference.dynamic, - workingDirectory: packageUri, - includeParentEnvironment: true, - linkingEnabled: false, - supportedAssetTypes: [], - buildValidator: (config, output) async => [], - ); - await buildRunner.buildDryRun( - targetOS: Target.current.os, - linkModePreference: LinkModePreference.dynamic, - workingDirectory: packageUri, - includeParentEnvironment: true, - linkingEnabled: false, - supportedAssetTypes: [], - buildValidator: (config, output) async => [], - ); + BuildConfigBuilder configCreator() => BuildConfigBuilder() + ..setupCodeConfig( + targetArchitecture: Architecture.current, + targetOS: OS.current, + linkModePreference: LinkModePreference.dynamic, + ); + await buildRunner.build( - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - target: Target.current, + configCreator: configCreator, workingDirectory: packageUri, - includeParentEnvironment: true, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], + configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], ); await buildRunner.build( - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - target: Target.current, + configCreator: configCreator, workingDirectory: packageUri, - includeParentEnvironment: true, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], + configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], ); diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_run_in_isolation_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_run_in_isolation_test.dart deleted file mode 100644 index e5b0ecf49..000000000 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_run_in_isolation_test.dart +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:test/test.dart'; - -import '../helpers.dart'; -import 'helpers.dart'; - -const Timeout longTimeout = Timeout(Duration(minutes: 5)); - -void main() async { - final env = Platform.environment; - final cc = env['DART_HOOK_TESTING_C_COMPILER__CC']; - final ar = env['DART_HOOK_TESTING_C_COMPILER__AR']; - final ld = env['DART_HOOK_TESTING_C_COMPILER__LD']; - final envScript = env['DART_HOOK_TESTING_C_COMPILER__ENV_SCRIPT']; - final envScriptArgs = - env['DART_HOOK_TESTING_C_COMPILER__ENV_SCRIPT_ARGUMENTS'] - ?.split(' ') - .map((arg) => arg.trim()) - .where((arg) => arg.isNotEmpty) - .toList(); - - if (cc == null) { - // We don't set any compiler paths on the GitHub CI. - // We neither set compiler paths on MacOS on the Dart SDK CI - // in pkg/test_runner/lib/src/configuration.dart - // nativeCompilerEnvironmentVariables. - // - // We could potentially run this test if we default to some compilers - // we find on the path before running the test. However, the logic for - // discovering compilers is currently hidden inside - // package:native_toolchain_c. - return; - } - - test('run in isolation', timeout: longTimeout, () async { - await inTempDir((tempUri) async { - await copyTestProjects(targetUri: tempUri); - final packageUri = tempUri.resolve('native_add/'); - - await runPubGet(workingDirectory: packageUri, logger: logger); - - printOnFailure('cc: $cc'); - - final result = await build( - packageUri, - logger, - dartExecutable, - // Manually pass in a compiler. - cCompilerConfig: CCompilerConfig( - archiver: ar?.fileUri, - compiler: cc.fileUri, - envScript: envScript?.fileUri, - envScriptArgs: envScriptArgs, - linker: ld?.fileUri, - ), - // Prevent any other environment variables. - includeParentEnvironment: false, - supportedAssetTypes: [CodeAsset.type], - buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); - expect(result.encodedAssets.length, 1); - }); - }); -} - -extension on String { - Uri get fileUri => Uri.file(this); -} diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart index 9c635ac51..70df079d1 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart @@ -24,23 +24,19 @@ void main() async { logger: logger, ); - // Make sure the first compile is at least one second after the - // package_config.json is written, otherwise dill compilation isn't - // cached. - await Future.delayed(const Duration(seconds: 1)); - // Trigger a build, should invoke build for libraries with native assets. { final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, + buildAssetTypes: [CodeAsset.type], buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect( logMessages.join('\n'), stringContainsInOrder([ @@ -57,16 +53,17 @@ void main() async { packageLayout = await PackageLayout.fromRootPackageRoot(packageUri); } final logMessages = []; - final result = await build( + final result = (await build( packageUri, logger, dartExecutable, capturedLogs: logMessages, packageLayout: packageLayout, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect( false, logMessages.join('\n').contains( diff --git a/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart b/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart index bafbc2d5e..d31b8c434 100644 --- a/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart +++ b/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart @@ -20,19 +20,23 @@ void main(List args) async { logger: logger, dartExecutable: dartExecutable, ).build( - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - target: target, + // Set up the code config, so that the builds for different targets are + // in different directories. + configCreator: () => BuildConfigBuilder() + ..setupCodeConfig( + targetArchitecture: target.architecture, + targetOS: target.os, + linkModePreference: LinkModePreference.dynamic, + ), workingDirectory: packageUri, - includeParentEnvironment: true, linkingEnabled: false, - supportedAssetTypes: [DataAsset.type], - targetAndroidNdkApi: target.os == OS.android ? 30 : null, + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: (config, output) async => await validateDataAssetBuildOutput(config, output), applicationAssetValidator: (_) async => [], ); - if (!result.success) { + if (result == null) { throw Error(); } print('done'); diff --git a/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart b/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart index 32ac611a6..75d2cb096 100644 --- a/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart +++ b/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart @@ -6,6 +6,7 @@ import 'package:logging/logging.dart'; import 'package:native_assets_builder/native_assets_builder.dart'; import '../helpers.dart'; +import 'helpers.dart'; // Is invoked concurrently multiple times in separate processes. void main(List args) async { @@ -24,20 +25,28 @@ void main(List args) async { dartExecutable: dartExecutable, singleHookTimeout: timeout, ).build( - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - target: Target.current, + configCreator: () => BuildConfigBuilder() + ..setupCodeConfig( + targetArchitecture: Architecture.current, + targetOS: OS.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: dartCICompilerConfig, + targetMacOSVersion: OS.current == OS.macOS ? defaultMacOSVersion : null, + ), workingDirectory: packageUri, - includeParentEnvironment: true, linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type, DataAsset.type], + buildAssetTypes: [CodeAsset.type, DataAsset.type], + configValidator: (config) async => [ + ...await validateDataAssetBuildConfig(config), + ...await validateCodeAssetBuildConfig(config), + ], buildValidator: (config, output) async => [ ...await validateCodeAssetBuildOutput(config, output), ...await validateDataAssetBuildOutput(config, output), ], - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); - if (!result.success) { + if (result == null) { throw Error(); } print('done'); diff --git a/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart b/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart index 78d4ddca8..2aee76303 100644 --- a/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart @@ -27,12 +27,13 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); final fullLog = logMessages.join('\n'); - expect(result.success, false); + expect(result, isNull); expect( fullLog, contains('Duplicate dynamic library file name'), @@ -52,28 +53,29 @@ void main() async { logger: logger, ); - final buildResult = await build( + final buildResult = (await build( packageUri, logger, linkingEnabled: true, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); - expect(buildResult.success, isTrue); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; final linkResult = await link( packageUri, logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetLinkConfig, linkValidator: validateCodeAssetLinkOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); // Application validation error due to conflicting dylib name. - expect(linkResult.success, isFalse); + expect(linkResult, isNull); }); }); } diff --git a/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart b/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart index 021a3d2fd..072ae2f4d 100644 --- a/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart @@ -73,24 +73,32 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type, DataAsset.type], + buildAssetTypes: [CodeAsset.type, DataAsset.type], + buildConfigValidator: (config) async => [ + ...await validateDataAssetBuildConfig(config), + ...await validateCodeAssetBuildConfig(config), + ], buildValidator: (config, output) async => [ ...await validateCodeAssetBuildOutput(config, output), ...await validateDataAssetBuildOutput(config, output), ], + linkConfigValidator: (config) async => [ + ...await validateDataAssetLinkConfig(config), + ...await validateCodeAssetLinkConfig(config), + ], linkValidator: (config, output) async => [ ...await validateCodeAssetLinkOutput(config, output), ...await validateDataAssetLinkOutput(config, output), ], - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, ); final fullLog = logMessages.join('\n'); if (hook == 'build') { - expect(buildResult.success, success); + expect(buildResult, success ? isNotNull : isNull); } else { assert(hook == 'link'); - expect(buildResult.success, true); - expect(linkResult.success, success); + expect(buildResult, isNotNull); + expect(linkResult, success ? isNotNull : isNull); } if (!success) { expect( diff --git a/pkgs/native_assets_builder/test/build_runner/helpers.dart b/pkgs/native_assets_builder/test/build_runner/helpers.dart index daaa8f8b1..432b5dade 100644 --- a/pkgs/native_assets_builder/test/build_runner/helpers.dart +++ b/pkgs/native_assets_builder/test/build_runner/helpers.dart @@ -7,7 +7,6 @@ import 'dart:io'; import 'package:logging/logging.dart'; import 'package:native_assets_builder/native_assets_builder.dart'; -import 'package:native_assets_builder/src/model/hook_result.dart'; import 'package:test/test.dart'; import '../helpers.dart'; @@ -29,15 +28,15 @@ Future runPubGet({ expect(result.exitCode, 0); } -Future build( +Future build( Uri packageUri, Logger logger, Uri dartExecutable, { + required BuildConfigValidator configValidator, required BuildValidator buildValidator, required ApplicationAssetValidator applicationAssetValidator, LinkModePreference linkModePreference = LinkModePreference.dynamic, CCompilerConfig? cCompilerConfig, - bool includeParentEnvironment = true, List? capturedLogs, PackageLayout? packageLayout, String? runPackageName, @@ -47,51 +46,62 @@ Future build( int? targetAndroidNdkApi, Target? target, bool linkingEnabled = false, - required Iterable supportedAssetTypes, -}) async => - await runWithLog(capturedLogs, () async { - final result = await NativeAssetsBuildRunner( - logger: logger, - dartExecutable: dartExecutable, - ).build( - buildMode: BuildMode.release, - linkModePreference: linkModePreference, - target: target ?? Target.current, - workingDirectory: packageUri, - cCompilerConfig: cCompilerConfig, - includeParentEnvironment: includeParentEnvironment, - packageLayout: packageLayout, - runPackageName: runPackageName, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, - linkingEnabled: linkingEnabled, - supportedAssetTypes: supportedAssetTypes, - buildValidator: buildValidator, - applicationAssetValidator: applicationAssetValidator, - ); - - if (result.success) { - expect(await result.encodedAssets.allExist(), true); - for (final encodedAssetsForLinking - in result.encodedAssetsForLinking.values) { - expect(await encodedAssetsForLinking.allExist(), true); + required List buildAssetTypes, +}) async { + final targetOS = target?.os ?? OS.current; + return await runWithLog(capturedLogs, () async { + final result = await NativeAssetsBuildRunner( + logger: logger, + dartExecutable: dartExecutable, + ).build( + configCreator: () { + final configBuilder = BuildConfigBuilder(); + if (buildAssetTypes.contains(CodeAsset.type)) { + configBuilder.setupCodeConfig( + targetArchitecture: target?.architecture ?? Architecture.current, + targetOS: targetOS, + linkModePreference: linkModePreference, + cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion ?? + (targetOS == OS.macOS ? defaultMacOSVersion : null), + targetAndroidNdkApi: targetAndroidNdkApi, + ); } + return configBuilder; + }, + configValidator: configValidator, + workingDirectory: packageUri, + packageLayout: packageLayout, + runPackageName: runPackageName, + linkingEnabled: linkingEnabled, + buildAssetTypes: buildAssetTypes, + buildValidator: buildValidator, + applicationAssetValidator: applicationAssetValidator, + ); + + if (result != null) { + expect(await result.encodedAssets.allExist(), true); + for (final encodedAssetsForLinking + in result.encodedAssetsForLinking.values) { + expect(await encodedAssetsForLinking.allExist(), true); } + } - return result; - }); + return result; + }); +} -Future link( +Future link( Uri packageUri, Logger logger, Uri dartExecutable, { + required LinkConfigValidator configValidator, required LinkValidator linkValidator, required ApplicationAssetValidator applicationAssetValidator, LinkModePreference linkModePreference = LinkModePreference.dynamic, CCompilerConfig? cCompilerConfig, - bool includeParentEnvironment = true, List? capturedLogs, PackageLayout? packageLayout, required BuildResult buildResult, @@ -101,48 +111,60 @@ Future link( int? targetMacOSVersion, int? targetAndroidNdkApi, Target? target, - required Iterable supportedAssetTypes, -}) async => - await runWithLog(capturedLogs, () async { - final result = await NativeAssetsBuildRunner( - logger: logger, - dartExecutable: dartExecutable, - ).link( - linkModePreference: linkModePreference, - buildMode: BuildMode.release, - target: target ?? Target.current, - workingDirectory: packageUri, - cCompilerConfig: cCompilerConfig, - includeParentEnvironment: includeParentEnvironment, - packageLayout: packageLayout, - buildResult: buildResult, - resourceIdentifiers: resourceIdentifiers, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, - supportedAssetTypes: supportedAssetTypes, - linkValidator: linkValidator, - applicationAssetValidator: applicationAssetValidator, - ); + required List buildAssetTypes, +}) async { + final targetOS = target?.os ?? OS.current; + return await runWithLog(capturedLogs, () async { + final result = await NativeAssetsBuildRunner( + logger: logger, + dartExecutable: dartExecutable, + ).link( + configCreator: () { + final configBuilder = LinkConfigBuilder(); + if (buildAssetTypes.contains(CodeAsset.type)) { + configBuilder.setupCodeConfig( + targetArchitecture: target?.architecture ?? Architecture.current, + targetOS: target?.os ?? OS.current, + linkModePreference: linkModePreference, + cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion ?? + (targetOS == OS.macOS ? defaultMacOSVersion : null), + targetAndroidNdkApi: targetAndroidNdkApi, + ); + } + return configBuilder; + }, + configValidator: configValidator, + workingDirectory: packageUri, + packageLayout: packageLayout, + buildResult: buildResult, + resourceIdentifiers: resourceIdentifiers, + buildAssetTypes: buildAssetTypes, + linkValidator: linkValidator, + applicationAssetValidator: applicationAssetValidator, + ); - if (result.success) { - expect(await result.encodedAssets.allExist(), true); - } + if (result != null) { + expect(await result.encodedAssets.allExist(), true); + } - return result; - }); + return result; + }); +} -Future<(BuildResult, LinkResult)> buildAndLink( +Future<(BuildResult?, LinkResult?)> buildAndLink( Uri packageUri, Logger logger, Uri dartExecutable, { LinkModePreference linkModePreference = LinkModePreference.dynamic, CCompilerConfig? cCompilerConfig, - required LinkValidator linkValidator, + required BuildConfigValidator buildConfigValidator, + required LinkConfigValidator linkConfigValidator, required BuildValidator buildValidator, + required LinkValidator linkValidator, required ApplicationAssetValidator applicationAssetValidator, - bool includeParentEnvironment = true, List? capturedLogs, PackageLayout? packageLayout, String? runPackageName, @@ -152,7 +174,7 @@ Future<(BuildResult, LinkResult)> buildAndLink( int? targetAndroidNdkApi, Target? target, Uri? resourceIdentifiers, - required Iterable supportedAssetTypes, + required List buildAssetTypes, }) async => await runWithLog(capturedLogs, () async { final buildRunner = NativeAssetsBuildRunner( @@ -160,26 +182,29 @@ Future<(BuildResult, LinkResult)> buildAndLink( dartExecutable: dartExecutable, ); final buildResult = await buildRunner.build( - buildMode: BuildMode.release, - linkModePreference: linkModePreference, - target: target ?? Target.current, + configCreator: () => BuildConfigBuilder() + ..setupCodeConfig( + targetArchitecture: target?.architecture ?? Architecture.current, + targetOS: target?.os ?? OS.current, + linkModePreference: linkModePreference, + cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion, + targetAndroidNdkApi: targetAndroidNdkApi, + ), + configValidator: buildConfigValidator, workingDirectory: packageUri, - cCompilerConfig: cCompilerConfig, - includeParentEnvironment: includeParentEnvironment, packageLayout: packageLayout, runPackageName: runPackageName, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, linkingEnabled: true, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildValidator: buildValidator, applicationAssetValidator: applicationAssetValidator, ); - if (!buildResult.success) { - return (buildResult, HookResult()); + if (buildResult == null) { + return (null, null); } expect(await buildResult.encodedAssets.allExist(), true); @@ -189,26 +214,29 @@ Future<(BuildResult, LinkResult)> buildAndLink( } final linkResult = await buildRunner.link( - linkModePreference: linkModePreference, - buildMode: BuildMode.release, - target: target ?? Target.current, + configCreator: () => LinkConfigBuilder() + ..setupCodeConfig( + targetArchitecture: target?.architecture ?? Architecture.current, + targetOS: target?.os ?? OS.current, + linkModePreference: linkModePreference, + cCompilerConfig: cCompilerConfig, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion, + targetAndroidNdkApi: targetAndroidNdkApi, + ), + configValidator: linkConfigValidator, workingDirectory: packageUri, - cCompilerConfig: cCompilerConfig, - includeParentEnvironment: includeParentEnvironment, packageLayout: packageLayout, buildResult: buildResult, resourceIdentifiers: resourceIdentifiers, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, linkValidator: linkValidator, applicationAssetValidator: applicationAssetValidator, ); - if (linkResult.success) { - expect(await buildResult.encodedAssets.allExist(), true); + if (linkResult != null) { + expect(await linkResult.encodedAssets.allExist(), true); } return (buildResult, linkResult); @@ -233,36 +261,6 @@ Future runWithLog( return result; } -Future buildDryRun( - Uri packageUri, - Logger logger, - Uri dartExecutable, { - required BuildValidator buildValidator, - LinkModePreference linkModePreference = LinkModePreference.dynamic, - CCompilerConfig? cCompilerConfig, - bool includeParentEnvironment = true, - List? capturedLogs, - PackageLayout? packageLayout, - required bool linkingEnabled, - required Iterable supportedAssetTypes, -}) async => - runWithLog(capturedLogs, () async { - final result = await NativeAssetsBuildRunner( - logger: logger, - dartExecutable: dartExecutable, - ).buildDryRun( - linkModePreference: linkModePreference, - targetOS: Target.current.os, - workingDirectory: packageUri, - includeParentEnvironment: includeParentEnvironment, - packageLayout: packageLayout, - linkingEnabled: linkingEnabled, - supportedAssetTypes: supportedAssetTypes, - buildValidator: buildValidator, - ); - return result; - }); - Future expectSymbols({ required CodeAsset asset, required List symbols, @@ -284,3 +282,33 @@ Future expectSymbols({ ); } } + +final CCompilerConfig? dartCICompilerConfig = (() { + // Specifically for running our tests on Dart CI with the test runner, we + // recognize specific variables to setup the C Compiler configuration. + final env = Platform.environment; + final cc = env['DART_HOOK_TESTING_C_COMPILER__CC']; + final ar = env['DART_HOOK_TESTING_C_COMPILER__AR']; + final ld = env['DART_HOOK_TESTING_C_COMPILER__LD']; + final envScript = env['DART_HOOK_TESTING_C_COMPILER__ENV_SCRIPT']; + final envScriptArgs = + env['DART_HOOK_TESTING_C_COMPILER__ENV_SCRIPT_ARGUMENTS'] + ?.split(' ') + .map((arg) => arg.trim()) + .where((arg) => arg.isNotEmpty) + .toList(); + final hasEnvScriptArgs = envScriptArgs != null && envScriptArgs.isNotEmpty; + + if (cc != null && ar != null && ld != null) { + return CCompilerConfig( + archiver: Uri.file(ar), + compiler: Uri.file(cc), + envScript: envScript != null ? Uri.file(envScript) : null, + envScriptArgs: hasEnvScriptArgs ? envScriptArgs : null, + linker: Uri.file(ld), + ); + } + return null; +})(); + +int defaultMacOSVersion = 13; diff --git a/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart b/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart index f43429f8e..e83275b9b 100644 --- a/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart @@ -23,44 +23,42 @@ void main() async { workingDirectory: packageUri, logger: logger, ); - // Make sure the first compile is at least one second after the - // package_config.json is written, otherwise dill compilation isn't - // cached. - await Future.delayed(const Duration(seconds: 1)); final logMessages = []; late BuildResult buildResult; late LinkResult linkResult; Future runBuild() async { logMessages.clear(); - buildResult = await build( + buildResult = (await build( packageUri, logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], capturedLogs: logMessages, + configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], - ); + ))!; } Future runLink() async { logMessages.clear(); - linkResult = await link( + linkResult = (await link( packageUri, logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], capturedLogs: logMessages, + configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], - ); + ))!; } await runBuild(); - expect(buildResult.success, isTrue); + expect(buildResult, isNotNull); expect( logMessages.join('\n'), stringContainsInOrder([ @@ -74,7 +72,7 @@ void main() async { ); await runLink(); - expect(linkResult.success, isTrue); + expect(linkResult, isNotNull); expect( logMessages.join('\n'), stringContainsInOrder([ @@ -88,14 +86,14 @@ void main() async { ); await runBuild(); - expect(buildResult.success, isTrue); + expect(buildResult, isNotNull); expect( logMessages.join('\n'), contains('Skipping build for $packageName'), ); await runLink(); - expect(linkResult.success, isTrue); + expect(linkResult, isNotNull); expect( logMessages.join('\n'), contains('Skipping link for $packageName'), @@ -105,33 +103,30 @@ void main() async { sourceUri: testDataUri.resolve('simple_link_change_asset/'), targetUri: packageUri, ); - // Make sure the first hook is at least one second after the last - // change, or caching will not work. - await Future.delayed(const Duration(seconds: 1)); await runBuild(); - expect(buildResult.success, isTrue); + expect(buildResult, isNotNull); expect( logMessages.join('\n'), stringContainsInOrder(['Running', 'hook.dill']), ); await runLink(); - expect(linkResult.success, isTrue); + expect(linkResult, isNotNull); expect( logMessages.join('\n'), stringContainsInOrder(['Running', 'hook.dill']), ); await runBuild(); - expect(buildResult.success, isTrue); + expect(buildResult, isNotNull); expect( logMessages.join('\n'), contains('Skipping build for $packageName'), ); await runLink(); - expect(linkResult.success, isTrue); + expect(linkResult, isNotNull); expect( logMessages.join('\n'), contains('Skipping link for $packageName'), diff --git a/pkgs/native_assets_builder/test/build_runner/link_test.dart b/pkgs/native_assets_builder/test/build_runner/link_test.dart index cd261d578..1ec0046b5 100644 --- a/pkgs/native_assets_builder/test/build_runner/link_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/link_test.dart @@ -26,37 +26,40 @@ void main() async { logger: logger, ); - final buildResult = await build( + final buildResult = (await build( packageUri, logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], - ); + ))!; expect(buildResult.encodedAssets.length, 0); - final linkResult = await link( + final linkResult = (await link( packageUri, logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], - ); + ))!; expect(linkResult.encodedAssets.length, 2); - final buildNoLinkResult = await build( + final buildNoLinkResult = (await build( packageUri, logger, dartExecutable, linkingEnabled: false, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], - ); + ))!; expect(buildNoLinkResult.encodedAssets.length, 4); }); }, @@ -98,12 +101,13 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], ); - expect(buildResult.success, true); - expect(_getNames(buildResult.encodedAssets), + expect(buildResult, isNotNull); + expect(_getNames(buildResult!.encodedAssets), unorderedEquals(builtHelperAssets)); expect( _getNames(buildResult.encodedAssetsForLinking['complex_link']!), @@ -115,13 +119,14 @@ void main() async { logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], ); - expect(linkResult.success, true); + expect(linkResult, isNotNull); - expect(_getNames(linkResult.encodedAssets), + expect(_getNames(linkResult!.encodedAssets), unorderedEquals([...builtHelperAssets, ...linkedAssets])); }); }, @@ -138,29 +143,31 @@ void main() async { logger: logger, ); - final buildResult = await build( + final buildResult = (await build( packageUri, logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], - ); + ))!; expect(buildResult.encodedAssets.length, 0); expect(buildResult.encodedAssetsForLinking.length, 0); final logMessages = []; - final linkResult = await link( + final linkResult = (await link( packageUri, logger, dartExecutable, buildResult: buildResult, capturedLogs: logMessages, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], - ); + ))!; expect(linkResult.encodedAssets.length, 0); expect( logMessages, @@ -191,29 +198,31 @@ void main() async { logger: logger, ); - final buildResult = await build( + final buildResult = (await build( packageUri, logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect(buildResult.encodedAssets.length, 0); expect(buildResult.encodedAssetsForLinking.length, 1); final logMessages = []; - final linkResult = await link( + final linkResult = (await link( packageUri, logger, dartExecutable, buildResult: buildResult, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetLinkConfig, linkValidator: validateCodeAssetLinkOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; expect(linkResult.encodedAssets.length, 1); expect(linkResult.encodedAssets.first.type, CodeAsset.type); }); diff --git a/pkgs/native_assets_builder/test/build_runner/metadata_test.dart b/pkgs/native_assets_builder/test/build_runner/metadata_test.dart index 8fcb39afe..274b88c9c 100644 --- a/pkgs/native_assets_builder/test/build_runner/metadata_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/metadata_test.dart @@ -31,7 +31,8 @@ void main() async { logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: ['foo'], + buildAssetTypes: ['foo'], + configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], ); diff --git a/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart b/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart index 55b20dba4..92e60dc01 100644 --- a/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart @@ -21,45 +21,49 @@ void main() async { logger: logger, ); - final resultDynamic = await build( + final resultDynamic = (await build( packageUri, logger, dartExecutable, linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; - final resultPreferDynamic = await build( + final resultPreferDynamic = (await build( packageUri, logger, dartExecutable, linkModePreference: LinkModePreference.preferDynamic, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; - final resultStatic = await build( + final resultStatic = (await build( packageUri, logger, dartExecutable, linkModePreference: LinkModePreference.static, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; - final resultPreferStatic = await build( + final resultPreferStatic = (await build( packageUri, logger, dartExecutable, linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, - ); + applicationAssetValidator: validateCodeAssetInApplication, + ))!; // This package honors preferences. expect( diff --git a/pkgs/native_assets_builder/test/build_runner/parse_dep_file_test.dart b/pkgs/native_assets_builder/test/build_runner/parse_dep_file_test.dart new file mode 100644 index 000000000..02897123e --- /dev/null +++ b/pkgs/native_assets_builder/test/build_runner/parse_dep_file_test.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:native_assets_builder/src/build_runner/build_runner.dart'; +import 'package:test/test.dart'; + +void main() { + test('parseDepFileInputs', () { + expect( + parseDepFileInputs( + r'C:\\Program\ Files\\foo.dill: C:\\Program\ Files\\foo.dart C:\\Program\ Files\\bar.dart', + ), + [ + r'C:\Program Files\foo.dart', + r'C:\Program Files\bar.dart', + ], + ); + }); +} diff --git a/pkgs/native_assets_builder/test/build_runner/resources_test.dart b/pkgs/native_assets_builder/test/build_runner/resources_test.dart index 14b80af78..4d5a87207 100644 --- a/pkgs/native_assets_builder/test/build_runner/resources_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/resources_test.dart @@ -29,15 +29,16 @@ void main() async { logger: logger, ); - final buildResult = await build( + final buildResult = (await build( packageUri, logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], - ); + ))!; Iterable buildFiles() => Directory.fromUri( packageUri.resolve('.dart_tool/native_assets_builder/')) @@ -52,7 +53,8 @@ void main() async { dartExecutable, buildResult: buildResult, resourceIdentifiers: resourcesUri, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], + configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], ); diff --git a/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart b/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart index 01e637f5a..4a1c58d25 100644 --- a/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart @@ -27,12 +27,14 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], + configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, - applicationAssetValidator: validateCodeAssetsInApplication, + applicationAssetValidator: validateCodeAssetInApplication, + linkingEnabled: true, ); final fullLog = logMessages.join('\n'); - expect(result.success, false); + expect(result, isNull); expect( fullLog, contains('but that package does not have a link hook'), diff --git a/pkgs/native_assets_builder/test/dependencies_hash_file/dependencies_hash_file_test.dart b/pkgs/native_assets_builder/test/dependencies_hash_file/dependencies_hash_file_test.dart new file mode 100644 index 000000000..c222b31a4 --- /dev/null +++ b/pkgs/native_assets_builder/test/dependencies_hash_file/dependencies_hash_file_test.dart @@ -0,0 +1,135 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:native_assets_builder/src/dependencies_hash_file/dependencies_hash_file.dart'; +import 'package:test/test.dart'; + +import '../helpers.dart'; + +void main() async { + final environment = Platform.environment; + + test('json format', () async { + await inTempDir((tempUri) async { + final hashes = FileSystemHashes( + files: [ + FilesystemEntityHash( + tempUri.resolve('foo.dll'), + 1337, + ), + ], + ); + final hashes2 = FileSystemHashes.fromJson(hashes.toJson()); + expect(hashes.files.single.path, equals(hashes2.files.single.path)); + expect(hashes.files.single.hash, equals(hashes2.files.single.hash)); + }); + }); + + test('dependencies hash file', () async { + await inTempDir((tempUri) async { + final tempFile = File.fromUri(tempUri.resolve('foo.txt')); + final tempSubDir = Directory.fromUri(tempUri.resolve('subdir/')); + final subFile = File.fromUri(tempSubDir.uri.resolve('bar.txt')); + + final hashesFile = File.fromUri(tempUri.resolve('hashes.json')); + final hashes = DependenciesHashFile(file: hashesFile); + + Future reset() async { + await tempFile.create(recursive: true); + await tempSubDir.create(recursive: true); + await subFile.create(recursive: true); + await tempFile.writeAsString('hello'); + await subFile.writeAsString('world'); + + await hashes.hashDependencies( + [ + tempFile.uri, + tempSubDir.uri, + ], + (await tempFile.lastModified()).add(const Duration(minutes: 1)), + environment, + ); + } + + await reset(); + + // No changes + expect(await hashes.findOutdatedDependency(environment), isNull); + + // Change file contents. + await tempFile.writeAsString('asdf'); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempFile.uri.toFilePath()), + ); + await reset(); + + // Delete file. + await tempFile.delete(); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempFile.uri.toFilePath()), + ); + await reset(); + + // Add file to tracked directory. + final subFile2 = File.fromUri(tempSubDir.uri.resolve('baz.txt')); + await subFile2.create(recursive: true); + await subFile2.writeAsString('hello'); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempSubDir.uri.toFilePath()), + ); + await reset(); + + // Delete file from tracked directory. + await subFile.delete(); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempSubDir.uri.toFilePath()), + ); + await reset(); + + // Delete tracked directory. + await tempSubDir.delete(recursive: true); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempSubDir.uri.toFilePath()), + ); + await reset(); + + // Add directory to tracked directory. + final subDir2 = Directory.fromUri(tempSubDir.uri.resolve('baz/')); + await subDir2.create(recursive: true); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempSubDir.uri.toFilePath()), + ); + await reset(); + + // Overwriting a file with identical contents. + await tempFile.writeAsString('something something'); + await tempFile.writeAsString('hello'); + expect(await hashes.findOutdatedDependency(environment), isNull); + await reset(); + + // If a file is modified after the valid timestamp, it should be marked + // as changed. + await hashes.hashDependencies( + [ + tempFile.uri, + ], + (await tempFile.lastModified()).subtract(const Duration(seconds: 1)), + environment, + ); + expect( + await hashes.findOutdatedDependency(environment), + contains(tempFile.uri.toFilePath()), + ); + }); + }); +} diff --git a/pkgs/native_assets_builder/test/helpers.dart b/pkgs/native_assets_builder/test/helpers.dart index 85759c73b..0242bcd06 100644 --- a/pkgs/native_assets_builder/test/helpers.dart +++ b/pkgs/native_assets_builder/test/helpers.dart @@ -8,11 +8,14 @@ import 'dart:io'; import 'package:logging/logging.dart'; import 'package:native_assets_builder/src/utils/run_process.dart' as run_process; +import 'package:native_assets_cli/code_assets.dart'; +import 'package:native_assets_cli/data_assets.dart'; import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:native_assets_cli/native_assets_cli_internal.dart' as internal; import 'package:test/test.dart'; import 'package:yaml/yaml.dart'; +export 'package:native_assets_cli/code_assets_builder.dart'; +export 'package:native_assets_cli/data_assets_builder.dart'; export 'package:native_assets_cli/native_assets_cli_internal.dart'; extension UriExtension on Uri { @@ -66,7 +69,6 @@ Future runProcess({ List arguments = const [], Uri? workingDirectory, Map? environment, - bool includeParentEnvironment = true, required Logger? logger, bool captureOutput = true, int expectedExitCode = 0, @@ -77,7 +79,6 @@ Future runProcess({ arguments: arguments, workingDirectory: workingDirectory, environment: environment, - includeParentEnvironment: includeParentEnvironment, logger: logger, captureOutput: captureOutput, expectedExitCode: expectedExitCode, @@ -160,13 +161,15 @@ final List? _envScriptArgs = Platform /// Configuration for the native toolchain. /// /// Provided on Dart CI. -final cCompiler = internal.CCompilerConfig( - compiler: _cc, - archiver: _ar, - linker: _ld, - envScript: _envScript, - envScriptArgs: _envScriptArgs, -); +final cCompiler = (_cc == null || _ar == null || _ld == null) + ? null + : CCompilerConfig( + compiler: _cc!, + archiver: _ar!, + linker: _ld!, + envScript: _envScript, + envScriptArgs: _envScriptArgs, + ); extension on String { Uri asFileUri() => Uri.file(this); diff --git a/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart b/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart index fbf4947d2..2e35c3b13 100644 --- a/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart +++ b/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart @@ -18,114 +18,110 @@ import '../helpers.dart'; void main() async { const name = 'native_dynamic_linking'; - for (final dryRun in [true, false]) { - final testSuffix = dryRun ? ' dry_run' : ''; - test( - 'native_dynamic_linking build$testSuffix', - () => inTempDir((tempUri) async { - final outputDirectory = tempUri.resolve('out/'); - await Directory.fromUri(outputDirectory).create(); - final outputDirectoryShared = tempUri.resolve('out_shared/'); - await Directory.fromUri(outputDirectoryShared).create(); - final testTempUri = tempUri.resolve('test1/'); - await Directory.fromUri(testTempUri).create(); - final testPackageUri = testDataUri.resolve('$name/'); - final dartUri = Uri.file(Platform.resolvedExecutable); + test( + 'native_dynamic_linking build', + () => inTempDir((tempUri) async { + final outputDirectory = tempUri.resolve('out/'); + await Directory.fromUri(outputDirectory).create(); + final outputDirectoryShared = tempUri.resolve('out_shared/'); + await Directory.fromUri(outputDirectoryShared).create(); + final testTempUri = tempUri.resolve('test1/'); + await Directory.fromUri(testTempUri).create(); + final testPackageUri = testDataUri.resolve('$name/'); + final dartUri = Uri.file(Platform.resolvedExecutable); - final config = BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( packageName: name, packageRoot: testPackageUri, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildConfig(dryRun: false, linkingEnabled: false) + ..setupBuildRunConfig( + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared, + ) + ..setupCodeConfig( + targetArchitecture: Architecture.current, targetOS: OS.current, - version: HookConfigImpl.latestVersion, linkModePreference: LinkModePreference.dynamic, - dryRun: dryRun, - linkingEnabled: false, - targetArchitecture: dryRun ? null : Architecture.current, - buildMode: dryRun ? null : BuildMode.debug, - cCompiler: dryRun ? null : cCompiler, - supportedAssetTypes: [CodeAsset.type], + cCompilerConfig: cCompiler, ); - final buildConfigUri = testTempUri.resolve('build_config.json'); - File.fromUri(buildConfigUri) - .writeAsStringSync(jsonEncode(config.toJson())); + final buildConfigUri = testTempUri.resolve('build_config.json'); + File.fromUri(buildConfigUri) + .writeAsStringSync(jsonEncode(configBuilder.json)); - final processResult = await Process.run( - dartUri.toFilePath(), - [ - 'hook/build.dart', - '--config=${buildConfigUri.toFilePath()}', - ], - workingDirectory: testPackageUri.toFilePath(), - ); - if (processResult.exitCode != 0) { - print(processResult.stdout); - print(processResult.stderr); - print(processResult.exitCode); - } - expect(processResult.exitCode, 0); + final processResult = await Process.run( + dartUri.toFilePath(), + [ + 'hook/build.dart', + '--config=${buildConfigUri.toFilePath()}', + ], + workingDirectory: testPackageUri.toFilePath(), + ); + if (processResult.exitCode != 0) { + print(processResult.stdout); + print(processResult.stderr); + print(processResult.exitCode); + } + expect(processResult.exitCode, 0); + + final buildOutputUri = outputDirectory.resolve('build_output.json'); + final buildOutput = BuildOutput( + json.decode(await File.fromUri(buildOutputUri).readAsString()) + as Map); + final assets = buildOutput.encodedAssets; + final dependencies = buildOutput.dependencies; - final buildOutputUri = outputDirectory.resolve('build_output.json'); - final buildOutput = HookOutputImpl.fromJsonString( - await File.fromUri(buildOutputUri).readAsString()); - final assets = buildOutput.encodedAssets; - final dependencies = buildOutput.dependencies; - if (dryRun) { - expect(assets.length, greaterThanOrEqualTo(3)); - expect(dependencies, []); - } else { - expect(assets.length, 3); - expect(await assets.allExist(), true); - expect( - dependencies, - [ - testPackageUri.resolve('src/debug.c'), - testPackageUri.resolve('src/math.c'), - testPackageUri.resolve('src/add.c'), - ], - ); + expect(assets.length, 3); + expect(await assets.allExist(), true); + expect( + dependencies, + [ + testPackageUri.resolve('src/debug.c'), + testPackageUri.resolve('src/math.c'), + testPackageUri.resolve('src/add.c'), + ], + ); - final addLibraryPath = assets - .where((e) => e.type == CodeAsset.type) - .map(CodeAsset.fromEncoded) - .firstWhere((asset) => asset.id.endsWith('add.dart')) - .file! - .toFilePath(); - final addResult = await runProcess( - executable: dartExecutable, - arguments: [ - 'run', - pkgNativeAssetsBuilderUri - .resolve('test/test_data/native_dynamic_linking_helper.dart') - .toFilePath(), - addLibraryPath, - '1', - '2', - ], - environment: { - // Add the directory containing the linked dynamic libraries to - // the PATH so that the dynamic linker can find them. - // TODO(https://github.com/dart-lang/sdk/issues/56551): We could - // skip this if Dart would implicitly add dylib containing - // directories to the PATH. - if (Platform.isWindows) - 'PATH': '${outputDirectory.toFilePath()};' - '${Platform.environment['PATH']}', - }, - throwOnUnexpectedExitCode: true, - logger: logger, - ); - expect( - addResult.stdout, - allOf( - contains('Adding 1 and 2.'), - contains('Result: 3'), - ), - ); - } - }), - ); - } + final addLibraryPath = assets + .where((e) => e.type == CodeAsset.type) + .map(CodeAsset.fromEncoded) + .firstWhere((asset) => asset.id.endsWith('add.dart')) + .file! + .toFilePath(); + final addResult = await runProcess( + executable: dartExecutable, + arguments: [ + 'run', + pkgNativeAssetsBuilderUri + .resolve('test/test_data/native_dynamic_linking_helper.dart') + .toFilePath(), + addLibraryPath, + '1', + '2', + ], + environment: { + // Add the directory containing the linked dynamic libraries to + // the PATH so that the dynamic linker can find them. + // TODO(https://github.com/dart-lang/sdk/issues/56551): We could + // skip this if Dart would implicitly add dylib containing + // directories to the PATH. + if (Platform.isWindows) + 'PATH': '${outputDirectory.toFilePath()};' + '${Platform.environment['PATH']}', + }, + throwOnUnexpectedExitCode: true, + logger: logger, + ); + expect( + addResult.stdout, + allOf( + contains('Adding 1 and 2.'), + contains('Result: 3'), + ), + ); + }), + ); } diff --git a/pkgs/native_assets_builder/test/test_data/transformer_test.dart b/pkgs/native_assets_builder/test/test_data/transformer_test.dart index 334fa8724..05d2b868c 100644 --- a/pkgs/native_assets_builder/test/test_data/transformer_test.dart +++ b/pkgs/native_assets_builder/test/test_data/transformer_test.dart @@ -45,24 +45,26 @@ void main() async { late BuildOutput output; Future runBuild(Architecture architecture) async { - final config = BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageUri, - targetOS: OS.current, - version: HookConfigImpl.latestVersion, - linkModePreference: LinkModePreference.dynamic, - dryRun: false, - linkingEnabled: false, - targetArchitecture: architecture, - buildMode: BuildMode.debug, - supportedAssetTypes: [DataAsset.type], - ); + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageUri, + buildAssetTypes: [DataAsset.type], + ) + ..setupBuildConfig(dryRun: false, linkingEnabled: false) + ..setupBuildRunConfig( + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared, + ) + ..setupCodeConfig( + targetArchitecture: architecture, + targetOS: OS.current, + linkModePreference: LinkModePreference.dynamic, + ); final buildConfigUri = testTempUri.resolve('build_config.json'); - await File.fromUri(buildConfigUri) - .writeAsString(jsonEncode(config.toJson())); + File.fromUri(buildConfigUri) + .writeAsStringSync(jsonEncode(configBuilder.json)); final processResult = await Process.run( dartUri.toFilePath(), @@ -81,8 +83,9 @@ void main() async { stdout = processResult.stdout as String; final buildOutputUri = outputDirectory.resolve('build_output.json'); - output = HookOutputImpl.fromJsonString( - await File.fromUri(buildOutputUri).readAsString()); + output = BuildOutput( + json.decode(await File.fromUri(buildOutputUri).readAsString()) + as Map); } await runBuild(Architecture.x64); @@ -94,7 +97,7 @@ void main() async { ]), ); expect( - output.dataAssets.all, + output.dataAssets, contains( DataAsset( file: outputDirectoryShared.resolve('data_transformed0.json'), diff --git a/pkgs/native_assets_builder/test_data/add_asset_link/hook/build.dart b/pkgs/native_assets_builder/test_data/add_asset_link/hook/build.dart index c08c9dbd1..10a1d4575 100644 --- a/pkgs/native_assets_builder/test_data/add_asset_link/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/add_asset_link/hook/build.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; void main(List arguments) async { diff --git a/pkgs/native_assets_builder/test_data/add_asset_link/hook/link.dart b/pkgs/native_assets_builder/test_data/add_asset_link/hook/link.dart index ccfbb9775..67ff71cfb 100644 --- a/pkgs/native_assets_builder/test_data/add_asset_link/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/add_asset_link/hook/link.dart @@ -2,11 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; void main(List arguments) async { await link(arguments, (config, output) async { - final builtDylib = config.codeAssets.all.first; + final builtDylib = config.codeAssets.first; output ..codeAssets.add( CodeAsset( diff --git a/pkgs/native_assets_builder/test_data/add_asset_link/pubspec.yaml b/pkgs/native_assets_builder/test_data/add_asset_link/pubspec.yaml index af5048e88..fc0cad1b6 100644 --- a/pkgs/native_assets_builder/test_data/add_asset_link/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/add_asset_link/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: logging: ^1.1.1 meta: ^1.12.0 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/complex_link/hook/build.dart b/pkgs/native_assets_builder/test_data/complex_link/hook/build.dart index 0ac49c85c..5a508c4c0 100644 --- a/pkgs/native_assets_builder/test_data/complex_link/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/complex_link/hook/build.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await build(args, (config, output) async { diff --git a/pkgs/native_assets_builder/test_data/complex_link/hook/link.dart b/pkgs/native_assets_builder/test_data/complex_link/hook/link.dart index 113586781..735c78502 100644 --- a/pkgs/native_assets_builder/test_data/complex_link/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/complex_link/hook/link.dart @@ -2,13 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await link( args, (config, output) async => - output.dataAssets.addAll(treeshake(config.dataAssets.all)), + output.dataAssets.addAll(treeshake(config.dataAssets)), ); } diff --git a/pkgs/native_assets_builder/test_data/complex_link/pubspec.yaml b/pkgs/native_assets_builder/test_data/complex_link/pubspec.yaml index d4445c879..96956ce7e 100644 --- a/pkgs/native_assets_builder/test_data/complex_link/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/complex_link/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: complex_link_helper: path: ../complex_link_helper/ logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/complex_link_helper/hook/build.dart b/pkgs/native_assets_builder/test_data/complex_link_helper/hook/build.dart index 79ff0dfdf..fe2829fd5 100644 --- a/pkgs/native_assets_builder/test_data/complex_link_helper/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/complex_link_helper/hook/build.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await build(args, (config, output) async { diff --git a/pkgs/native_assets_builder/test_data/complex_link_helper/pubspec.yaml b/pkgs/native_assets_builder/test_data/complex_link_helper/pubspec.yaml index 0a5355a85..831600744 100644 --- a/pkgs/native_assets_builder/test_data/complex_link_helper/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/complex_link_helper/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: cli_config: ^0.2.0 logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/cyclic_package_1/pubspec.yaml b/pkgs/native_assets_builder/test_data/cyclic_package_1/pubspec.yaml index 6f446150c..3afb3c72a 100644 --- a/pkgs/native_assets_builder/test_data/cyclic_package_1/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/cyclic_package_1/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: cyclic_package_2: path: ../cyclic_package_2 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/cyclic_package_2/pubspec.yaml b/pkgs/native_assets_builder/test_data/cyclic_package_2/pubspec.yaml index 08198d0eb..86a627053 100644 --- a/pkgs/native_assets_builder/test_data/cyclic_package_2/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/cyclic_package_2/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: cyclic_package_1: path: ../cyclic_package_1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/depend_on_fail_build/hook/build.dart b/pkgs/native_assets_builder/test_data/depend_on_fail_build/hook/build.dart new file mode 100644 index 000000000..bee5aadf4 --- /dev/null +++ b/pkgs/native_assets_builder/test_data/depend_on_fail_build/hook/build.dart @@ -0,0 +1,13 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:fail_build/fail_build.dart'; +import 'package:native_assets_cli/data_assets.dart'; + +void main(List arguments) async { + await build(arguments, (config, output) async { + // Does nothing, just depends on `package:fail_build`. + invokeFailBuildCode(); + }); +} diff --git a/pkgs/native_assets_builder/test_data/depend_on_fail_build/lib/depend_on_fail_build.dart b/pkgs/native_assets_builder/test_data/depend_on_fail_build/lib/depend_on_fail_build.dart new file mode 100644 index 000000000..0457dc633 --- /dev/null +++ b/pkgs/native_assets_builder/test_data/depend_on_fail_build/lib/depend_on_fail_build.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +void invokeDependOnFailBuildCode() {} diff --git a/pkgs/native_assets_builder/test_data/depend_on_fail_build/pubspec.yaml b/pkgs/native_assets_builder/test_data/depend_on_fail_build/pubspec.yaml new file mode 100644 index 000000000..253d3141f --- /dev/null +++ b/pkgs/native_assets_builder/test_data/depend_on_fail_build/pubspec.yaml @@ -0,0 +1,20 @@ +name: depend_on_fail_build +description: Has a dependency that fails to build. +version: 0.1.0 + +publish_to: none + +environment: + sdk: '>=3.3.0 <4.0.0' + +dependencies: + fail_build: + path: ../fail_build/ + # native_assets_cli: ^0.9.0 + native_assets_cli: + path: ../../../native_assets_cli/ + +dev_dependencies: + ffigen: ^8.0.2 + lints: ^3.0.0 + test: ^1.23.1 diff --git a/pkgs/native_assets_builder/test_data/depend_on_fail_build_app/bin/depend_on_fail_build_app.dart b/pkgs/native_assets_builder/test_data/depend_on_fail_build_app/bin/depend_on_fail_build_app.dart new file mode 100644 index 000000000..2abcfd041 --- /dev/null +++ b/pkgs/native_assets_builder/test_data/depend_on_fail_build_app/bin/depend_on_fail_build_app.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:depend_on_fail_build/depend_on_fail_build.dart'; + +void main() { + invokeDependOnFailBuildCode(); +} diff --git a/pkgs/native_assets_builder/test_data/depend_on_fail_build_app/pubspec.yaml b/pkgs/native_assets_builder/test_data/depend_on_fail_build_app/pubspec.yaml new file mode 100644 index 000000000..ddb0ec04d --- /dev/null +++ b/pkgs/native_assets_builder/test_data/depend_on_fail_build_app/pubspec.yaml @@ -0,0 +1,20 @@ +name: depend_on_fail_build_app +description: Has a dependency that has a dependency that fails to build. +version: 0.1.0 + +publish_to: none + +environment: + sdk: '>=3.3.0 <4.0.0' + +dependencies: + depend_on_fail_build: + path: ../depend_on_fail_build/ + # native_assets_cli: ^0.9.0 + native_assets_cli: + path: ../../../native_assets_cli/ + +dev_dependencies: + ffigen: ^8.0.2 + lints: ^3.0.0 + test: ^1.23.1 diff --git a/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/build.dart b/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/build.dart index 41030887e..a924a9ee8 100644 --- a/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/build.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; void main(List arguments) async { diff --git a/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/link.dart b/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/link.dart index fb9921e47..9e5f01743 100644 --- a/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/drop_dylib_link/hook/link.dart @@ -2,17 +2,18 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; void main(List arguments) async { await link(arguments, (config, output) async { - print(''' -Received ${config.codeAssets.all.length} encodedAssets: ${config.codeAssets.all.map((e) => e.id)}. -'''); - output.codeAssets.addAll( - config.codeAssets.all.where((asset) => asset.id.endsWith('add'))); - print(''' -Keeping only ${output.codeAssets.all.map((e) => e.id)}. -'''); + for (final codeAsset in config.codeAssets) { + print('Got code asset: ${codeAsset.id}'); + if (codeAsset.id.endsWith('add')) { + output.codeAssets.add(codeAsset); + print('-> Keeping ${codeAsset.id}'); + } else { + print('-> Dropping ${codeAsset.id}'); + } + } }); } diff --git a/pkgs/native_assets_builder/test_data/drop_dylib_link/pubspec.yaml b/pkgs/native_assets_builder/test_data/drop_dylib_link/pubspec.yaml index 1be5a388b..dab48f2aa 100644 --- a/pkgs/native_assets_builder/test_data/drop_dylib_link/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/drop_dylib_link/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/fail_build/hook/build.dart b/pkgs/native_assets_builder/test_data/fail_build/hook/build.dart new file mode 100644 index 000000000..790b93525 --- /dev/null +++ b/pkgs/native_assets_builder/test_data/fail_build/hook/build.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +void main(List arguments) async { + print('Just here to fail the build!'); + exit(1); +} diff --git a/pkgs/native_assets_builder/test_data/fail_build/lib/fail_build.dart b/pkgs/native_assets_builder/test_data/fail_build/lib/fail_build.dart new file mode 100644 index 000000000..d6eb1aacc --- /dev/null +++ b/pkgs/native_assets_builder/test_data/fail_build/lib/fail_build.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +void invokeFailBuildCode() {} diff --git a/pkgs/native_assets_builder/test_data/fail_build/pubspec.yaml b/pkgs/native_assets_builder/test_data/fail_build/pubspec.yaml new file mode 100644 index 000000000..b04fe9a5d --- /dev/null +++ b/pkgs/native_assets_builder/test_data/fail_build/pubspec.yaml @@ -0,0 +1,18 @@ +name: fail_build +description: Always fails to build +version: 0.1.0 + +publish_to: none + +environment: + sdk: '>=3.3.0 <4.0.0' + +dependencies: + # native_assets_cli: ^0.9.0 + native_assets_cli: + path: ../../../native_assets_cli/ + +dev_dependencies: + ffigen: ^8.0.2 + lints: ^3.0.0 + test: ^1.23.1 diff --git a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/hook/build.dart b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/hook/build.dart index 73ef7a438..d774f5e13 100644 --- a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/hook/build.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; // Simulate needing some version of the API. // @@ -14,15 +14,16 @@ const minMacOSVersionForThisPackage = 13; void main(List arguments) async { await build(arguments, (config, output) async { - if (config.targetOS == OS.android) { - if (config.targetAndroidNdkApi! < minNdkApiVersionForThisPackage) { + if (config.codeConfig.targetOS == OS.android) { + if (config.codeConfig.targetAndroidNdkApi! < + minNdkApiVersionForThisPackage) { throw UnsupportedError( 'The native assets for this package require at ' 'least Android NDK API level $minNdkApiVersionForThisPackage.', ); } - } else if (config.targetOS == OS.iOS) { - final iosVersion = config.targetIOSVersion; + } else if (config.codeConfig.targetOS == OS.iOS) { + final iosVersion = config.codeConfig.targetIOSVersion; // iosVersion is nullable to deal with version skew. if (iosVersion != null && iosVersion < minIosVersionForThisPackage) { throw UnsupportedError( @@ -30,8 +31,8 @@ void main(List arguments) async { 'least iOS version $minIosVersionForThisPackage.', ); } - } else if (config.targetOS == OS.macOS) { - final macosVersion = config.targetMacOSVersion; + } else if (config.codeConfig.targetOS == OS.macOS) { + final macosVersion = config.codeConfig.targetMacOSVersion; // macosVersion is nullable to deal with version skew. if (macosVersion != null && macosVersion < minMacOSVersionForThisPackage) { diff --git a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/pubspec.yaml b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/pubspec.yaml index e558494b3..c11ee9543 100644 --- a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/hook/build.dart b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/hook/build.dart index 5ac16fef7..3d96b622e 100644 --- a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/hook/build.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List arguments) async { await build(arguments, (config, output) async { diff --git a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/pubspec.yaml b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/pubspec.yaml index 87a430c9d..70756509a 100644 --- a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_link/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: fail_on_os_sdk_version_linker: path: ../fail_on_os_sdk_version_linker/ - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/hook/link.dart b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/hook/link.dart index 3036e8749..a4603499f 100644 --- a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/hook/link.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; // Simulate needing some version of the API. // @@ -14,15 +14,16 @@ const minMacOSVersionForThisPackage = 13; void main(List arguments) async { await link(arguments, (config, output) async { - if (config.targetOS == OS.android) { - if (config.targetAndroidNdkApi! < minNdkApiVersionForThisPackage) { + if (config.codeConfig.targetOS == OS.android) { + if (config.codeConfig.targetAndroidNdkApi! < + minNdkApiVersionForThisPackage) { throw UnsupportedError( 'The native assets for this package require at ' 'least Android NDK API level $minNdkApiVersionForThisPackage.', ); } - } else if (config.targetOS == OS.iOS) { - final iosVersion = config.targetIOSVersion; + } else if (config.codeConfig.targetOS == OS.iOS) { + final iosVersion = config.codeConfig.targetIOSVersion; // iosVersion is nullable to deal with version skew. if (iosVersion != null && iosVersion < minIosVersionForThisPackage) { throw UnsupportedError( @@ -30,8 +31,8 @@ void main(List arguments) async { 'least iOS version $minIosVersionForThisPackage.', ); } - } else if (config.targetOS == OS.macOS) { - final macosVersion = config.targetMacOSVersion; + } else if (config.codeConfig.targetOS == OS.macOS) { + final macosVersion = config.codeConfig.targetMacOSVersion; // macosVersion is nullable to deal with version skew. if (macosVersion != null && macosVersion < minMacOSVersionForThisPackage) { diff --git a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/pubspec.yaml b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/pubspec.yaml index 334c98891..0826f38fb 100644 --- a/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/fail_on_os_sdk_version_linker/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/manifest.yaml b/pkgs/native_assets_builder/test_data/manifest.yaml index 6bcdcd32c..9ed41c7c9 100644 --- a/pkgs/native_assets_builder/test_data/manifest.yaml +++ b/pkgs/native_assets_builder/test_data/manifest.yaml @@ -28,6 +28,11 @@ - cyclic_package_2/pubspec.yaml - dart_app/bin/dart_app.dart - dart_app/pubspec.yaml +- depend_on_fail_build_app/bin/depend_on_fail_build_app.dart +- depend_on_fail_build_app/pubspec.yaml +- depend_on_fail_build/hook/build.dart +- depend_on_fail_build/lib/depend_on_fail_build.dart +- depend_on_fail_build/pubspec.yaml - drop_dylib_link/bin/drop_dylib_link.dart - drop_dylib_link/hook/build.dart - drop_dylib_link/hook/link.dart @@ -39,6 +44,9 @@ - drop_dylib_link/src/native_add.h - drop_dylib_link/src/native_multiply.c - drop_dylib_link/src/native_multiply.h +- fail_build/hook/build.dart +- fail_build/lib/fail_build.dart +- fail_build/pubspec.yaml - fail_on_os_sdk_version_link/assets/data.json - fail_on_os_sdk_version_link/hook/build.dart - fail_on_os_sdk_version_link/pubspec.yaml @@ -46,6 +54,12 @@ - fail_on_os_sdk_version_linker/pubspec.yaml - fail_on_os_sdk_version/hook/build.dart - fail_on_os_sdk_version/pubspec.yaml +- native_add_duplicate/bin/native_add_duplicate.dart +- native_add_duplicate/hook/build.dart +- native_add_duplicate/hook/link.dart +- native_add_duplicate/pubspec.yaml +- native_add_duplicate/src/native_add.c +- native_add_duplicate/src/native_add.h - native_add/ffigen.yaml - native_add/hook/build.dart - native_add/lib/native_add.dart @@ -55,12 +69,19 @@ - native_add/src/native_add.c - native_add/src/native_add.h - native_add/test/native_add_test.dart -- native_add_duplicate/bin/native_add_duplicate.dart -- native_add_duplicate/hook/build.dart -- native_add_duplicate/hook/link.dart -- native_add_duplicate/pubspec.yaml -- native_add_duplicate/src/native_add.c -- native_add_duplicate/src/native_add.h +- native_dynamic_linking/bin/native_dynamic_linking.dart +- native_dynamic_linking/ffigen.yaml +- native_dynamic_linking/hook/build.dart +- native_dynamic_linking/lib/add.dart +- native_dynamic_linking/pubspec.yaml +- native_dynamic_linking/README.md +- native_dynamic_linking/src/add.c +- native_dynamic_linking/src/add.h +- native_dynamic_linking/src/debug.c +- native_dynamic_linking/src/debug.h +- native_dynamic_linking/src/math.c +- native_dynamic_linking/src/math.h +- native_dynamic_linking/test/add_test.dart - native_subtract/ffigen.yaml - native_subtract/hook/build.dart - native_subtract/lib/native_subtract.dart @@ -75,6 +96,13 @@ - package_reading_metadata/pubspec.yaml - package_with_metadata/hook/build.dart - package_with_metadata/pubspec.yaml +- simple_data_asset/assets/test_asset.txt +- simple_data_asset/bin/deep_modify_data_asset.dart.debug +- simple_data_asset/bin/modify_data_asset.dart.debug +- simple_data_asset/bin/simple_data_asset.dart.debug +- simple_data_asset/hook/build.dart +- simple_data_asset/pubspec.yaml +- simple_data_asset/README.md - simple_link/assets/data_0.json - simple_link/assets/data_1.json - simple_link/assets/data_2.json @@ -82,13 +110,6 @@ - simple_link/hook/build.dart - simple_link/hook/link.dart - simple_link/pubspec.yaml -- simple_data_asset/pubspec.yaml -- simple_data_asset/assets/test_asset.txt -- simple_data_asset/README.md -- simple_data_asset/hook/build.dart -- simple_data_asset/bin/simple_data_asset.dart.debug -- simple_data_asset/bin/modify_data_asset.dart.debug -- simple_data_asset/bin/deep_modify_data_asset.dart.debug - some_dev_dep/bin/some_dev_dep.dart - some_dev_dep/pubspec.yaml - transformer/data/data0.json @@ -103,20 +124,20 @@ - transformer/data/data9.json - transformer/hook/build.dart - transformer/lib/src/transform.dart -- transformer/tool/generate_data.dart - transformer/pubspec.yaml -- treeshaking_native_libs/pubspec.yaml -- treeshaking_native_libs/lib/treeshaking_native_libs.dart -- treeshaking_native_libs/lib/src/treeshaking_native_libs.dart +- transformer/tool/generate_data.dart +- treeshaking_native_libs/bin/treeshaking_native_libs.dart +- treeshaking_native_libs/ffigen.yaml +- treeshaking_native_libs/hook/build.dart +- treeshaking_native_libs/hook/link.dart - treeshaking_native_libs/lib/src/treeshaking_native_libs_bindings_generated.dart -- treeshaking_native_libs/src/native_add.h -- treeshaking_native_libs/src/native_multiply.h +- treeshaking_native_libs/lib/src/treeshaking_native_libs.dart +- treeshaking_native_libs/lib/treeshaking_native_libs.dart +- treeshaking_native_libs/pubspec.yaml - treeshaking_native_libs/src/native_add.c +- treeshaking_native_libs/src/native_add.h - treeshaking_native_libs/src/native_multiply.c -- treeshaking_native_libs/hook/link.dart -- treeshaking_native_libs/hook/build.dart -- treeshaking_native_libs/bin/treeshaking_native_libs.dart -- treeshaking_native_libs/ffigen.yaml +- treeshaking_native_libs/src/native_multiply.h - wrong_build_output_2/hook/build.dart - wrong_build_output_2/pubspec.yaml - wrong_build_output_3/hook/build.dart @@ -127,16 +148,3 @@ - wrong_linker/pubspec.yaml - wrong_namespace_asset/hook/build.dart - wrong_namespace_asset/pubspec.yaml -- native_dynamic_linking/bin/native_dynamic_linking.dart -- native_dynamic_linking/hook/build.dart -- native_dynamic_linking/lib/add.dart -- native_dynamic_linking/src/add.c -- native_dynamic_linking/src/add.h -- native_dynamic_linking/src/debug.c -- native_dynamic_linking/src/debug.h -- native_dynamic_linking/src/math.c -- native_dynamic_linking/src/math.h -- native_dynamic_linking/test/add_test.dart -- native_dynamic_linking/ffigen.yaml -- native_dynamic_linking/pubspec.yaml -- native_dynamic_linking/README.md diff --git a/pkgs/native_assets_builder/test_data/native_add/pubspec.yaml b/pkgs/native_assets_builder/test_data/native_add/pubspec.yaml index cfbd4ee50..73709b2e7 100644 --- a/pkgs/native_assets_builder/test_data/native_add/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/native_add/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/native_add_add_source/pubspec.yaml b/pkgs/native_assets_builder/test_data/native_add_add_source/pubspec.yaml index 5146e3c33..92f53fd02 100644 --- a/pkgs/native_assets_builder/test_data/native_add_add_source/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/native_add_add_source/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/build.dart b/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/build.dart index aab673ecc..faeeab1c6 100644 --- a/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/build.dart @@ -3,7 +3,8 @@ // BSD-style license that can be found in the LICENSE file. import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; void main(List arguments) async { @@ -18,18 +19,19 @@ void main(List arguments) async { ], ); // Temp output to prevent outputting the dylib for bundling. - final tempBuildOutput = BuildOutput(); + final outputBuilder = BuildOutputBuilder(); await cbuilder.run( config: config, - output: tempBuildOutput, + output: outputBuilder, logger: Logger('') ..level = Level.ALL ..onRecord.listen((record) { print('${record.level.name}: ${record.time}: ${record.message}'); }), ); - output.addEncodedAsset( - tempBuildOutput.encodedAssets.single, + final tempBuildOutput = BuildOutput(outputBuilder.json); + output.codeAssets.add( + tempBuildOutput.codeAssets.single, // Send dylib to linking if linking is enabled. linkInPackage: config.linkingEnabled ? packageName : null, ); diff --git a/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/link.dart b/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/link.dart index b69973d47..c2ca7d027 100644 --- a/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/native_add_duplicate/hook/link.dart @@ -2,11 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; void main(List args) async { await link(args, (config, output) async { // Simply output the dylib in the link hook. - output.codeAssets.addAll(config.codeAssets.all); + output.codeAssets.addAll(config.codeAssets); }); } diff --git a/pkgs/native_assets_builder/test_data/native_add_duplicate/pubspec.yaml b/pkgs/native_assets_builder/test_data/native_add_duplicate/pubspec.yaml index 3d23fbc22..2047c5dd6 100644 --- a/pkgs/native_assets_builder/test_data/native_add_duplicate/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/native_add_duplicate/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: logging: ^1.1.1 native_add: path: ../native_add/ - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart b/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart index 79b97a40e..ee718dfcb 100644 --- a/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart @@ -19,6 +19,7 @@ void main(List args) async { sources: [ 'src/debug.c', ], + buildMode: BuildMode.debug, ), CBuilder.library( name: 'math', @@ -26,9 +27,8 @@ void main(List args) async { sources: [ 'src/math.c', ], - // TODO(https://github.com/dart-lang/native/issues/190): Use specific - // API for linking once available. - flags: config.dynamicLinkingFlags('debug'), + libraries: ['debug'], + buildMode: BuildMode.debug, ), CBuilder.library( name: 'add', @@ -36,13 +36,12 @@ void main(List args) async { sources: [ 'src/add.c', ], - // TODO(https://github.com/dart-lang/native/issues/190): Use specific - // API for linking once available. - flags: config.dynamicLinkingFlags('math'), + libraries: ['math'], + buildMode: BuildMode.debug, ) ]; - // Note: This builders need to be run sequentially because they depend on + // Note: These builders need to be run sequentially because they depend on // each others output. for (final builder in builders) { await builder.run( @@ -53,21 +52,3 @@ void main(List args) async { } }); } - -extension on BuildConfig { - List dynamicLinkingFlags(String libraryName) => switch (targetOS) { - OS.macOS => [ - '-L${outputDirectory.toFilePath()}', - '-l$libraryName', - ], - OS.linux => [ - r'-Wl,-rpath=$ORIGIN', - '-L${outputDirectory.toFilePath()}', - '-l$libraryName', - ], - OS.windows => [ - outputDirectory.resolve('$libraryName.lib').toFilePath(), - ], - _ => throw UnimplementedError('Unsupported OS: $targetOS'), - }; -} diff --git a/pkgs/native_assets_builder/test_data/native_dynamic_linking/pubspec.yaml b/pkgs/native_assets_builder/test_data/native_dynamic_linking/pubspec.yaml index e4ce60564..2701e7e97 100644 --- a/pkgs/native_assets_builder/test_data/native_dynamic_linking/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/native_dynamic_linking/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/native_dynamic_linking/src/debug.c b/pkgs/native_assets_builder/test_data/native_dynamic_linking/src/debug.c index 92e42f1d2..b840d62a5 100644 --- a/pkgs/native_assets_builder/test_data/native_dynamic_linking/src/debug.c +++ b/pkgs/native_assets_builder/test_data/native_dynamic_linking/src/debug.c @@ -16,5 +16,7 @@ int debug_printf(const char* format, ...) { int ret = vprintf(format, args); va_end(args); return ret; +#else + return 0; #endif } diff --git a/pkgs/native_assets_builder/test_data/native_subtract/pubspec.yaml b/pkgs/native_assets_builder/test_data/native_subtract/pubspec.yaml index 7b55541b4..f5a250415 100644 --- a/pkgs/native_assets_builder/test_data/native_subtract/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/native_subtract/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/no_asset_for_link/hook/link.dart b/pkgs/native_assets_builder/test_data/no_asset_for_link/hook/link.dart index 6909bb089..150300fea 100644 --- a/pkgs/native_assets_builder/test_data/no_asset_for_link/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/no_asset_for_link/hook/link.dart @@ -2,10 +2,12 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List arguments) async { await link(arguments, (config, output) async { - output.addEncodedAssets(config.encodedAssets); + output.codeAssets.addAll(config.codeAssets); + output.dataAssets.addAll(config.dataAssets); }); } diff --git a/pkgs/native_assets_builder/test_data/no_asset_for_link/pubspec.yaml b/pkgs/native_assets_builder/test_data/no_asset_for_link/pubspec.yaml index d92b70e32..2f27e862d 100644 --- a/pkgs/native_assets_builder/test_data/no_asset_for_link/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/no_asset_for_link/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: logging: ^1.1.1 meta: ^1.12.0 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart b/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart index 10d8fcc10..148fb9b6b 100644 --- a/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart @@ -7,8 +7,7 @@ import 'package:native_assets_cli/native_assets_cli.dart'; void main(List args) async { - final buildConfig = BuildConfig(args); - if (!buildConfig.dryRun) { + await build(args, (buildConfig, _) async { final someValue = buildConfig.metadatum('package_with_metadata', 'some_key'); assert(someValue != null); @@ -18,7 +17,5 @@ void main(List args) async { 'some_int': someInt, 'some_key': someValue, }); - } else { - print('meta data not available in dry run'); - } + }); } diff --git a/pkgs/native_assets_builder/test_data/package_reading_metadata/pubspec.yaml b/pkgs/native_assets_builder/test_data/package_reading_metadata/pubspec.yaml index 2b804d89f..53837974b 100644 --- a/pkgs/native_assets_builder/test_data/package_reading_metadata/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/package_reading_metadata/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ package_with_metadata: diff --git a/pkgs/native_assets_builder/test_data/package_with_metadata/pubspec.yaml b/pkgs/native_assets_builder/test_data/package_with_metadata/pubspec.yaml index 6f45f62ce..826a31c47 100644 --- a/pkgs/native_assets_builder/test_data/package_with_metadata/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/package_with_metadata/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/simple_data_asset/hook/build.dart b/pkgs/native_assets_builder/test_data/simple_data_asset/hook/build.dart index e7aed2a3c..db164a614 100644 --- a/pkgs/native_assets_builder/test_data/simple_data_asset/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/simple_data_asset/hook/build.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await build( diff --git a/pkgs/native_assets_builder/test_data/simple_data_asset/pubspec.yaml b/pkgs/native_assets_builder/test_data/simple_data_asset/pubspec.yaml index 0e7baf732..f27247710 100644 --- a/pkgs/native_assets_builder/test_data/simple_data_asset/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/simple_data_asset/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/simple_link/hook/build.dart b/pkgs/native_assets_builder/test_data/simple_link/hook/build.dart index 0ac49c85c..5a508c4c0 100644 --- a/pkgs/native_assets_builder/test_data/simple_link/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/simple_link/hook/build.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await build(args, (config, output) async { diff --git a/pkgs/native_assets_builder/test_data/simple_link/hook/link.dart b/pkgs/native_assets_builder/test_data/simple_link/hook/link.dart index 9e4d9f2ee..413dbd6f6 100644 --- a/pkgs/native_assets_builder/test_data/simple_link/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/simple_link/hook/link.dart @@ -2,15 +2,15 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await link(args, (config, output) async { - shake(output, config.dataAssets.all); + shake(output, config.dataAssets); }); } -void shake(LinkOutput output, Iterable assets) { +void shake(LinkOutputBuilder output, Iterable assets) { for (final asset in assets.skip(2)) { output.dataAssets.add(asset); diff --git a/pkgs/native_assets_builder/test_data/simple_link/pubspec.yaml b/pkgs/native_assets_builder/test_data/simple_link/pubspec.yaml index 42efe06c5..dce6f41c1 100644 --- a/pkgs/native_assets_builder/test_data/simple_link/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/simple_link/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: cli_config: ^0.2.0 logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/transformer/hook/build.dart b/pkgs/native_assets_builder/test_data/transformer/hook/build.dart index 9f5956bed..53fba9533 100644 --- a/pkgs/native_assets_builder/test_data/transformer/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/transformer/hook/build.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; import 'package:transformer/src/transform.dart'; void main(List arguments) async { @@ -28,16 +28,14 @@ void main(List arguments) async { final targetFile = File.fromUri(config.outputDirectoryShared .resolve(sourceName.replaceFirst('data', 'data_transformed'))); - if (!config.dryRun) { - // TODO(dacoharkes): Timestamps are not enough for correct caching. - if (!await targetFile.exists() || - !(await sourceFile.lastModified()) - .isBefore(await targetFile.lastModified())) { - await transformFile(sourceFile, targetFile); - transformedFiles++; - } else { - cachedFiles++; - } + // TODO(dacoharkes): Timestamps are not enough for correct caching. + if (!await targetFile.exists() || + !(await sourceFile.lastModified()) + .isBefore(await targetFile.lastModified())) { + await transformFile(sourceFile, targetFile); + transformedFiles++; + } else { + cachedFiles++; } output.dataAssets.add( @@ -52,9 +50,7 @@ void main(List arguments) async { ); } - if (!config.dryRun) { - print('Transformed $transformedFiles files.'); - print('Reused $cachedFiles cached files.'); - } + print('Transformed $transformedFiles files.'); + print('Reused $cachedFiles cached files.'); }); } diff --git a/pkgs/native_assets_builder/test_data/transformer/pubspec.yaml b/pkgs/native_assets_builder/test_data/transformer/pubspec.yaml index 547239723..d2b933a81 100644 --- a/pkgs/native_assets_builder/test_data/transformer/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/transformer/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.7.3 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ diff --git a/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/build.dart b/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/build.dart index 46f6b1e23..e24b38a3a 100644 --- a/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/build.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; void main(List arguments) async { diff --git a/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/link.dart b/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/link.dart index 07c868d95..a3c4c9095 100644 --- a/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/link.dart +++ b/pkgs/native_assets_builder/test_data/treeshaking_native_libs/hook/link.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; void main(List arguments) async { @@ -12,9 +12,9 @@ void main(List arguments) async { (config, output) async { final linker = CLinker.library( name: config.packageName, - assetName: config.codeAssets.all.single.id.split('/').skip(1).join('/'), + assetName: config.codeAssets.single.id.split('/').skip(1).join('/'), linkerOptions: LinkerOptions.treeshake(symbols: ['add']), - sources: [config.codeAssets.all.single.file!.toFilePath()], + sources: [config.codeAssets.single.file!.toFilePath()], ); await linker.run( config: config, diff --git a/pkgs/native_assets_builder/test_data/treeshaking_native_libs/pubspec.yaml b/pkgs/native_assets_builder/test_data/treeshaking_native_libs/pubspec.yaml index 33a0ab5bb..078e71ec7 100644 --- a/pkgs/native_assets_builder/test_data/treeshaking_native_libs/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/treeshaking_native_libs/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output/hook/build.dart b/pkgs/native_assets_builder/test_data/wrong_build_output/hook/build.dart index cd8dac2c2..d1d26aeb1 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/wrong_build_output/hook/build.dart @@ -2,13 +2,18 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/src/args_parser.dart'; void main(List args) async { - final buildConfig = BuildConfigImpl.fromArguments(args); - await File.fromUri(buildConfig.outputFile).writeAsString(_wrongContents); + final configPath = getConfigArgument(args); + final buildConfig = BuildConfig( + json.decode(File(configPath).readAsStringSync()) as Map); + await File.fromUri(buildConfig.outputDirectory.resolve('build_output.json')) + .writeAsString(_wrongContents); } const _wrongContents = ''' diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output/pubspec.yaml b/pkgs/native_assets_builder/test_data/wrong_build_output/pubspec.yaml index f32c0f7a6..20f6dd921 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/wrong_build_output/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output_2/hook/build.dart b/pkgs/native_assets_builder/test_data/wrong_build_output_2/hook/build.dart index dfb5b5e20..9f8ff4ed8 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output_2/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/wrong_build_output_2/hook/build.dart @@ -2,13 +2,18 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/src/args_parser.dart'; void main(List args) async { - final buildConfig = BuildConfigImpl.fromArguments(args); - await File.fromUri(buildConfig.outputFile).writeAsString(_wrongContents); + final configPath = getConfigArgument(args); + final buildConfig = BuildConfig( + json.decode(File(configPath).readAsStringSync()) as Map); + await File.fromUri(buildConfig.outputDirectory.resolve('build_output.json')) + .writeAsString(_wrongContents); } const _wrongContents = ''' diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output_2/pubspec.yaml b/pkgs/native_assets_builder/test_data/wrong_build_output_2/pubspec.yaml index 56fa0ce8d..50baeefcd 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output_2/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/wrong_build_output_2/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart b/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart index cb50e5731..b53f9c872 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart @@ -2,20 +2,25 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/src/args_parser.dart'; void main(List args) async { - final buildConfig = BuildConfigImpl.fromArguments(args); - await File.fromUri(buildConfig.outputFile).writeAsString(_rightContents); + final configPath = getConfigArgument(args); + final buildConfig = BuildConfig( + json.decode(File(configPath).readAsStringSync()) as Map); + await File.fromUri(buildConfig.outputDirectory.resolve('build_output.json')) + .writeAsString(_rightContents); exit(1); } -const _rightContents = ''' -timestamp: 2023-07-28 14:22:45.000 -encodedAssets: [] -dependencies: [] -metadata: {} -version: 1.0.0 -'''; +const _rightContents = '''{ + "timestamp": "2023-07-28 14:22:45.000", + "encodedAssets": [], + "dependencies": [], + "metadata": {}, + "version": "1.6.0" +}'''; diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output_3/pubspec.yaml b/pkgs/native_assets_builder/test_data/wrong_build_output_3/pubspec.yaml index 3b844805d..e5b85a36c 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output_3/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/wrong_build_output_3/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/wrong_linker/hook/build.dart b/pkgs/native_assets_builder/test_data/wrong_linker/hook/build.dart index 8f3c9993c..e0d486071 100644 --- a/pkgs/native_assets_builder/test_data/wrong_linker/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/wrong_linker/hook/build.dart @@ -4,16 +4,15 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets.dart'; void main(List arguments) async { await build(arguments, (config, output) async { final assetUri = config.outputDirectory.resolve( OS.current.dylibFileName('foo'), ); - if (!config.dryRun) { - await File.fromUri(assetUri).writeAsBytes([1, 2, 3]); - } + + await File.fromUri(assetUri).writeAsBytes([1, 2, 3]); output.codeAssets.add( CodeAsset( @@ -28,14 +27,3 @@ void main(List arguments) async { ); }); } - -// Copy from `build`, but without the validation. -Future build( - List arguments, - Future Function(BuildConfig config, BuildOutput output) builder, -) async { - final config = BuildConfigImpl.fromArguments(arguments); - final output = HookOutputImpl(); - await builder(config, output); - await output.writeToFile(config: config); -} diff --git a/pkgs/native_assets_builder/test_data/wrong_linker/pubspec.yaml b/pkgs/native_assets_builder/test_data/wrong_linker/pubspec.yaml index 8e85aeaea..93e9220a3 100644 --- a/pkgs/native_assets_builder/test_data/wrong_linker/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/wrong_linker/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_builder/test_data/wrong_namespace_asset/hook/build.dart b/pkgs/native_assets_builder/test_data/wrong_namespace_asset/hook/build.dart index 66ad30529..f776f1aa1 100644 --- a/pkgs/native_assets_builder/test_data/wrong_namespace_asset/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/wrong_namespace_asset/hook/build.dart @@ -4,16 +4,15 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets.dart'; void main(List arguments) async { await build(arguments, (config, output) async { final assetUri = config.outputDirectory.resolve( OS.current.dylibFileName('foo'), ); - if (!config.dryRun) { - await File.fromUri(assetUri).writeAsBytes([1, 2, 3]); - } + + await File.fromUri(assetUri).writeAsBytes([1, 2, 3]); output.codeAssets.add( CodeAsset( @@ -27,14 +26,3 @@ void main(List arguments) async { ); }); } - -// Copy from `build`, but without the validation. -Future build( - List arguments, - Future Function(BuildConfig config, BuildOutput output) builder, -) async { - final config = BuildConfigImpl.fromArguments(arguments); - final output = HookOutputImpl(); - await builder(config, output); - await output.writeToFile(config: config); -} diff --git a/pkgs/native_assets_builder/test_data/wrong_namespace_asset/pubspec.yaml b/pkgs/native_assets_builder/test_data/wrong_namespace_asset/pubspec.yaml index 8e85aeaea..93e9220a3 100644 --- a/pkgs/native_assets_builder/test_data/wrong_namespace_asset/pubspec.yaml +++ b/pkgs/native_assets_builder/test_data/wrong_namespace_asset/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../native_assets_cli/ yaml: ^3.1.1 diff --git a/pkgs/native_assets_cli/CHANGELOG.md b/pkgs/native_assets_cli/CHANGELOG.md index 71aff12e5..4d01bed7a 100644 --- a/pkgs/native_assets_cli/CHANGELOG.md +++ b/pkgs/native_assets_cli/CHANGELOG.md @@ -1,4 +1,25 @@ -## 0.9.0-wip +## 0.10.0-wip + +- **Breaking change**: Rename `supportedAssetTypes` to `buildAssetTypes`. Hooks + should no longer fail. Instead, the code should fail at runtime if an asset is + missing. This enables (1) code to run if an asset is missing but that code is + not invoked at runtime, and (2) doing fallback implementations in Dart if an + asset is missing. +- **Breaking change** Move `BuildMode` to `package:native_toolchain_c`. This way + it can be controlled in the build hook together with the `OptimizationLevel`. + Most likely, every package should ship with `release`. `BuildMode.debug` + should only be used while developing the package locally. +- **Breaking change** Move `HookConfig.targetOS` to `CodeConfig`. `DataAsset`s + and other asset types might now support varying on the target OS. +- **Breaking change**: Change the behavior of `testBuildHook` and + `testCodeBuildHook`; instead of defining tests, these methods should now be + called from within tests. +- Move the `package:test` dependency from a regular dependency (exported to + calling packages) to a dev_dependency. +- Update pubspec.yaml of examples to use 0.9.0 of `package:native_assets_cli`. +- Consolidate [CodeAsset] specific things into `lib/src/code_assets/*` + +## 0.9.0 - Add `BuildConfig` and `LinkConfig` `outputDirectoryShared`. - Remove `package:native_assets_cli/locking.dart` with `runUnderDirectoryLock`. @@ -23,6 +44,8 @@ - **Breaking change** Removed `Asset` class, removed `{Build,Link}Output.assets*`. Hook writers should now use e.g. `output.dataAssets.add(DataAsset(...))` instead of `output.addAsset(DataAsset(...))`. +- **Breaking change** Introduce builder classes that construct hook configs and + hook outputs. ## 0.8.0 diff --git a/pkgs/native_assets_cli/example/build/local_asset/hook/build.dart b/pkgs/native_assets_cli/example/build/local_asset/hook/build.dart index 280945122..9547ac51b 100644 --- a/pkgs/native_assets_cli/example/build/local_asset/hook/build.dart +++ b/pkgs/native_assets_cli/example/build/local_asset/hook/build.dart @@ -4,14 +4,14 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; const assetName = 'asset.txt'; final packageAssetPath = Uri.file('assets/$assetName'); Future main(List args) async { await build(args, (config, output) async { - if (config.linkModePreference == LinkModePreference.static) { + if (config.codeConfig.linkModePreference == LinkModePreference.static) { // Simulate that this build hook only supports dynamic libraries. throw UnsupportedError( 'LinkModePreference.static is not supported.', @@ -21,6 +21,7 @@ Future main(List args) async { final packageName = config.packageName; final assetPath = config.outputDirectory.resolve(assetName); final assetSourcePath = config.packageRoot.resolveUri(packageAssetPath); + // ignore: deprecated_member_use if (!config.dryRun) { // Insert code that downloads or builds the asset to `assetPath`. await File.fromUri(assetSourcePath).copy(assetPath.toFilePath()); @@ -37,8 +38,10 @@ Future main(List args) async { name: 'asset.txt', file: assetPath, linkMode: DynamicLoadingBundled(), - os: config.targetOS, - architecture: config.targetArchitecture, + os: config.codeConfig.targetOS, + architecture: + // ignore: deprecated_member_use + config.dryRun ? null : config.codeConfig.targetArchitecture, ), ); }); diff --git a/pkgs/native_assets_cli/example/build/local_asset/pubspec.yaml b/pkgs/native_assets_cli/example/build/local_asset/pubspec.yaml index c8e0294fe..743a4f9db 100644 --- a/pkgs/native_assets_cli/example/build/local_asset/pubspec.yaml +++ b/pkgs/native_assets_cli/example/build/local_asset/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../../native_assets_cli/ diff --git a/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart b/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart index eda5bcd25..7b8ad34d6 100644 --- a/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart +++ b/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart @@ -2,23 +2,23 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:native_assets_cli/test.dart'; +import 'package:native_assets_cli/code_assets_testing.dart'; import 'package:test/test.dart'; import '../hook/build.dart' as build; -void main() { - testBuildHook( - description: 'test my build hook', - mainMethod: build.main, - check: (_, output) { - expect(output.codeAssets.all, isNotEmpty); - expect( - output.codeAssets.all.first.id, - 'package:local_asset/asset.txt', - ); - }, - supportedAssetTypes: [CodeAsset.type], - ); +void main() async { + test('test my build hook', () async { + await testCodeBuildHook( + mainMethod: build.main, + check: (_, output) { + expect(output.codeAssets, isNotEmpty); + expect( + output.codeAssets.first.id, + 'package:local_asset/asset.txt', + ); + }, + buildAssetTypes: [CodeAsset.type], + ); + }); } diff --git a/pkgs/native_assets_cli/example/build/native_add_library/pubspec.yaml b/pkgs/native_assets_cli/example/build/native_add_library/pubspec.yaml index 028679dcf..45437091d 100644 --- a/pkgs/native_assets_cli/example/build/native_add_library/pubspec.yaml +++ b/pkgs/native_assets_cli/example/build/native_add_library/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_cli/example/build/native_dynamic_linking/hook/build.dart b/pkgs/native_assets_cli/example/build/native_dynamic_linking/hook/build.dart index 88b3d2d12..0713eab62 100644 --- a/pkgs/native_assets_cli/example/build/native_dynamic_linking/hook/build.dart +++ b/pkgs/native_assets_cli/example/build/native_dynamic_linking/hook/build.dart @@ -26,9 +26,7 @@ void main(List args) async { sources: [ 'src/math.c', ], - // TODO(https://github.com/dart-lang/native/issues/190): Use specific - // API for linking once available. - flags: config.dynamicLinkingFlags('debug'), + libraries: ['debug'], ), CBuilder.library( name: 'add', @@ -36,13 +34,11 @@ void main(List args) async { sources: [ 'src/add.c', ], - // TODO(https://github.com/dart-lang/native/issues/190): Use specific - // API for linking once available. - flags: config.dynamicLinkingFlags('math'), + libraries: ['math'], ) ]; - // Note: This builders need to be run sequentially because they depend on + // Note: These builders need to be run sequentially because they depend on // each others output. for (final builder in builders) { await builder.run( @@ -53,20 +49,3 @@ void main(List args) async { } }); } - -extension on BuildConfig { - List dynamicLinkingFlags(String libraryName) => switch (targetOS) { - OS.macOS => [ - '-L${outputDirectory.toFilePath()}', - '-l$libraryName', - ], - OS.linux => [ - '-Wl,-rpath=\$ORIGIN/.', - '-L${outputDirectory.toFilePath()}', - '-l$libraryName', - ], - // TODO(https://github.com/dart-lang/native/issues/1415): Enable support - // for Windows once linker flags are supported by CBuilder. - _ => throw UnimplementedError('Unsupported OS: $targetOS'), - }; -} diff --git a/pkgs/native_assets_cli/example/build/native_dynamic_linking/pubspec.yaml b/pkgs/native_assets_cli/example/build/native_dynamic_linking/pubspec.yaml index eb41ecda8..8dc525d8b 100644 --- a/pkgs/native_assets_cli/example/build/native_dynamic_linking/pubspec.yaml +++ b/pkgs/native_assets_cli/example/build/native_dynamic_linking/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_cli/example/build/native_dynamic_linking/src/debug.c b/pkgs/native_assets_cli/example/build/native_dynamic_linking/src/debug.c index 92e42f1d2..b840d62a5 100644 --- a/pkgs/native_assets_cli/example/build/native_dynamic_linking/src/debug.c +++ b/pkgs/native_assets_cli/example/build/native_dynamic_linking/src/debug.c @@ -16,5 +16,7 @@ int debug_printf(const char* format, ...) { int ret = vprintf(format, args); va_end(args); return ret; +#else + return 0; #endif } diff --git a/pkgs/native_assets_cli/example/build/use_dart_api/pubspec.yaml b/pkgs/native_assets_cli/example/build/use_dart_api/pubspec.yaml index 0e4a736dc..c3b6df79f 100644 --- a/pkgs/native_assets_cli/example/build/use_dart_api/pubspec.yaml +++ b/pkgs/native_assets_cli/example/build/use_dart_api/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: logging: ^1.1.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../../native_assets_cli/ # native_toolchain_c: ^0.5.4 diff --git a/pkgs/native_assets_cli/example/link/package_with_assets/hook/build.dart b/pkgs/native_assets_cli/example/link/package_with_assets/hook/build.dart index 0ac49c85c..5a508c4c0 100644 --- a/pkgs/native_assets_cli/example/link/package_with_assets/hook/build.dart +++ b/pkgs/native_assets_cli/example/link/package_with_assets/hook/build.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; void main(List args) async { await build(args, (config, output) async { diff --git a/pkgs/native_assets_cli/example/link/package_with_assets/hook/link.dart b/pkgs/native_assets_cli/example/link/package_with_assets/hook/link.dart index d77ea69bc..403d0f15b 100644 --- a/pkgs/native_assets_cli/example/link/package_with_assets/hook/link.dart +++ b/pkgs/native_assets_cli/example/link/package_with_assets/hook/link.dart @@ -5,7 +5,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/data_assets.dart'; import 'package:record_use/record_use.dart'; const multiplyIdentifier = Identifier( @@ -20,7 +20,7 @@ void main(List args) async { final usedAssets = (usages.instancesOf(multiplyIdentifier) ?? []).map((e) => (e.instanceConstant.fields.values.first as StringConstant).value); - output.dataAssets.addAll(config.dataAssets.all + output.dataAssets.addAll(config.dataAssets .where((dataAsset) => usedAssets.contains(dataAsset.name))); }); } diff --git a/pkgs/native_assets_cli/example/link/package_with_assets/pubspec.yaml b/pkgs/native_assets_cli/example/link/package_with_assets/pubspec.yaml index 0fa10dd1b..81b4d4819 100644 --- a/pkgs/native_assets_cli/example/link/package_with_assets/pubspec.yaml +++ b/pkgs/native_assets_cli/example/link/package_with_assets/pubspec.yaml @@ -11,7 +11,7 @@ environment: dependencies: logging: ^1.1.1 meta: ^1.12.0 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../../../../native_assets_cli/ record_use: ^0.3.0 diff --git a/pkgs/native_assets_cli/lib/code_assets.dart b/pkgs/native_assets_cli/lib/code_assets.dart new file mode 100644 index 000000000..82c32b6d5 --- /dev/null +++ b/pkgs/native_assets_cli/lib/code_assets.dart @@ -0,0 +1,35 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Code asset support for hook authors. +library; + +export 'native_assets_cli.dart' + hide + EncodedAsset, + EncodedAssetBuildOutputBuilder, + EncodedAssetLinkOutputBuilder; +export 'src/code_assets/architecture.dart' show Architecture; +export 'src/code_assets/c_compiler_config.dart' show CCompilerConfig; +export 'src/code_assets/code_asset.dart' show CodeAsset, OSLibraryNaming; +export 'src/code_assets/config.dart' + show + CodeAssetBuildConfig, + CodeAssetBuildOutputBuilder, + CodeAssetBuildOutputBuilderAdd, + CodeAssetLinkConfig, + CodeAssetLinkOutputBuilder, + CodeAssetLinkOutputBuilderAdd, + CodeConfig; +export 'src/code_assets/ios_sdk.dart' show IOSSdk; +export 'src/code_assets/link_mode.dart' + show + DynamicLoadingBundled, + DynamicLoadingSystem, + LinkMode, + LookupInExecutable, + LookupInProcess, + StaticLinking; +export 'src/code_assets/link_mode_preference.dart' show LinkModePreference; +export 'src/code_assets/os.dart' show OS; diff --git a/pkgs/native_assets_cli/lib/code_assets_builder.dart b/pkgs/native_assets_cli/lib/code_assets_builder.dart new file mode 100644 index 000000000..38c5fe668 --- /dev/null +++ b/pkgs/native_assets_cli/lib/code_assets_builder.dart @@ -0,0 +1,19 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Code asset support for hook invokers (e.g. building / bundling tools). +library; + +export 'code_assets.dart' hide build, link; +export 'native_assets_cli_builder.dart' + hide EncodedAssetBuildOutputBuilder, EncodedAssetLinkOutputBuilder; +export 'src/code_assets/config.dart' + show CodeAssetBuildConfigBuilder, CodeAssetBuildOutput, CodeAssetLinkOutput; +export 'src/code_assets/validation.dart' + show + validateCodeAssetBuildConfig, + validateCodeAssetBuildOutput, + validateCodeAssetInApplication, + validateCodeAssetLinkConfig, + validateCodeAssetLinkOutput; diff --git a/pkgs/native_assets_cli/lib/code_assets_testing.dart b/pkgs/native_assets_cli/lib/code_assets_testing.dart new file mode 100644 index 000000000..148e875d2 --- /dev/null +++ b/pkgs/native_assets_cli/lib/code_assets_testing.dart @@ -0,0 +1,6 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'code_assets_builder.dart'; +export 'src/code_assets/testing.dart' show testCodeBuildHook; diff --git a/pkgs/native_assets_cli/lib/data_assets.dart b/pkgs/native_assets_cli/lib/data_assets.dart new file mode 100644 index 000000000..a2abce48b --- /dev/null +++ b/pkgs/native_assets_cli/lib/data_assets.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Data asset support for hook authors. +library; + +export 'native_assets_cli.dart' + hide + EncodedAsset, + EncodedAssetBuildOutputBuilder, + EncodedAssetLinkOutputBuilder; +export 'src/data_assets/config.dart' + show + DataAssetBuildOutputBuilder, + DataAssetBuildOutputBuilderAdd, + DataAssetLinkConfig, + DataAssetLinkOutputBuilder, + DataAssetLinkOutputBuilderAdd; +export 'src/data_assets/data_asset.dart' show DataAsset; diff --git a/pkgs/native_assets_cli/lib/data_assets_builder.dart b/pkgs/native_assets_cli/lib/data_assets_builder.dart new file mode 100644 index 000000000..fe9d43a79 --- /dev/null +++ b/pkgs/native_assets_cli/lib/data_assets_builder.dart @@ -0,0 +1,18 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Data asset support for hook invokers (e.g. building / bundling tools). +library; + +export 'data_assets.dart' hide build, link; +export 'native_assets_cli_builder.dart' + hide EncodedAssetBuildOutputBuilder, EncodedAssetLinkOutputBuilder; +export 'src/data_assets/config.dart' + show DataAssetBuildOutput, DataAssetLinkOutput; +export 'src/data_assets/validation.dart' + show + validateDataAssetBuildConfig, + validateDataAssetBuildOutput, + validateDataAssetLinkConfig, + validateDataAssetLinkOutput; diff --git a/pkgs/native_assets_cli/lib/native_assets_cli.dart b/pkgs/native_assets_cli/lib/native_assets_cli.dart index 8bac2546a..be4d880a3 100644 --- a/pkgs/native_assets_cli/lib/native_assets_cli.dart +++ b/pkgs/native_assets_cli/lib/native_assets_cli.dart @@ -4,47 +4,20 @@ /// A library that contains the argument and file formats for implementing a /// build hook (`hook/build.dart`). -library native_assets_cli; +library; export 'src/api/build.dart' show build; -export 'src/api/build_config.dart' show BuildConfig; -export 'src/api/build_output.dart' show BuildOutput, LinkOutput; export 'src/api/builder.dart' show Builder; -export 'src/api/hook_config.dart' show HookConfig; export 'src/api/link.dart' show link; -export 'src/api/link_config.dart' show LinkConfig; export 'src/api/linker.dart' show Linker; -export 'src/architecture.dart' show Architecture; -export 'src/build_mode.dart' show BuildMode; -export 'src/c_compiler_config.dart' show CCompilerConfig; -export 'src/code_assets/code_asset.dart' +export 'src/config.dart' show - BuildOutputCodeAssets, - CodeAsset, - CodeAssetsBuildOutput, - CodeAssetsLinkConfig, - CodeAssetsLinkOutput, - LinkConfigCodeAssets, - LinkOutputCodeAssets, - OSLibraryNaming; -export 'src/data_assets/data_asset.dart' - show - BuildOutputDataAssets, - DataAsset, - DataAssetsBuildOutput, - DataAssetsLinkConfig, - DataAssetsLinkOutput, - LinkConfigDataAssets, - LinkOutputDataAssets; + BuildConfig, + BuildOutputBuilder, + EncodedAssetBuildOutputBuilder, + EncodedAssetLinkOutputBuilder, + HookConfig, + LinkConfig, + LinkOutputBuilder; export 'src/encoded_asset.dart' show EncodedAsset; -export 'src/ios_sdk.dart' show IOSSdk; -export 'src/link_mode.dart' - show - DynamicLoadingBundled, - DynamicLoadingSystem, - LinkMode, - LookupInExecutable, - LookupInProcess, - StaticLinking; -export 'src/link_mode_preference.dart' show LinkModePreference; -export 'src/os.dart' show OS; +export 'src/metadata.dart'; diff --git a/pkgs/native_assets_cli/lib/native_assets_cli_builder.dart b/pkgs/native_assets_cli/lib/native_assets_cli_builder.dart new file mode 100644 index 000000000..2d164ecd8 --- /dev/null +++ b/pkgs/native_assets_cli/lib/native_assets_cli_builder.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Support for hook invokers (e.g. building / bundling tools). +library; + +export 'native_assets_cli.dart' hide build, link; +export 'src/config.dart' + show + BuildConfigBuilder, + BuildOutput, + HookConfigBuilder, + HookOutput, + LinkConfigBuilder, + LinkOutput; +export 'src/model/dependencies.dart'; +export 'src/model/resource_identifiers.dart'; +export 'src/target.dart' show Target; +export 'src/validation.dart' + show + ValidationErrors, + validateBuildConfig, + validateBuildOutput, + validateLinkConfig, + validateLinkOutput; diff --git a/pkgs/native_assets_cli/lib/native_assets_cli_internal.dart b/pkgs/native_assets_cli/lib/native_assets_cli_internal.dart index 173e9086e..55acd5848 100644 --- a/pkgs/native_assets_cli/lib/native_assets_cli_internal.dart +++ b/pkgs/native_assets_cli/lib/native_assets_cli_internal.dart @@ -2,37 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -/// Internal API for invoking build hooks. -/// -/// This library is intended for use by: -/// * `package:native_assets_builder`, -/// * `dartdev` (in the Dart SDK), and, -/// * `flutter_tools` (in the Flutter SDK). -/// -/// > [!CAUTION] -/// > Unless you are building a custom SDK that embeds Dart you should -/// > not be importing this library! -/// -/// @nodoc -library native_assets_cli_internal; +/// Support for hook invokers (e.g. building / bundling tools). +library; -export 'native_assets_cli.dart' hide build, link; -export 'src/api/build_config.dart' show BuildConfigImpl; -export 'src/api/build_output.dart' show HookOutputImpl; -export 'src/api/hook_config.dart' show HookConfigImpl; -export 'src/api/link_config.dart' show LinkConfigImpl; -export 'src/code_assets/validation.dart' - show - validateCodeAssetBuildOutput, - validateCodeAssetLinkOutput, - validateCodeAssetsInApplication; -export 'src/data_assets/validation.dart' - show validateDataAssetBuildOutput, validateDataAssetLinkOutput; -export 'src/encoded_asset.dart' show EncodedAsset; -export 'src/model/dependencies.dart'; +export 'native_assets_cli_builder.dart'; export 'src/model/hook.dart'; -export 'src/model/metadata.dart'; -export 'src/model/resource_identifiers.dart'; -export 'src/model/target.dart' show Target; -export 'src/validation.dart' - show ValidationErrors, validateBuildOutput, validateLinkOutput; diff --git a/pkgs/native_assets_cli/lib/src/api/build.dart b/pkgs/native_assets_cli/lib/src/api/build.dart index b1a0eae93..cd7cc063f 100644 --- a/pkgs/native_assets_cli/lib/src/api/build.dart +++ b/pkgs/native_assets_cli/lib/src/api/build.dart @@ -2,12 +2,17 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; +import 'dart:io'; + +import '../args_parser.dart'; +import '../config.dart'; import '../validation.dart'; -import 'build_config.dart'; -import 'build_output.dart'; /// Runs a native assets build. /// +/// Meant to be used in build hooks (`hook/build.dart`). +/// /// Can build native assets which are not already available, or expose existing /// files. Each individual asset is assigned a unique asset ID. /// @@ -29,8 +34,8 @@ import 'build_output.dart'; /// ], /// ); /// await cbuilder.run( -/// buildConfig: config, -/// buildOutput: output, +/// config: config, +/// output: output, /// logger: Logger('') /// ..level = Level.ALL /// ..onRecord.listen((record) => print(record.message)), @@ -44,14 +49,14 @@ import 'build_output.dart'; /// ```dart /// import 'dart:io'; /// -/// import 'package:native_assets_cli/native_assets_cli.dart'; +/// import 'package:native_assets_cli/code_assets.dart'; /// /// const assetName = 'asset.txt'; /// final packageAssetPath = Uri.file('data/$assetName'); /// /// void main(List args) async { /// await build(args, (config, output) async { -/// if (config.linkModePreference == LinkModePreference.static) { +/// if (config.codeConfig.linkModePreference == LinkModePreference.static) { /// // Simulate that this hook only supports dynamic libraries. /// throw UnsupportedError( /// 'LinkModePreference.static is not supported.', @@ -77,23 +82,36 @@ import 'build_output.dart'; /// name: 'asset.txt', /// file: assetPath, /// linkMode: DynamicLoadingBundled(), -/// os: config.targetOS, -/// architecture: config.targetArchitecture, +/// os: config.codeConfig.targetOS, +/// architecture: config.codeConfig.targetArchitecture, /// ), /// ); /// }); /// } /// ``` +/// +/// If the [builder] fails, it must `throw`. Build hooks are guaranteed to be +/// invoked with a process invocation and should return a non-zero exit code on +/// failure. Throwing will lead to an uncaught exception, causing a non-zero +/// exit code. Future build( List arguments, - Future Function(BuildConfig config, BuildOutput output) builder, + Future Function(BuildConfig config, BuildOutputBuilder output) builder, ) async { - final config = BuildConfigImpl.fromArguments(arguments); - final output = HookOutputImpl(); + final configPath = getConfigArgument(arguments); + final bytes = File(configPath).readAsBytesSync(); + final jsonConfig = const Utf8Decoder() + .fuse(const JsonDecoder()) + .convert(bytes) as Map; + final config = BuildConfig(jsonConfig); + final output = BuildOutputBuilder(); await builder(config, output); - final errors = await validateBuildOutput(config, output); + final errors = await validateBuildOutput(config, BuildOutput(output.json)); if (errors.isEmpty) { - await output.writeToFile(config: config); + final jsonOutput = + const JsonEncoder().fuse(const Utf8Encoder()).convert(output.json); + await File.fromUri(config.outputDirectory.resolve('build_output.json')) + .writeAsBytes(jsonOutput); } else { final message = [ 'The output contained unsupported output:', diff --git a/pkgs/native_assets_cli/lib/src/api/build_config.dart b/pkgs/native_assets_cli/lib/src/api/build_config.dart deleted file mode 100644 index 08c03389e..000000000 --- a/pkgs/native_assets_cli/lib/src/api/build_config.dart +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:convert'; -import 'dart:io'; - -import 'package:collection/collection.dart'; -import 'package:pub_semver/pub_semver.dart'; - -import '../architecture.dart'; -import '../args_parser.dart'; -import '../build_mode.dart'; -import '../c_compiler_config.dart'; -import '../ios_sdk.dart'; -import '../json_utils.dart'; -import '../link_mode_preference.dart'; -import '../model/hook.dart'; -import '../model/metadata.dart'; -import '../os.dart'; -import '../utils/json.dart'; -import '../utils/map.dart'; -import 'build.dart'; -import 'build_output.dart'; -import 'deprecation_messages.dart'; -import 'hook_config.dart'; - -part '../model/build_config.dart'; - -/// The configuration for a build hook (`hook/build.dart`) invocation. -/// -/// A package can optionally provide build hook. If such a hook exists, it will -/// be automatically run, by the Flutter and Dart SDK tools. The hook will be -/// run with specific commandline arguments, which [BuildConfig] can parse and -/// provide more convenient access to. -abstract final class BuildConfig implements HookConfig { - /// Metadata from a direct dependency. - /// - /// The [packageName] of is the package name of the direct dependency. - /// - /// Returns `null` if metadata was not provided. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - @Deprecated(metadataDeprecation) - Object? metadatum(String packageName, String key); - - /// Whether link hooks will be run after the build hooks. - /// - /// If [linkingEnabled] is true, [BuildOutput.addEncodedAsset] may be called - /// with the`linkInPackage` parameter so that assets can be linked in a link - /// hook. - /// Linking is enabled in Flutter release builds and Dart AOT configurations. - /// These configurations are optimized for app size. - /// - `flutter build` - /// - `flutter run --release` - /// - `dart build` - /// - /// If [linkingEnabled] is false, no assets should be added with the - /// `linkInPackage` parameter set. All assets must be ready for bundling. - /// Linking is disabled in Flutter debug builds and Dart JIT configurations. - /// These configurations are optimized for development speed. - /// - `dart run` - /// - `flutter run` (debug mode) - bool get linkingEnabled; - - /// The version of [BuildConfig]. - /// - /// The build config is used in the protocol between the Dart and Flutter SDKs - /// and packages through build hook invocations. - /// - /// We're trying to avoid breaking changes. However, in the case that we have - /// to, the major version mismatch between the Dart or Flutter SDK and build - /// hook (`hook/build.dart`) will lead to a nice error message. - static Version get latestVersion => HookConfigImpl.latestVersion; - - /// Constructs a config by parsing CLI arguments and loading the config file. - /// - /// Build hooks will most likely use [build] instead of this constructor. - /// - /// The [arguments] must be commandline arguments. - /// - /// If provided, [environment] must be a map containing environment variables. - /// If not provided, [environment] defaults to [Platform.environment]. - /// - /// If provided, [workingDirectory] is used to resolves paths inside - /// [environment]. If not provided, [workingDirectory] defaults to - /// [Directory.current]. - /// - /// This async constructor is intended to be used directly in CLI files. - factory BuildConfig( - List arguments, { - Map? environment, - Uri? workingDirectory, - }) => - BuildConfigImpl.fromArguments( - arguments, - environment: environment, - workingDirectory: workingDirectory, - ); - - /// Constructs a config for a non-dry run by providing values for each field. - /// - /// Build hooks will most likely use [build] instead of this constructor. - /// However, for unit testing code which consumes a [BuildConfig], this - /// constructor facilitates easy construction. - /// - /// For the documentation of the parameters, see the equally named fields. - /// - /// Parameter [dependencyMetadata] must be a nested map `{'packageName' : - /// {'key' : 'value'}}` where `packageName` and `key` correspond to the - // ignore: deprecated_member_use_from_same_package - /// parameters in [metadatum]. - factory BuildConfig.build({ - required Uri outputDirectory, - required Uri outputDirectoryShared, - required String packageName, - required Uri packageRoot, - required BuildMode buildMode, - required Architecture targetArchitecture, - required OS targetOS, - IOSSdk? targetIOSSdk, - int? targetIOSVersion, - int? targetMacOSVersion, - int? targetAndroidNdkApi, - CCompilerConfig? cCompiler, - required LinkModePreference linkModePreference, - @Deprecated(metadataDeprecation) - Map>? dependencyMetadata, - required Iterable supportedAssetTypes, - required bool linkingEnabled, - }) => - BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRoot, - buildMode: buildMode, - targetArchitecture: targetArchitecture, - targetOS: targetOS, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - targetAndroidNdkApi: targetAndroidNdkApi, - cCompiler: cCompiler, - linkModePreference: linkModePreference, - dependencyMetadata: dependencyMetadata != null - ? { - for (final entry in dependencyMetadata.entries) - entry.key: Metadata(entry.value.cast()) - } - : null, - linkingEnabled: linkingEnabled, - supportedAssetTypes: supportedAssetTypes, - ); - - /// Constructs a config for a dry run by providing values for each field. - /// - /// Build hooks will most likely use [build] instead of this constructor. - /// However, for unit testing code which consumes a [BuildConfig], this - /// constructor facilitates easy construction. - /// - /// For the documentation of the parameters, see the equally named fields. - factory BuildConfig.dryRun({ - required Uri outputDirectory, - required Uri outputDirectoryShared, - required String packageName, - required Uri packageRoot, - required OS targetOS, - required LinkModePreference linkModePreference, - required bool linkingEnabled, - required Iterable supportedAssetTypes, - }) => - BuildConfigImpl.dryRun( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRoot, - targetOS: targetOS, - linkModePreference: linkModePreference, - supportedAssetTypes: supportedAssetTypes, - linkingEnabled: linkingEnabled, - ); -} diff --git a/pkgs/native_assets_cli/lib/src/api/build_output.dart b/pkgs/native_assets_cli/lib/src/api/build_output.dart deleted file mode 100644 index a435bf066..000000000 --- a/pkgs/native_assets_cli/lib/src/api/build_output.dart +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:convert'; -import 'dart:io'; - -import 'package:collection/collection.dart'; -import 'package:pub_semver/pub_semver.dart'; - -import '../architecture.dart'; -import '../encoded_asset.dart'; -import '../json_utils.dart'; -import '../model/dependencies.dart'; -import '../model/metadata.dart'; -import '../os.dart'; -import '../utils/datetime.dart'; -import '../utils/file.dart'; -import '../utils/json.dart'; -import '../utils/map.dart'; -import 'build.dart'; -import 'build_config.dart'; -import 'builder.dart'; -import 'deprecation_messages.dart'; -import 'hook_config.dart'; -import 'link.dart'; -import 'linker.dart'; - -part '../model/hook_output.dart'; -part 'link_output.dart'; - -/// The output of a build hook (`hook/build.dart`) invocation. -/// -/// A package can optionally provide build hook (`hook/build.dart`). If such a -/// hook exists, it will be automatically run, by the Flutter and Dart SDK -/// tools. The hook is expect to produce a specific output which [BuildOutput] -/// can produce. -/// -/// For more information see [build]. -/// -/// Designed to be a sink. The [BuildOutput] is not intended to be read from. -/// [Builder]s stream outputs to the build output. For more info see [Builder]. -abstract final class BuildOutput { - /// Start time for the build of this output. - /// - /// The [timestamp] is rounded down to whole seconds, because - /// [File.lastModified] is rounded to whole seconds and caching logic compares - /// these timestamps. - DateTime get timestamp; - - /// The assets produced by this build. - /// - /// In dry runs, the assets for all [Architecture]s for the [OS] specified in - /// the dry run must be provided. - Iterable get encodedAssets; - - /// The assets produced by this build which should be linked. - /// - /// Every key in the map is a package name. These assets in the values are not - /// bundled with the application, but are sent to the link hook of the package - /// specified in the key, which can decide if they are bundled or not. - /// - /// In dry runs, the assets for all [Architecture]s for the [OS] specified in - /// the dry run must be provided. - Map> get encodedAssetsForLinking; - - /// The files used by this build. - /// - /// If any of the files in [dependencies] are modified after [timestamp], the - /// build will be re-run. - /// - /// The (transitive) Dart sources do not have to be added to these - /// dependencies, only non-Dart files. (Note that old Dart and Flutter SDKs - /// do not automatically add the Dart sources. So builds get wrongly cached, - /// try updating to the latest release.) - Iterable get dependencies; - - /// Create a build output. - /// - /// The [timestamp] must be before any [dependencies] are read by the build - /// this output belongs to. If the [BuildOutput] object is created at the - /// beginning of the build hook, [timestamp] can be omitted and will default - /// to [DateTime.now]. The [timestamp] is rounded down to whole seconds, - /// because [File.lastModified] is rounded to whole seconds and caching logic - /// compares these timestamps. - /// - /// The [EncodedAsset]s produced by this build or dry-run can be provided to - /// the constructor as [encodedAssets], or can be added later using - /// [addEncodedAsset] and [addEncodedAssets]. - /// - /// The files used by this build must be provided to the constructor as - /// [dependencies], or can be added later with [addDependency] and - /// [addDependencies]. If any of these files are modified after [timestamp], - /// the build will be re-run. Typically these dependencies contain the build - /// hook itself, and the source files used in the build. - /// - /// Metadata can be passed to build hook invocations of dependent packages. It - /// must be provided to the constructor as [metadata], or added later with - // ignore: deprecated_member_use_from_same_package - /// [addMetadatum] and [addMetadata]. - factory BuildOutput({ - DateTime? timestamp, - Iterable? encodedAssets, - Iterable? dependencies, - @Deprecated(metadataDeprecation) Map? metadata, - }) => - HookOutputImpl( - timestamp: timestamp, - encodedAssets: encodedAssets?.toList(), - dependencies: Dependencies([...?dependencies]), - metadata: Metadata({...?metadata}), - ); - - /// Adds [EncodedAsset]s produced by this build or dry run. - /// - /// If the [linkInPackage] argument is specified, the asset will not be - /// bundled during the build step, but sent as input to the link hook of the - /// specified package, where it can be further processed and possibly bundled. - /// - /// Note to hook writers. Prefer using the `.add` method on the extension for - /// the specific asset type being added: - /// - /// ```dart - /// main(List arguments) async { - /// await build((config, output) { - /// output.codeAssets.add(CodeAsset(...)); - /// output.dataAssets.add(DataAsset(...)); - /// }); - /// } - /// ``` - void addEncodedAsset(EncodedAsset asset, {String? linkInPackage}); - - /// Adds [EncodedAsset]s produced by this build or dry run. - /// - /// If the [linkInPackage] argument is specified, the assets will not be - /// bundled during the build step, but sent as input to the link hook of the - /// specified package, where they can be further processed and possibly - /// bundled. - /// - /// Note to hook writers. Prefer using the `.addAll` method on the extension - /// for the specific asset type being added: - /// - /// ```dart - /// main(List arguments) async { - /// await build((config, output) { - /// output.codeAssets.addAll([CodeAsset(...), ...]); - /// output.dataAssets.addAll([DataAsset(...), ...]); - /// }); - /// } - /// ``` - void addEncodedAssets(Iterable assets, {String? linkInPackage}); - - /// Adds file used by this build. - /// - /// If any of the files are modified after [timestamp], the build will be - /// re-run. - void addDependency(Uri dependency); - - /// Adds files used by this build. - /// - /// If any of the files are modified after [timestamp], the build will be - /// re-run. - void addDependencies(Iterable dependencies); - - /// Adds metadata to be passed to build hook invocations of dependent - /// packages. - @Deprecated(metadataDeprecation) - void addMetadatum(String key, Object value); - - /// Adds metadata to be passed to build hook invocations of dependent - /// packages. - @Deprecated(metadataDeprecation) - void addMetadata(Map metadata); - - /// The version of [BuildOutput]. - /// - /// The build output is used in the protocol between the Dart and Flutter SDKs - /// and packages through build hook invocations. - static Version get latestVersion => HookOutputImpl.latestVersion; -} diff --git a/pkgs/native_assets_cli/lib/src/api/builder.dart b/pkgs/native_assets_cli/lib/src/api/builder.dart index 99d21c716..40c543c4d 100644 --- a/pkgs/native_assets_cli/lib/src/api/builder.dart +++ b/pkgs/native_assets_cli/lib/src/api/builder.dart @@ -4,8 +4,7 @@ import 'package:logging/logging.dart'; -import 'build_config.dart'; -import 'build_output.dart'; +import '../config.dart'; import 'linker.dart'; /// A builder to be run during a build hook. @@ -48,22 +47,6 @@ import 'linker.dart'; /// }); /// } /// ``` -/// -/// The builder is designed to immediately operate on [BuildConfig]. If a -/// builder should deviate behavior from the build config, this should be -/// configurable through a constructor parameter. For example, if a native -/// compiler should output a static library to be sent to a linker, but the -/// [BuildConfig.linkModePreference] is set to dynamic linking, the builder -/// should have its own `linkModePreference` parameter in the constructor. -/// -/// The builder is designed to immediately operate on [BuildOutput]. If a -/// builder should output something else than standard, it should be -/// configurable through a constructor parameter. For example to send an asset -/// for linking to the output ([BuildOutput.addEncodedAsset] with -/// `linkInPackage` set), the builder should have a constructor parameter. -/// (Instead of capturing the BuildOutput as a return value and manually -/// manipulating it in the build hook.) This ensures that builder is in control -/// of what combination of build outputs are valid. abstract interface class Builder { /// Runs this build. /// @@ -71,7 +54,7 @@ abstract interface class Builder { /// logs to [logger]. Future run({ required BuildConfig config, - required BuildOutput output, + required BuildOutputBuilder output, required Logger? logger, }); } diff --git a/pkgs/native_assets_cli/lib/src/api/hook_config.dart b/pkgs/native_assets_cli/lib/src/api/hook_config.dart deleted file mode 100644 index f43e62e3a..000000000 --- a/pkgs/native_assets_cli/lib/src/api/hook_config.dart +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:convert'; -import 'dart:io'; - -import 'package:collection/collection.dart'; -import 'package:crypto/crypto.dart'; -import 'package:pub_semver/pub_semver.dart'; - -import '../architecture.dart'; -import '../build_mode.dart'; -import '../c_compiler_config.dart'; -import '../code_assets/code_asset.dart'; -import '../data_assets/data_asset.dart'; -import '../ios_sdk.dart'; -import '../json_utils.dart'; -import '../link_mode.dart'; -import '../link_mode_preference.dart'; -import '../model/hook.dart'; -import '../model/metadata.dart'; -import '../model/target.dart'; -import '../os.dart'; -import '../utils/map.dart'; -import 'build_config.dart'; -import 'link_config.dart'; - -part '../model/hook_config.dart'; - -/// The shared properties of a [LinkConfig] and a [BuildConfig]. -/// -/// This abstraction makes it easier to design APIs intended for both kinds of -/// build hooks, building and linking. -abstract class HookConfig { - /// The directory in which output and intermediate artifacts that are unique - /// to this configuration can be placed. - /// - /// This directory is unique per hook and per configuration. - /// - /// The contents of this directory will not be modified by anything else than - /// the hook itself. - /// - /// The invoker of the the hook will ensure concurrent invocations wait on - /// each other. - Uri get outputDirectory; - - /// The directory in which shared output and intermediate artifacts can be - /// placed. - /// - /// This directory is unique per hook. - /// - /// The contents of this directory will not be modified by anything else than - /// the hook itself. - /// - /// The invoker of the the hook will ensure concurrent invocations wait on - /// each other. - Uri get outputDirectoryShared; - - /// The name of the package the assets are built for. - String get packageName; - - /// The root of the package the assets are built for. - /// - /// Often a package's assets are built because a package is a dependency of - /// another. For this it is convenient to know the packageRoot. - Uri get packageRoot; - - /// The architecture being compiled for. - /// - /// Not specified (`null`) during a [dryRun]. - Architecture? get targetArchitecture; - - /// The operating system being compiled for. - OS get targetOS; - - /// When compiling for iOS, whether to target device or simulator. - /// - /// Only available if [targetOS] is [OS.iOS]. Will throw a [StateError] if - /// accessed otherwise. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - IOSSdk? get targetIOSSdk; - - /// When compiling for iOS, the lowest iOS version that the compiled code - /// will be compatible with. - /// - /// Only available if [targetOS] is [OS.iOS]. Will throw a [StateError] if - /// accessed otherwise. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - /// - /// Corresponds to `-mios-version-min=` for the Apple clang compiler. - int? get targetIOSVersion; - - /// When compiling for MacOS, the lowest MacOS version that the compiled code - /// will be compatible with. - /// - /// Only available if [targetOS] is [OS.macOS]. Will throw a [StateError] if - /// accessed otherwise. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - /// - /// Corresponds to `-mmacosx-version-min=` for the Apple clang - /// compiler. - int? get targetMacOSVersion; - - /// When compiling for Android, the minimum Android SDK API version to that - /// the compiled code will be compatible with. - /// - /// Required when [targetOS] equals [OS.android]. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - /// - /// For more information about the Android API version, refer to - /// [`minSdkVersion`](https://developer.android.com/ndk/guides/sdk-versions#minsdkversion) - /// in the Android documentation. - int? get targetAndroidNdkApi; - - /// The configuration for invoking the C compiler. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - CCompilerConfig get cCompiler; - - /// Whether this run is a dry-run, which doesn't build anything. - /// - /// A dry-run only reports information about which assets a build would - /// create, but doesn't actually create files. - bool get dryRun; - - /// The [BuildMode] that the code should be compiled in. - /// - /// Currently [BuildMode.debug] and [BuildMode.release] are the only modes. - /// - /// Not available during a [dryRun]. Will throw a [StateError] if accessed - /// during a [dryRun]. - BuildMode get buildMode; - - /// The asset types that the invoker of this hook supports. - /// - /// Currently known values: - /// * [CodeAsset.type] - /// * [DataAsset.type] - Iterable get supportedAssetTypes; - - /// The preferred [LinkMode] method for [CodeAsset]s. - LinkModePreference get linkModePreference; -} diff --git a/pkgs/native_assets_cli/lib/src/api/link.dart b/pkgs/native_assets_cli/lib/src/api/link.dart index 98edb9e65..fe3d445bf 100644 --- a/pkgs/native_assets_cli/lib/src/api/link.dart +++ b/pkgs/native_assets_cli/lib/src/api/link.dart @@ -2,12 +2,17 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; +import 'dart:io'; + +import '../args_parser.dart'; +import '../config.dart'; import '../validation.dart'; -import 'build_output.dart'; -import 'link_config.dart'; /// Runs a native assets link. /// +/// Meant to be used in link hooks (`hook/link.dart`). +/// /// Can link native assets which are not already available, or expose existing /// files. Each individual asset is assigned a unique asset ID. /// @@ -27,17 +32,28 @@ import 'link_config.dart'; /// }); /// } /// ``` +/// If the [linker] fails, it must `throw`. Link hooks are guaranteed to be +/// invoked with a process invocation and should return a non-zero exit code on +/// failure. Throwing will lead to an uncaught exception, causing a non-zero +/// exit code. Future link( List arguments, - Future Function(LinkConfig config, LinkOutput output) linker, + Future Function(LinkConfig config, LinkOutputBuilder output) linker, ) async { - final config = LinkConfig.fromArguments(arguments) as LinkConfigImpl; - - final output = HookOutputImpl(); + final configPath = getConfigArgument(arguments); + final bytes = File(configPath).readAsBytesSync(); + final jsonConfig = const Utf8Decoder() + .fuse(const JsonDecoder()) + .convert(bytes) as Map; + final config = LinkConfig(jsonConfig); + final output = LinkOutputBuilder(); await linker(config, output); - final errors = await validateLinkOutput(config, output); + final errors = await validateLinkOutput(config, LinkOutput(output.json)); if (errors.isEmpty) { - await output.writeToFile(config: config); + final jsonOutput = + const JsonEncoder().fuse(const Utf8Encoder()).convert(output.json); + await File.fromUri(config.outputDirectory.resolve('link_output.json')) + .writeAsBytes(jsonOutput); } else { final message = [ 'The output contained unsupported output:', diff --git a/pkgs/native_assets_cli/lib/src/api/link_config.dart b/pkgs/native_assets_cli/lib/src/api/link_config.dart deleted file mode 100644 index a029a460d..000000000 --- a/pkgs/native_assets_cli/lib/src/api/link_config.dart +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. -import 'dart:convert'; -import 'dart:io'; - -import 'package:collection/collection.dart'; -import 'package:meta/meta.dart'; -import 'package:pub_semver/pub_semver.dart'; - -import '../architecture.dart'; -import '../args_parser.dart'; -import '../build_mode.dart'; -import '../c_compiler_config.dart'; -import '../encoded_asset.dart'; -import '../ios_sdk.dart'; -import '../json_utils.dart'; -import '../link_mode_preference.dart'; -import '../model/hook.dart'; -import '../os.dart'; -import '../utils/map.dart'; -import 'build_config.dart'; -import 'hook_config.dart'; - -part '../model/link_config.dart'; - -/// The configuration for a link hook (`hook/link.dart`) invocation. -/// -/// It consists of a subset of the fields from the [BuildConfig] already passed -/// to the build hook and the [encodedAssets] from the build step. -abstract class LinkConfig implements HookConfig { - /// The list of assets to be linked. These are the assets generated by a - /// `build.dart` script destined for this packages `link.dart`. - Iterable get encodedAssets; - - /// The path to the file containing recorded uses after kernel tree-shaking. - /// - /// The file contents can be parsed using `package:record_use`. - @experimental - Uri? get recordedUsagesFile; - - /// Generate the [LinkConfig] from the input arguments to the linking script. - factory LinkConfig.fromArguments(List arguments) => - LinkConfigImpl.fromArguments(arguments); - - factory LinkConfig.build({ - required Uri outputDirectory, - required Uri outputDirectoryShared, - required String packageName, - required Uri packageRoot, - Architecture? targetArchitecture, - required OS targetOS, - IOSSdk? targetIOSSdk, - int? targetIOSVersion, - int? targetMacOSVersion, - CCompilerConfig? cCompiler, - BuildMode? buildMode, - required Iterable supportedAssetTypes, - int? targetAndroidNdkApi, - required Iterable assets, - required LinkModePreference linkModePreference, - bool? dryRun, - Version? version, - }) => - LinkConfigImpl( - encodedAssets: assets, - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRoot, - buildMode: buildMode, - cCompiler: cCompiler, - targetAndroidNdkApi: targetAndroidNdkApi, - targetArchitecture: targetArchitecture, - targetIOSSdk: targetIOSSdk, - targetOS: targetOS, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - dryRun: dryRun, - linkModePreference: linkModePreference, - supportedAssetTypes: supportedAssetTypes, - version: version, - ); - - factory LinkConfig.dryRun({ - required Uri outputDirectory, - required Uri outputDirectoryShared, - required String packageName, - required Uri packageRoot, - required OS targetOS, - required Iterable supportedAssetTypes, - required Iterable assets, - required LinkModePreference linkModePreference, - Version? version, - }) => - LinkConfigImpl.dryRun( - encodedAssets: assets, - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRoot, - targetOS: targetOS, - supportedAssetTypes: supportedAssetTypes, - linkModePreference: linkModePreference, - version: version, - ); - - /// The version of [BuildConfig]. - /// - /// The build config is used in the protocol between the Dart and Flutter SDKs - /// and packages through build hook invocations. - /// - /// We're trying to avoid breaking changes. However, in the case that we have - /// to, the major version mismatch between the Dart or Flutter SDK and build - /// hook (`hook/build.dart`) will lead to a nice error message. - static Version get latestVersion => HookConfigImpl.latestVersion; -} diff --git a/pkgs/native_assets_cli/lib/src/api/link_output.dart b/pkgs/native_assets_cli/lib/src/api/link_output.dart deleted file mode 100644 index e90ace891..000000000 --- a/pkgs/native_assets_cli/lib/src/api/link_output.dart +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -part of 'build_output.dart'; - -/// The output of a link hook (`hook/link.dart`) invocation. -/// -/// A package can optionally provide link hook (`hook/link.dart`). If such a -/// hook exists, and any build hook outputs packages for linking with it, it -/// will be automatically run, by the Flutter and Dart SDK tools. The hook is -/// expect to produce a specific output which [LinkOutput] can produce. -/// -/// For more information see [link]. -/// -/// Designed to be a sink. The [LinkOutput] is not designed to be read from. -/// [Linker]s stream outputs to the link output. For more info see [Linker]. -abstract final class LinkOutput { - /// Start time for the link of this output. - /// - /// The [timestamp] is rounded down to whole seconds, because - /// [File.lastModified] is rounded to whole seconds and caching logic compares - /// these timestamps. - DateTime get timestamp; - - /// The assets produced by this link. - /// - /// In dry runs, the assets for all [Architecture]s for the [OS] specified in - /// the dry run must be provided. - Iterable get encodedAssets; - - /// The files used by this link. - /// - /// If any of the files in [dependencies] are modified after [timestamp], the - /// link will be re-run. - Iterable get dependencies; - - /// Adds file used by this link. - /// - /// If any of the files are modified after [timestamp], the link will be - /// re-run. - void addDependency(Uri dependency); - - /// Adds files used by this link. - /// - /// If any of the files are modified after [timestamp], the link will be - /// re-run. - void addDependencies(Iterable dependencies); - - /// Adds [EncodedAsset]s produced by this link or dry run. - void addEncodedAsset(EncodedAsset asset); - - /// Adds [EncodedAsset]s produced by this link or dry run. - void addEncodedAssets(Iterable assets); - - factory LinkOutput({ - Iterable? encodedAssets, - Dependencies? dependencies, - DateTime? timestamp, - }) => - HookOutputImpl( - encodedAssets: encodedAssets, - dependencies: dependencies, - timestamp: timestamp, - ); - - /// The version of [LinkOutput]. - /// - /// The link output is used in the protocol between the Dart and Flutter SDKs - /// and packages through build hook invocations. - static Version get latestVersion => HookOutputImpl.latestVersion; -} diff --git a/pkgs/native_assets_cli/lib/src/api/linker.dart b/pkgs/native_assets_cli/lib/src/api/linker.dart index 1bb080c45..a6e034cd0 100644 --- a/pkgs/native_assets_cli/lib/src/api/linker.dart +++ b/pkgs/native_assets_cli/lib/src/api/linker.dart @@ -4,9 +4,8 @@ import 'package:logging/logging.dart'; -import 'build_output.dart'; +import '../config.dart'; import 'builder.dart'; -import 'link_config.dart'; /// A linker to be run during a link hook. /// @@ -37,7 +36,7 @@ abstract interface class Linker { /// logs to [logger]. Future run({ required LinkConfig config, - required LinkOutput output, + required LinkOutputBuilder output, required Logger? logger, }); } diff --git a/pkgs/native_assets_cli/lib/src/api/test.dart b/pkgs/native_assets_cli/lib/src/api/test.dart deleted file mode 100644 index df1782c15..000000000 --- a/pkgs/native_assets_cli/lib/src/api/test.dart +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:meta/meta.dart' show isTest; -import 'package:test/test.dart'; -import 'package:yaml/yaml.dart'; - -import '../architecture.dart'; -import '../build_mode.dart'; -import '../c_compiler_config.dart'; -import '../code_assets/code_asset.dart'; -import '../data_assets/data_asset.dart'; -import '../ios_sdk.dart'; -import '../link_mode_preference.dart'; -import '../os.dart'; -import 'build_config.dart'; -import 'build_output.dart'; - -@isTest -Future testBuildHook({ - required String description, - // ignore: inference_failure_on_function_return_type - required Function(List arguments) mainMethod, - required void Function(BuildConfig config, BuildOutput output) check, - BuildMode? buildMode, - Architecture? targetArchitecture, - OS? targetOS, - IOSSdk? targetIOSSdk, - int? targetIOSVersion, - int? targetMacOSVersion, - int? targetAndroidNdkApi, - CCompilerConfig? cCompiler, - LinkModePreference? linkModePreference, - required Iterable supportedAssetTypes, - bool? linkingEnabled, -}) async { - test( - description, - () async { - final tempDir = await _tempDirForTest(); - - final outputDirectory = tempDir.resolve('output/'); - await Directory.fromUri(outputDirectory).create(); - final outputDirectoryShared = tempDir.resolve('output_shared/'); - await Directory.fromUri(outputDirectory).create(); - - final buildConfig = BuildConfig.build( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: await _packageName(), - packageRoot: Directory.current.uri, - buildMode: buildMode ?? BuildMode.release, - targetArchitecture: targetArchitecture ?? Architecture.current, - targetOS: targetOS ?? OS.current, - linkModePreference: linkModePreference ?? LinkModePreference.dynamic, - linkingEnabled: linkingEnabled ?? true, - cCompiler: cCompiler, - supportedAssetTypes: supportedAssetTypes, - targetAndroidNdkApi: targetAndroidNdkApi, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion, - ) as BuildConfigImpl; - final buildConfigUri = tempDir.resolve('build_config.json'); - - await _writeBuildConfig(buildConfigUri, buildConfig); - - await mainMethod(['--config=${buildConfigUri.toFilePath()}']); - - final hookOutput = await _readOutput(buildConfig) as BuildOutput; - - check(buildConfig, hookOutput); - - final allEncodedAssets = [ - ...hookOutput.encodedAssets, - ...hookOutput.encodedAssetsForLinking.values.expand((e) => e) - ]; - for (final asset in allEncodedAssets) { - expect(buildConfig.supportedAssetTypes, contains(asset.type)); - } - - for (final asset in hookOutput.dataAssets.all) { - final file = File.fromUri(asset.file); - expect(await file.exists(), true); - } - for (final asset in hookOutput.codeAssets.all) { - if (asset.file != null) { - final file = File.fromUri(asset.file!); - expect(await file.exists(), true); - } - } - }, - ); -} - -Future _writeBuildConfig( - Uri buildConfigUri, - BuildConfigImpl buildConfig, -) async { - final file = File.fromUri(buildConfigUri); - await file.create(); - file.writeAsStringSync(buildConfig.toJsonString()); -} - -Future _readOutput(BuildConfigImpl buildConfig) async { - final hookOutput = HookOutputImpl.fromJsonString( - await File.fromUri(buildConfig.outputFile).readAsString()); - return hookOutput; -} - -Future _packageName() async { - final uri = Directory.current.uri.resolve('pubspec.yaml'); - final readAsString = await File.fromUri(uri).readAsString(); - final yaml = loadYaml(readAsString) as YamlMap; - return yaml['name'] as String; -} - -const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; - -Future _tempDirForTest({String? prefix, bool keepTemp = false}) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); - // Deal with Windows temp folder aliases. - final tempUri = - Directory(await tempDir.resolveSymbolicLinks()).uri.normalizePath(); - if ((!Platform.environment.containsKey(keepTempKey) || - Platform.environment[keepTempKey]!.isEmpty) && - !keepTemp) { - addTearDown(() => tempDir.delete(recursive: true)); - } - return tempUri; -} diff --git a/pkgs/native_assets_cli/lib/src/architecture.dart b/pkgs/native_assets_cli/lib/src/code_assets/architecture.dart similarity index 100% rename from pkgs/native_assets_cli/lib/src/architecture.dart rename to pkgs/native_assets_cli/lib/src/code_assets/architecture.dart diff --git a/pkgs/native_assets_cli/lib/src/c_compiler_config.dart b/pkgs/native_assets_cli/lib/src/code_assets/c_compiler_config.dart similarity index 59% rename from pkgs/native_assets_cli/lib/src/c_compiler_config.dart rename to pkgs/native_assets_cli/lib/src/code_assets/c_compiler_config.dart index b04cc7cbc..32384f282 100644 --- a/pkgs/native_assets_cli/lib/src/c_compiler_config.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/c_compiler_config.dart @@ -4,19 +4,19 @@ import 'package:collection/collection.dart'; -import 'json_utils.dart'; -import 'utils/map.dart'; +import '../json_utils.dart'; +import '../utils/map.dart'; /// The configuration for a C toolchain. final class CCompilerConfig { /// Path to a C compiler. - late final Uri? compiler; + late final Uri compiler; /// Path to a native linker. - late final Uri? linker; + late final Uri linker; /// Path to a native archiver. - late final Uri? archiver; + late final Uri archiver; /// Path to script that sets environment variables for [compiler], [linker], /// and [archiver]. @@ -27,9 +27,9 @@ final class CCompilerConfig { /// Constructs a new [CCompilerConfig] based on the given toolchain tools. CCompilerConfig({ - this.archiver, - this.compiler, - this.linker, + required this.archiver, + required this.compiler, + required this.linker, this.envScript, this.envScriptArgs, }); @@ -38,25 +38,23 @@ final class CCompilerConfig { /// /// The json is expected to be valid encoding obtained via /// [CCompilerConfig.toJson]. - factory CCompilerConfig.fromJson(Map json) { - final compiler = _parseCompiler(json); - return CCompilerConfig( - archiver: _parseArchiver(json), - compiler: compiler, - envScript: _parseEnvScript(json, compiler), - envScriptArgs: _parseEnvScriptArgs(json), - linker: _parseLinker(json), - ); - } + factory CCompilerConfig.fromJson(Map json) => + CCompilerConfig( + archiver: json.path(_arConfigKey), + compiler: json.path(_ccConfigKey), + envScript: json.optionalPath(_envScriptConfigKey), + envScriptArgs: json.optionalStringList(_envScriptArgsConfigKey), + linker: json.path(_ldConfigKey), + ); /// The json representation of this [CCompilerConfig]. /// /// The returned json can be used in [CCompilerConfig.fromJson] to /// obtain a [CCompilerConfig] again. Map toJson() => { - if (archiver != null) _arConfigKey: archiver!.toFilePath(), - if (compiler != null) _ccConfigKey: compiler!.toFilePath(), - if (linker != null) _ldConfigKey: linker!.toFilePath(), + _arConfigKey: archiver.toFilePath(), + _ccConfigKey: compiler.toFilePath(), + _ldConfigKey: linker.toFilePath(), if (envScript != null) _envScriptConfigKey: envScript!.toFilePath(), if (envScriptArgs != null) _envScriptArgsConfigKey: envScriptArgs!, }.sortOnKey(); @@ -87,29 +85,6 @@ final class CCompilerConfig { ); } -Uri? _parseArchiver(Map config) => config.optionalPath( - _arConfigKey, - mustExist: true, - ); - -Uri? _parseCompiler(Map config) => config.optionalPath( - _ccConfigKey, - mustExist: true, - ); - -Uri? _parseLinker(Map config) => config.optionalPath( - _ldConfigKey, - mustExist: true, - ); - -Uri? _parseEnvScript(Map config, Uri? compiler) => - (compiler != null && compiler.toFilePath().endsWith('cl.exe')) - ? config.path(_envScriptConfigKey, mustExist: true) - : null; - -List? _parseEnvScriptArgs(Map config) => - config.optionalStringList(_envScriptArgsConfigKey); - const _arConfigKey = 'ar'; const _ccConfigKey = 'cc'; const _ldConfigKey = 'ld'; diff --git a/pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart b/pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart index 2a13e71ca..4a65875ae 100644 --- a/pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart @@ -2,16 +2,14 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../api/build_config.dart'; -import '../api/build_output.dart'; -import '../api/link_config.dart'; -import '../architecture.dart'; +import '../config.dart'; import '../encoded_asset.dart'; import '../json_utils.dart'; -import '../link_mode.dart'; -import '../os.dart'; import '../utils/json.dart'; import '../utils/map.dart'; +import 'architecture.dart'; +import 'link_mode.dart'; +import 'os.dart'; /// A code asset which respects the native application binary interface (ABI). /// @@ -62,8 +60,6 @@ final class CodeAsset { final OS os; /// The architecture this asset can run on. - /// - /// Not available during a [BuildConfig.dryRun]. final Architecture? architecture; /// The link mode for this native code. @@ -73,14 +69,14 @@ final class CodeAsset { /// The file to be bundled with the Dart or Flutter application. /// - /// If the [linkMode] is [DynamicLoadingBundled], the file name must be - /// provided in the [BuildOutput] for [BuildConfig.dryRun]. Supplying a file - /// name instead of an absolute path is enough for [BuildConfig.dryRun]. The - /// file does not have to exist on disk during a dry run. + /// If the [linkMode] is [DynamicLoadingBundled], the file must be provided + /// and exist. + /// + /// If the [linkMode] is [DynamicLoadingSystem], the file must be provided, + /// and not exist. /// - /// If the [linkMode] is [DynamicLoadingSystem], [LookupInProcess], or - /// [LookupInExecutable] the file must be omitted in the [BuildOutput] for - /// [BuildConfig.dryRun]. + /// If the [linkMode] is [LookupInProcess], or [LookupInExecutable] the file + /// must be omitted in the [BuildOutput]. final Uri? file; /// Constructs a native code asset. @@ -190,59 +186,6 @@ final class CodeAsset { static const String type = 'native_code'; } -/// Build output extension for code assets. -extension CodeAssetsBuildOutput on BuildOutput { - BuildOutputCodeAssets get codeAssets => BuildOutputCodeAssets(this); -} - -extension type BuildOutputCodeAssets(BuildOutput _output) { - void add(CodeAsset asset, {String? linkInPackage}) => - _output.addEncodedAsset(asset.encode(), linkInPackage: linkInPackage); - - void addAll(Iterable assets, {String? linkInPackage}) { - for (final asset in assets) { - add(asset, linkInPackage: linkInPackage); - } - } - - Iterable get all => _output.encodedAssets - .where((e) => e.type == CodeAsset.type) - .map(CodeAsset.fromEncoded); -} - -/// Link output extension for code assets. -extension CodeAssetsLinkConfig on LinkConfig { - LinkConfigCodeAssets get codeAssets => LinkConfigCodeAssets(this); -} - -extension type LinkConfigCodeAssets(LinkConfig _config) { - // Returns the code assets that were sent to this linker. - // - // NOTE: If the linker implementation depends on the contents of the files the - // code assets refer (e.g. looks at static archives and links them) then the - // linker script has to add those files as dependencies via - // [LinkOutput.addDependency] to ensure the linker script will be re-run if - // the content of the files changes. - Iterable get all => _config.encodedAssets - .where((e) => e.type == CodeAsset.type) - .map(CodeAsset.fromEncoded); -} - -/// Link output extension for code assets. -extension CodeAssetsLinkOutput on LinkOutput { - LinkOutputCodeAssets get codeAssets => LinkOutputCodeAssets(this); -} - -extension type LinkOutputCodeAssets(LinkOutput _output) { - void add(CodeAsset asset) => _output.addEncodedAsset(asset.encode()); - - void addAll(Iterable assets) => assets.forEach(add); - - Iterable get all => _output.encodedAssets - .where((e) => e.type == CodeAsset.type) - .map(CodeAsset.fromEncoded); -} - extension OSLibraryNaming on OS { /// The default dynamic library file name on this os. String dylibFileName(String name) { diff --git a/pkgs/native_assets_cli/lib/src/code_assets/config.dart b/pkgs/native_assets_cli/lib/src/code_assets/config.dart new file mode 100644 index 000000000..9ae1fe9f4 --- /dev/null +++ b/pkgs/native_assets_cli/lib/src/code_assets/config.dart @@ -0,0 +1,185 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../config.dart'; +import '../json_utils.dart'; +import 'architecture.dart'; +import 'c_compiler_config.dart'; +import 'code_asset.dart'; +import 'ios_sdk.dart'; +import 'link_mode_preference.dart'; +import 'os.dart'; + +/// Extension to the [BuildConfig] providing access to configuration specific to +/// code assets (only available if code assets are supported). +extension CodeAssetBuildConfig on BuildConfig { + /// Code asset specific configuration. + CodeConfig get codeConfig => CodeConfig(this); +} + +/// Extension to the [LinkConfig] providing access to configuration specific to +/// code assets as well as code asset inputs to the linker (only available if +/// code assets are supported). +extension CodeAssetLinkConfig on LinkConfig { + /// Code asset specific configuration. + CodeConfig get codeConfig => CodeConfig(this); + + // Returns the code assets that were sent to this linker. + // + // NOTE: If the linker implementation depends on the contents of the files the + // code assets refer (e.g. looks at static archives and links them) then the + // linker script has to add those files as dependencies via + // [LinkOutput.addDependency] to ensure the linker script will be re-run if + // the content of the files changes. + Iterable get codeAssets => encodedAssets + .where((e) => e.type == CodeAsset.type) + .map(CodeAsset.fromEncoded); +} + +/// Configuration for hook writers if code assets are supported. +class CodeConfig { + final Architecture? _targetArchitecture; + + final LinkModePreference linkModePreference; + final CCompilerConfig? cCompiler; + final int? targetIOSVersion; + final int? targetMacOSVersion; + final int? targetAndroidNdkApi; + final IOSSdk? targetIOSSdk; + + /// The operating system being compiled for. + final OS targetOS; + + CodeConfig(HookConfig config) + : linkModePreference = LinkModePreference.fromString( + config.json.string(_linkModePreferenceKey)), + // ignore: deprecated_member_use_from_same_package + _targetArchitecture = (config is BuildConfig && config.dryRun) + ? null + : Architecture.fromString(config.json.string(_targetArchitectureKey, + validValues: Architecture.values.map((a) => a.name))), + targetOS = OS.fromString(config.json.string(_targetOSConfigKey)), + cCompiler = switch (config.json.optionalMap(_compilerKey)) { + final Map map => CCompilerConfig.fromJson(map), + null => null, + }, + targetIOSVersion = config.json.optionalInt(_targetIOSVersionKey), + targetMacOSVersion = config.json.optionalInt(_targetMacOSVersionKey), + targetAndroidNdkApi = config.json.optionalInt(_targetAndroidNdkApiKey), + targetIOSSdk = switch (config.json.optionalString(_targetIOSSdkKey)) { + final String value => IOSSdk.fromString(value), + null => null, + }; + + Architecture get targetArchitecture { + if (_targetArchitecture == null) { + throw StateError('Cannot access target architecture in dry runs'); + } + return _targetArchitecture; + } +} + +/// Extension to the [BuildOutputBuilder] providing access to emitting code +/// assets (only available if code assets are supported). +extension CodeAssetBuildOutputBuilder on BuildOutputBuilder { + /// Provides access to emitting code assets. + CodeAssetBuildOutputBuilderAdd get codeAssets => + CodeAssetBuildOutputBuilderAdd._(this); +} + +/// Supports emitting code assets for build hooks. +extension type CodeAssetBuildOutputBuilderAdd._(BuildOutputBuilder _output) { + /// Adds the given [asset] to the hook output (or send to [linkInPackage] + /// for linking if provided). + void add(CodeAsset asset, {String? linkInPackage}) => + _output.addEncodedAsset(asset.encode(), linkInPackage: linkInPackage); + + /// Adds the given [assets] to the hook output (or send to [linkInPackage] + /// for linking if provided). + void addAll(Iterable assets, {String? linkInPackage}) { + for (final asset in assets) { + add(asset, linkInPackage: linkInPackage); + } + } +} + +/// Extension to the [LinkOutputBuilder] providing access to emitting code +/// assets (only available if code assets are supported). +extension CodeAssetLinkOutputBuilder on LinkOutputBuilder { + /// Provides access to emitting code assets. + CodeAssetLinkOutputBuilderAdd get codeAssets => + CodeAssetLinkOutputBuilderAdd._(this); +} + +/// Extension on [LinkOutputBuilder] to emit code assets. +extension type CodeAssetLinkOutputBuilderAdd._(LinkOutputBuilder _output) { + /// Adds the given [asset] to the link hook output. + void add(CodeAsset asset) => _output.addEncodedAsset(asset.encode()); + + /// Adds the given [assets] to the link hook output. + void addAll(Iterable assets) => assets.forEach(add); +} + +/// Extension to initialize code specific configuration on link/build configs. +extension CodeAssetBuildConfigBuilder on HookConfigBuilder { + void setupCodeConfig({ + required Architecture? targetArchitecture, + required OS targetOS, + required LinkModePreference linkModePreference, + CCompilerConfig? cCompilerConfig, + int? targetIOSVersion, + int? targetMacOSVersion, + int? targetAndroidNdkApi, + IOSSdk? targetIOSSdk, + }) { + if (targetArchitecture != null) { + json[_targetArchitectureKey] = targetArchitecture.toString(); + } + json[_targetOSConfigKey] = targetOS.toString(); + json[_linkModePreferenceKey] = linkModePreference.toString(); + if (cCompilerConfig != null) { + json[_compilerKey] = cCompilerConfig.toJson(); + } + + if (targetIOSVersion != null) { + json[_targetIOSVersionKey] = targetIOSVersion; + } + if (targetMacOSVersion != null) { + json[_targetMacOSVersionKey] = targetMacOSVersion; + } + if (targetAndroidNdkApi != null) { + json[_targetAndroidNdkApiKey] = targetAndroidNdkApi; + } + if (targetIOSSdk != null) { + json[_targetIOSSdkKey] = targetIOSSdk.toString(); + } + } +} + +/// Provides access to [CodeAsset]s from a build hook output. +extension CodeAssetBuildOutput on BuildOutput { + /// The code assets emitted by the build hook. + List get codeAssets => encodedAssets + .where((asset) => asset.type == CodeAsset.type) + .map(CodeAsset.fromEncoded) + .toList(); +} + +/// Provides access to [CodeAsset]s from a link hook output. +extension CodeAssetLinkOutput on LinkOutput { + /// The code assets emitted by the link hook. + List get codeAssets => encodedAssets + .where((asset) => asset.type == CodeAsset.type) + .map(CodeAsset.fromEncoded) + .toList(); +} + +const String _compilerKey = 'c_compiler'; +const String _linkModePreferenceKey = 'link_mode_preference'; +const String _targetAndroidNdkApiKey = 'target_android_ndk_api'; +const String _targetArchitectureKey = 'target_architecture'; +const String _targetIOSSdkKey = 'target_ios_sdk'; +const String _targetIOSVersionKey = 'target_ios_version'; +const String _targetMacOSVersionKey = 'target_macos_version'; +const String _targetOSConfigKey = 'target_os'; diff --git a/pkgs/native_assets_cli/lib/src/ios_sdk.dart b/pkgs/native_assets_cli/lib/src/code_assets/ios_sdk.dart similarity index 100% rename from pkgs/native_assets_cli/lib/src/ios_sdk.dart rename to pkgs/native_assets_cli/lib/src/code_assets/ios_sdk.dart diff --git a/pkgs/native_assets_cli/lib/src/link_mode.dart b/pkgs/native_assets_cli/lib/src/code_assets/link_mode.dart similarity index 95% rename from pkgs/native_assets_cli/lib/src/link_mode.dart rename to pkgs/native_assets_cli/lib/src/code_assets/link_mode.dart index bd02c1a7d..ad6b33889 100644 --- a/pkgs/native_assets_cli/lib/src/link_mode.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/link_mode.dart @@ -2,8 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'api/build_config.dart'; -import 'code_assets/code_asset.dart'; +import 'code_asset.dart'; /// The link mode for a [CodeAsset]. /// @@ -74,10 +73,6 @@ abstract final class DynamicLoading extends LinkMode { /// An asset with this dynamic loading method must provide a /// [CodeAsset.file]. The Dart and Flutter SDK will bundle this code in /// the final application. -/// -/// During a [BuildConfig.dryRun], the [CodeAsset.file] can be a file name -/// instead of a the full path. The file does not have to exist during a dry -/// run. final class DynamicLoadingBundled extends DynamicLoading { DynamicLoadingBundled._() : super._(); diff --git a/pkgs/native_assets_cli/lib/src/link_mode_preference.dart b/pkgs/native_assets_cli/lib/src/code_assets/link_mode_preference.dart similarity index 97% rename from pkgs/native_assets_cli/lib/src/link_mode_preference.dart rename to pkgs/native_assets_cli/lib/src/code_assets/link_mode_preference.dart index f5a37580b..8cb7331d2 100644 --- a/pkgs/native_assets_cli/lib/src/link_mode_preference.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/link_mode_preference.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'code_assets/code_asset.dart'; +import 'code_asset.dart'; /// The preferred linkMode method for [CodeAsset]s. final class LinkModePreference { diff --git a/pkgs/native_assets_cli/lib/src/os.dart b/pkgs/native_assets_cli/lib/src/code_assets/os.dart similarity index 100% rename from pkgs/native_assets_cli/lib/src/os.dart rename to pkgs/native_assets_cli/lib/src/code_assets/os.dart diff --git a/pkgs/native_assets_cli/lib/src/code_assets/testing.dart b/pkgs/native_assets_cli/lib/src/code_assets/testing.dart new file mode 100644 index 000000000..3d2648273 --- /dev/null +++ b/pkgs/native_assets_cli/lib/src/code_assets/testing.dart @@ -0,0 +1,65 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import '../../code_assets_builder.dart'; +import '../../test.dart'; +import '../validation.dart'; + +/// Validate a code build hook; this will throw an exception on validation +/// errors. +/// +/// This is intended to be used from tests, e.g.: +/// +/// ``` +/// test('test my build hook', () async { +/// await testCodeBuildHook( +/// ... +/// ); +/// }); +/// ``` +Future testCodeBuildHook({ + // ignore: inference_failure_on_function_return_type + required Function(List arguments) mainMethod, + required FutureOr Function(BuildConfig, BuildOutput) check, + Architecture? targetArchitecture, + OS? targetOS, + IOSSdk? targetIOSSdk, + int? targetIOSVersion, + int? targetMacOSVersion, + int? targetAndroidNdkApi, + CCompilerConfig? cCompiler, + LinkModePreference? linkModePreference, + required List buildAssetTypes, + bool? linkingEnabled, +}) async { + await testBuildHook( + mainMethod: mainMethod, + extraConfigSetup: (config) { + config.setupCodeConfig( + linkModePreference: linkModePreference ?? LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + targetArchitecture: targetArchitecture ?? Architecture.current, + targetOS: targetOS ?? OS.current, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion, + targetAndroidNdkApi: targetAndroidNdkApi, + ); + }, + check: (config, output) async { + final validationErrors = + await validateCodeAssetBuildOutput(config, output); + if (validationErrors.isNotEmpty) { + throw ValidationFailure( + 'encountered build output validation issues: $validationErrors'); + } + + await check(config, output); + }, + buildAssetTypes: buildAssetTypes, + linkingEnabled: linkingEnabled, + ); +} diff --git a/pkgs/native_assets_cli/lib/src/code_assets/validation.dart b/pkgs/native_assets_cli/lib/src/code_assets/validation.dart index 4910f2ed6..40b17f8ec 100644 --- a/pkgs/native_assets_cli/lib/src/code_assets/validation.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/validation.dart @@ -4,28 +4,104 @@ import 'dart:io'; -import '../../native_assets_cli_internal.dart'; -import '../link_mode.dart'; +import '../../code_assets_builder.dart'; + +import 'link_mode.dart'; + +Future validateCodeAssetBuildConfig( + BuildConfig config) async => + _validateCodeConfig( + 'BuildConfig', + config.codeConfig.targetOS, + // ignore: deprecated_member_use_from_same_package + config.dryRun, + config.codeConfig, + ); + +Future validateCodeAssetLinkConfig(LinkConfig config) async => + _validateCodeConfig( + 'LinkConfig', config.codeConfig.targetOS, false, config.codeConfig); + +ValidationErrors _validateCodeConfig( + String configName, OS targetOS, bool dryRun, CodeConfig codeConfig) { + // The dry run will be removed soon. + if (dryRun) return const []; + + final errors = []; + switch (targetOS) { + case OS.macOS: + if (codeConfig.targetMacOSVersion == null) { + errors.add('$configName.targetOS is OS.macOS but ' + '$configName.codeConfig.targetMacOSVersion was missing'); + } + break; + case OS.iOS: + if (codeConfig.targetIOSSdk == null) { + errors.add('$configName.targetOS is OS.iOS but ' + '$configName.codeConfig.targetIOSSdk was missing'); + } + if (codeConfig.targetIOSVersion == null) { + errors.add('$configName.targetOS is OS.iOS but ' + '$configName.codeConfig.targetIOSVersion was missing'); + } + break; + case OS.android: + if (codeConfig.targetAndroidNdkApi == null) { + errors.add('$configName.targetOS is OS.android but ' + '$configName.codeConfig.targetAndroidNdkApi was missing'); + } + break; + } + final compilerConfig = codeConfig.cCompiler; + if (compilerConfig != null) { + final compiler = compilerConfig.compiler.toFilePath(); + if (!File(compiler).existsSync()) { + errors.add('$configName.codeConfig.compiler ($compiler) does not exist.'); + } + final linker = compilerConfig.linker.toFilePath(); + if (!File(linker).existsSync()) { + errors.add('$configName.codeConfig.linker ($linker) does not exist.'); + } + final archiver = compilerConfig.archiver.toFilePath(); + if (!File(archiver).existsSync()) { + errors.add('$configName.codeConfig.archiver ($archiver) does not exist.'); + } + final envScript = compilerConfig.envScript?.toFilePath(); + if (envScript != null && !File(envScript).existsSync()) { + errors + .add('$configName.codeConfig.envScript ($envScript) does not exist.'); + } + } + return errors; +} Future validateCodeAssetBuildOutput( - HookConfig config, + BuildConfig config, BuildOutput output, ) => - _validateCodeAssetBuildOrLinkOutput(config, output as HookOutputImpl, true); + _validateCodeAssetBuildOrLinkOutput( + config, + config.codeConfig, + output.encodedAssets, + // ignore: deprecated_member_use_from_same_package + config.dryRun, + output, + true, + ); Future validateCodeAssetLinkOutput( - HookConfig config, + LinkConfig config, LinkOutput output, ) => _validateCodeAssetBuildOrLinkOutput( - config, output as HookOutputImpl, false); + config, config.codeConfig, output.encodedAssets, false, output, false); /// Validates that the given code assets can be used together in an application. /// /// Some restrictions - e.g. unique shared library names - have to be validated /// on the entire application build and not on individual `hook/build.dart` /// invocations. -Future validateCodeAssetsInApplication( +Future validateCodeAssetInApplication( List assets) async { final fileNameToEncodedAssetId = >{}; for (final asset in assets) { @@ -40,18 +116,22 @@ Future validateCodeAssetsInApplication( Future _validateCodeAssetBuildOrLinkOutput( HookConfig config, - HookOutputImpl output, + CodeConfig codeConfig, + List encodedAssets, + bool dryRun, + HookOutput output, bool isBuild, ) async { final errors = []; final ids = {}; final fileNameToEncodedAssetId = >{}; - for (final asset in output.encodedAssets) { + for (final asset in encodedAssets) { if (asset.type != CodeAsset.type) continue; _validateCodeAssets( config, - config.dryRun, + codeConfig, + dryRun, CodeAsset.fromEncoded(asset), errors, ids, @@ -66,6 +146,7 @@ Future _validateCodeAssetBuildOrLinkOutput( void _validateCodeAssets( HookConfig config, + CodeConfig codeConfig, bool dryRun, CodeAsset codeAsset, List errors, @@ -81,7 +162,7 @@ void _validateCodeAssets( errors.add('More than one code asset with same "$id" id.'); } - final preference = config.linkModePreference; + final preference = codeConfig.linkModePreference; final linkMode = codeAsset.linkMode; if ((linkMode is DynamicLoading && preference == LinkModePreference.static) || (linkMode is StaticLinking && preference == LinkModePreference.dynamic)) { @@ -91,9 +172,9 @@ void _validateCodeAssets( } final os = codeAsset.os; - if (config.targetOS != os) { + if (codeConfig.targetOS != os) { final error = 'CodeAsset "$id" has a os "$os", which ' - 'is not the target os "${config.targetOS}".'; + 'is not the target os "${codeConfig.targetOS}".'; errors.add(error); } @@ -101,9 +182,9 @@ void _validateCodeAssets( if (!dryRun) { if (architecture == null) { errors.add('CodeAsset "$id" has no architecture.'); - } else if (architecture != config.targetArchitecture) { + } else if (architecture != codeConfig.targetArchitecture) { errors.add('CodeAsset "$id" has an architecture "$architecture", which ' - 'is not the target architecture "${config.targetArchitecture}".'); + 'is not the target architecture "${codeConfig.targetArchitecture}".'); } } diff --git a/pkgs/native_assets_cli/lib/src/config.dart b/pkgs/native_assets_cli/lib/src/config.dart new file mode 100644 index 000000000..ff1912306 --- /dev/null +++ b/pkgs/native_assets_cli/lib/src/config.dart @@ -0,0 +1,544 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert' hide json; +import 'dart:io'; + +import 'package:crypto/crypto.dart' show sha256; +import 'package:pub_semver/pub_semver.dart'; + +import 'api/deprecation_messages.dart'; +import 'code_assets/architecture.dart'; +import 'code_assets/os.dart'; +import 'encoded_asset.dart'; +import 'json_utils.dart'; +import 'metadata.dart'; +import 'utils/datetime.dart'; +import 'utils/json.dart'; + +/// The shared properties of a [LinkConfig] and a [BuildConfig]. +/// +/// This abstraction makes it easier to design APIs intended for both kinds of +/// build hooks, building and linking. +sealed class HookConfig { + /// The underlying json configuration of this [HookConfig]. + final Map json; + + /// The version of the [HookConfig]. + final Version version; + + /// The directory in which output and intermediate artifacts that are unique + /// to this configuration can be placed. + /// + /// This directory is unique per hook and per configuration. + /// + /// The contents of this directory will not be modified by anything else than + /// the hook itself. + /// + /// The invoker of the the hook will ensure concurrent invocations wait on + /// each other. + final Uri outputDirectory; + + /// The directory in which shared output and intermediate artifacts can be + /// placed. + /// + /// This directory is unique per hook. + /// + /// The contents of this directory will not be modified by anything else than + /// the hook itself. + /// + /// The invoker of the the hook will ensure concurrent invocations wait on + /// each other. + final Uri outputDirectoryShared; + + /// The name of the package the assets are built for. + final String packageName; + + /// The root of the package the assets are built for. + /// + /// Often a package's assets are built because a package is a dependency of + /// another. For this it is convenient to know the packageRoot. + final Uri packageRoot; + + /// The asset types that the invoker of this hook supports. + final List buildAssetTypes; + + HookConfig(this.json) + : version = switch (Version.parse(json.string(_versionKey))) { + final Version version => (version.major != latestVersion.major || + version < latestParsableVersion) + ? throw FormatException( + 'Only compatible versions with $latestVersion are supported ' + '(was: $version).') + : version, + }, + outputDirectory = json.path(_outDirConfigKey), + outputDirectoryShared = json.path(_outDirSharedConfigKey), + packageRoot = json.path(_packageRootConfigKey), + packageName = json.string(_packageNameConfigKey), + buildAssetTypes = json.optionalStringList(_buildAssetTypesKey) ?? + json.optionalStringList(_supportedAssetTypesKey) ?? + const []; + + @override + String toString() => const JsonEncoder.withIndent(' ').convert(json); +} + +sealed class HookConfigBuilder { + final Map json = { + 'version': latestVersion.toString(), + }; + + void setupHookConfig({ + required Uri packageRoot, + required String packageName, + required List buildAssetTypes, + }) { + json[_packageNameConfigKey] = packageName; + json[_packageRootConfigKey] = packageRoot.toFilePath(); + json[_buildAssetTypesKey] = buildAssetTypes; + json[_supportedAssetTypesKey] = buildAssetTypes; + } + + /// Constructs a checksum for a [BuildConfig]. + /// + /// This can be used to construct an output directory name specific to the + /// [BuildConfig] being built with this [BuildConfigBuilder]. It is therefore + /// assumed the output directory has not been set yet. + String computeChecksum() { + if (json.containsKey(_outDirConfigKey) || + json.containsKey(_outDirSharedConfigKey) || + json.containsKey(_assetsKey)) { + // The bundling tools would first calculate the checksum, create an output + // directory and then call [BuildConfigBuilder.setupBuildRunConfig] & + // [LinkConfigBuilder.setupLinkRunConfig]. + // The output directory should not depend on the assets passed in for + // linking. + throw StateError('The checksum should be generated before setting ' + 'up the run configuration'); + } + final hash = sha256 + .convert(const JsonEncoder().fuse(const Utf8Encoder()).convert(json)) + .toString() + // 256 bit hashes lead to 64 hex character strings. + // To avoid overflowing file paths limits, only use 32. + // Using 16 hex characters would also be unlikely to have collisions. + .substring(0, 32); + return hash; + } +} + +// TODO: Bump min-SDK constraint to 3.7 and remove once stable. +const _buildModeConfigKeyDeprecated = 'build_mode'; +const _metadataConfigKey = 'metadata'; +const _outDirConfigKey = 'out_dir'; +const _outDirSharedConfigKey = 'out_dir_shared'; +const _packageNameConfigKey = 'package_name'; +const _packageRootConfigKey = 'package_root'; +const _supportedAssetTypesKey = 'supported_asset_types'; +const _buildAssetTypesKey = 'build_asset_types'; + +final class BuildConfig extends HookConfig { + // TODO(dcharkes): Remove after 3.7.0 stable is released and bump the SDK + // constraint in the pubspec. Ditto for all uses in related packages. + /// Whether this run is a dry-run, which doesn't build anything. + /// + /// A dry-run only reports information about which assets a build would + /// create, but doesn't actually create files. + @Deprecated('Flutter will no longer invoke dry run as of 3.27.') + final bool dryRun; + + final bool linkingEnabled; + + final Map metadata; + + BuildConfig(super.json) + // ignore: deprecated_member_use_from_same_package + : dryRun = json.getOptional(_dryRunConfigKey) ?? false, + linkingEnabled = json.get(_linkingEnabledKey), + metadata = { + for (final entry + in (json.optionalMap(_dependencyMetadataKey) ?? {}).entries) + entry.key: Metadata.fromJson(as>(entry.value)), + }; + + Object? metadatum(String packageName, String key) => + metadata[packageName]?.metadata[key]; +} + +final class BuildConfigBuilder extends HookConfigBuilder { + void setupBuildConfig({ + required bool dryRun, + required bool linkingEnabled, + Map metadata = const {}, + }) { + json[_dryRunConfigKey] = dryRun; + json[_linkingEnabledKey] = linkingEnabled; + json[_dependencyMetadataKey] = { + for (final key in metadata.keys) key: metadata[key]!.toJson(), + }; + // TODO: Bump min-SDK constraint to 3.7 and remove once stable. + if (!dryRun) { + json[_buildModeConfigKeyDeprecated] = 'release'; + } + } + + void setupBuildRunConfig({ + required Uri outputDirectory, + required Uri outputDirectoryShared, + }) { + json[_outDirConfigKey] = outputDirectory.toFilePath(); + json[_outDirSharedConfigKey] = outputDirectoryShared.toFilePath(); + } +} + +const _dryRunConfigKey = 'dry_run'; +const _linkingEnabledKey = 'linking_enabled'; + +final class LinkConfig extends HookConfig { + final List encodedAssets; + + final Uri? recordedUsagesFile; + + LinkConfig(super.json) + : encodedAssets = + _parseAssets(json.getOptional>(_assetsKey)), + recordedUsagesFile = json.optionalPath(_recordedUsagesFileConfigKey); +} + +final class LinkConfigBuilder extends HookConfigBuilder { + void setupLinkConfig({ + required List assets, + }) { + json[_assetsKey] = [for (final asset in assets) asset.toJson()]; + // TODO: Bump min-SDK constraint to 3.7 and remove once stable. + json[_buildModeConfigKeyDeprecated] = 'release'; + } + + void setupLinkRunConfig({ + required Uri outputDirectory, + required Uri outputDirectoryShared, + required Uri? recordedUsesFile, + }) { + json[_outDirConfigKey] = outputDirectory.toFilePath(); + json[_outDirSharedConfigKey] = outputDirectoryShared.toFilePath(); + if (recordedUsesFile != null) { + json[_recordedUsagesFileConfigKey] = recordedUsesFile.toFilePath(); + } + } +} + +List _parseAssets(List? object) => object == null + ? [] + : [ + for (int i = 0; i < object.length; ++i) + EncodedAsset.fromJson(object.mapAt(i)), + ]; + +const _recordedUsagesFileConfigKey = 'resource_identifiers'; +const _assetsKey = 'assets'; +const _versionKey = 'version'; + +sealed class HookOutput { + /// The underlying json configuration of this [HookOutput]. + final Map json; + + /// The version of the [HookConfig]. + final Version version; + + /// Start time for the build of this output. + /// + /// The [timestamp] is rounded down to whole seconds, because + /// [File.lastModified] is rounded to whole seconds and caching logic compares + /// these timestamps. + final DateTime timestamp; + + /// The files used by this build. + /// + /// If any of the files in [dependencies] are modified after [timestamp], the + /// build will be re-run. + /// + /// The (transitive) Dart sources do not have to be added to these + /// dependencies, only non-Dart files. (Note that old Dart and Flutter SDKs + /// do not automatically add the Dart sources. So builds get wrongly cached, + /// try updating to the latest release.) + final List dependencies; + + HookOutput(this.json) + : version = switch (Version.parse(json.string(_versionKey))) { + final Version version => (version.major != latestVersion.major || + version < latestVersion) + ? throw FormatException( + 'Only compatible versions with $latestVersion are supported ' + '(was: $version).') + : version, + }, + timestamp = DateTime.parse(json.string(_timestampKey)), + dependencies = _parseDependencies(json.optionalList(_dependenciesKey)); + + @override + String toString() => const JsonEncoder.withIndent(' ').convert(json); + + /// The version of [HookOutput]. + static final Version latestVersion = Version(1, 6, 0); +} + +List _parseDependencies(List? list) { + if (list == null) return const []; + return [ + for (int i = 0; i < list.length; ++i) list.pathAt(i), + ]; +} + +const String _timestampKey = 'timestamp'; +const String _dependenciesKey = 'dependencies'; + +sealed class HookOutputBuilder { + final Map json = {}; + + HookOutputBuilder() { + json[_versionKey] = HookOutput.latestVersion.toString(); + json[_timestampKey] = DateTime.now().roundDownToSeconds().toString(); + json[_dependenciesKey] = []; + } + + /// Adds file used by this build. + /// + /// If any of the files are modified after [BuildOutput.timestamp], the + // build will be re-run. + void addDependency(Uri uri) { + final dependencies = json[_dependenciesKey] as List; + dependencies.add(uri.toFilePath()); + } + + /// Adds files used by this build. + /// + /// If any of the files are modified after [BuildOutput.timestamp], the + // build will be re-run. + void addDependencies(Iterable uris) { + final dependencies = json[_dependenciesKey] as List; + dependencies.addAll(uris.map((uri) => uri.toFilePath())); + } +} + +class BuildOutput extends HookOutput { + /// The assets produced by this build. + /// + /// In dry runs, the assets for all [Architecture]s for the [OS] specified in + /// the dry run must be provided. + final List encodedAssets; + + /// The assets produced by this build which should be linked. + /// + /// Every key in the map is a package name. These assets in the values are not + /// bundled with the application, but are sent to the link hook of the package + /// specified in the key, which can decide if they are bundled or not. + /// + /// In dry runs, the assets for all [Architecture]s for the [OS] specified in + /// the dry run must be provided. + final Map> encodedAssetsForLinking; + + /// Metadata passed to dependent build hook invocations. + final Metadata metadata; + + /// Creates a [BuildOutput] from the given [json]. + BuildOutput(super.json) + : encodedAssets = _parseEncodedAssets(json.optionalList(_assetsKey)), + encodedAssetsForLinking = { + for (final MapEntry(:key, :value) + in (json.optionalMap(_assetsForLinkingKey) ?? {}).entries) + key: _parseEncodedAssets(value as List), + }, + metadata = + Metadata.fromJson(json.optionalMap(_metadataConfigKey) ?? {}); +} + +List _parseEncodedAssets(List? json) => json == null + ? const [] + : [ + for (int i = 0; i < json.length; ++i) + EncodedAsset.fromJson(json.mapAt(i)), + ]; + +const _assetsForLinkingKey = 'assetsForLinking'; +const _dependencyMetadataKey = 'dependency_metadata'; + +/// Builder to produce the output of a build hook. +/// +/// There are various Dart extensions on this [BuildOutputBuilder] that allow +/// adding specific asset types - which should be used by normal hook authors. +/// For example +/// +/// ```dart +/// main(List arguments) async { +/// await build((config, output) { +/// output.codeAssets.add(CodeAsset(...)); +/// output.dataAssets.add(DataAsset(...)); +/// }); +/// } +/// ``` +class BuildOutputBuilder extends HookOutputBuilder { + /// Adds metadata to be passed to build hook invocations of dependent + /// packages. + @Deprecated(metadataDeprecation) + void addMetadatum(String key, Object value) { + var map = json[_metadataConfigKey] as Map?; + map ??= json[_metadataConfigKey] = {}; + map[key] = value; + } + + /// Adds metadata to be passed to build hook invocations of dependent + /// packages. + @Deprecated(metadataDeprecation) + void addMetadata(Map metadata) { + var map = json[_metadataConfigKey] as Map?; + map ??= json[_metadataConfigKey] = {}; + map.addAll(metadata); + } +} + +/// Extension for the lower-level API to add [EncodedAsset]s to +/// [BuildOutputBuilder]. +extension EncodedAssetBuildOutputBuilder on BuildOutputBuilder { + /// Adds [EncodedAsset]s produced by this build or dry run. + /// + /// If the [linkInPackage] argument is specified, the asset will not be + /// bundled during the build step, but sent as input to the link hook of the + /// specified package, where it can be further processed and possibly bundled. + /// + /// Note to hook writers. Prefer using the `.add` method on the extension for + /// the specific asset type being added: + /// + /// ```dart + /// main(List arguments) async { + /// await build((config, output) { + /// output.codeAssets.add(CodeAsset(...)); + /// output.dataAssets.add(DataAsset(...)); + /// }); + /// } + /// ``` + void addEncodedAsset(EncodedAsset asset, {String? linkInPackage}) { + final list = _getEncodedAssetsList(json, linkInPackage); + list.add(asset.toJson()); + } + + /// Adds [EncodedAsset]s produced by this build or dry run. + /// + /// If the [linkInPackage] argument is specified, the assets will not be + /// bundled during the build step, but sent as input to the link hook of the + /// specified package, where they can be further processed and possibly + /// bundled. + /// + /// Note to hook writers. Prefer using the `.addAll` method on the extension + /// for the specific asset type being added: + /// + /// ```dart + /// main(List arguments) async { + /// await build((config, output) { + /// output.codeAssets.addAll([CodeAsset(...), ...]); + /// output.dataAssets.addAll([DataAsset(...), ...]); + /// }); + /// } + /// ``` + void addEncodedAssets(Iterable assets, + {String? linkInPackage}) { + final list = _getEncodedAssetsList(json, linkInPackage); + for (final asset in assets) { + list.add(asset.toJson()); + } + } +} + +List _getEncodedAssetsList( + Map json, String? linkInPackage) { + if (linkInPackage == null) { + var list = json[_assetsKey] as List?; + list ??= json[_assetsKey] = >[]; + return list; + } + var map = json[_assetsForLinkingKey] as Map?; + map ??= json[_assetsForLinkingKey] = {}; + + var list = map[linkInPackage] as List?; + list ??= map[linkInPackage] = >[]; + return list; +} + +class LinkOutput extends HookOutput { + /// The assets produced by this build. + /// + /// In dry runs, the assets for all [Architecture]s for the [OS] specified in + /// the dry run must be provided. + final List encodedAssets; + + /// Creates a [BuildOutput] from the given [json]. + LinkOutput(super.json) + : encodedAssets = _parseEncodedAssets(json.optionalList(_assetsKey)); +} + +/// Builder to produce the output of a link hook. +/// +/// There are various Dart extensions on this [LinkOutputBuilder] that allow +/// adding specific asset types - which should be used by normal hook authors. +/// For example +/// +/// ```dart +/// main(List arguments) async { +/// await build((config, output) { +/// output.codeAssets.add(CodeAsset(...)); +/// output.dataAssets.add(DataAsset(...)); +/// }); +/// } +/// ``` +class LinkOutputBuilder extends HookOutputBuilder {} + +/// Extension for the lower-level API to add [EncodedAsset]s to +/// [BuildOutputBuilder]. +extension EncodedAssetLinkOutputBuilder on LinkOutputBuilder { + /// Adds [EncodedAsset]s produced by this build. + /// + /// Note to hook writers. Prefer using the `.add` method on the extension for + /// the specific asset type being added: + /// + /// ```dart + /// main(List arguments) async { + /// await build((config, output) { + /// output.codeAssets.add(CodeAsset(...)); + /// output.dataAssets.add(DataAsset(...)); + /// }); + /// } + /// ``` + void addEncodedAsset(EncodedAsset asset) { + var list = json[_assetsKey] as List?; + list ??= json[_assetsKey] = >[]; + list.add(asset.toJson()); + } + + /// Adds [EncodedAsset]s produced by this build. + /// + /// Note to hook writers. Prefer using the `.addAll` method on the extension + /// for the specific asset type being added: + /// + /// ```dart + /// main(List arguments) async { + /// await build((config, output) { + /// output.codeAssets.addAll([CodeAsset(...), ...]); + /// output.dataAssets.addAll([DataAsset(...), ...]); + /// }); + /// } + /// ``` + void addEncodedAssets(Iterable assets) { + var list = json[_assetsKey] as List?; + list ??= json[_assetsKey] = >[]; + for (final asset in assets) { + list.add(asset.toJson()); + } + } +} + +// The latest supported config version. +final latestVersion = Version(1, 6, 0); + +// The parser can deal with configs down to this version. +final latestParsableVersion = Version(1, 5, 0); diff --git a/pkgs/native_assets_cli/lib/src/data_assets/config.dart b/pkgs/native_assets_cli/lib/src/data_assets/config.dart new file mode 100644 index 000000000..5c5433810 --- /dev/null +++ b/pkgs/native_assets_cli/lib/src/data_assets/config.dart @@ -0,0 +1,77 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../config.dart'; + +import 'data_asset.dart'; + +/// Link output extension for data assets. +extension DataAssetLinkConfig on LinkConfig { + // Returns the data assets that were sent to this linker. + // + // NOTE: If the linker implementation depends on the contents of the files of + // the data assets (e.g. by transforming them, merging with other files, etc) + // then the linker script has to add those files as dependencies via + // [LinkOutput.addDependency] to ensure the linker script will be re-run if + // the content of the files changes. + Iterable get dataAssets => encodedAssets + .where((e) => e.type == DataAsset.type) + .map(DataAsset.fromEncoded); +} + +/// Build output extension for data assets. +extension DataAssetBuildOutputBuilder on BuildOutputBuilder { + /// Provides access to emitting data assets. + DataAssetBuildOutputBuilderAdd get dataAssets => + DataAssetBuildOutputBuilderAdd._(this); +} + +/// Supports emitting code assets for build hooks. +extension type DataAssetBuildOutputBuilderAdd._(BuildOutputBuilder _output) { + /// Adds the given [asset] to the hook output (or send to [linkInPackage] + /// for linking if provided). + void add(DataAsset asset, {String? linkInPackage}) => + _output.addEncodedAsset(asset.encode(), linkInPackage: linkInPackage); + + /// Adds the given [assets] to the hook output (or send to [linkInPackage] + /// for linking if provided). + void addAll(Iterable assets, {String? linkInPackage}) { + for (final asset in assets) { + add(asset, linkInPackage: linkInPackage); + } + } +} + +/// Extension to the [LinkOutputBuilder] providing access to emitting data +/// assets (only available if data assets are supported). +extension DataAssetLinkOutputBuilder on LinkOutputBuilder { + /// Provides access to emitting data assets. + DataAssetLinkOutputBuilderAdd get dataAssets => + DataAssetLinkOutputBuilderAdd(this); +} + +/// Extension on [LinkOutputBuilder] to emit data assets. +extension type DataAssetLinkOutputBuilderAdd(LinkOutputBuilder _output) { + /// Adds the given [asset] to the link hook output. + void add(DataAsset asset) => _output.addEncodedAsset(asset.encode()); + + /// Adds the given [assets] to the link hook output. + void addAll(Iterable assets) => assets.forEach(add); +} + +/// Provides access to [DataAsset]s from a build hook output. +extension DataAssetBuildOutput on BuildOutput { + List get dataAssets => encodedAssets + .where((asset) => asset.type == DataAsset.type) + .map(DataAsset.fromEncoded) + .toList(); +} + +/// Provides access to [DataAsset]s from a link hook output. +extension DataAssetLinkOutput on LinkOutput { + List get dataAssets => encodedAssets + .where((asset) => asset.type == DataAsset.type) + .map(DataAsset.fromEncoded) + .toList(); +} diff --git a/pkgs/native_assets_cli/lib/src/data_assets/data_asset.dart b/pkgs/native_assets_cli/lib/src/data_assets/data_asset.dart index 9c79b0629..5043ad25f 100644 --- a/pkgs/native_assets_cli/lib/src/data_assets/data_asset.dart +++ b/pkgs/native_assets_cli/lib/src/data_assets/data_asset.dart @@ -2,9 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../api/build_config.dart'; -import '../api/build_output.dart'; -import '../api/link_config.dart'; import '../encoded_asset.dart'; import '../json_utils.dart'; import '../utils/map.dart'; @@ -20,8 +17,6 @@ import '../utils/map.dart'; final class DataAsset { /// The file to be bundled with the Dart or Flutter application. /// - /// The file can be omitted in the [BuildOutput] for [BuildConfig.dryRun]. - /// /// The file can also be omitted for asset types which refer to an asset /// already present on the target system or an asset already present in Dart /// or Flutter. @@ -92,59 +87,6 @@ final class DataAsset { static const String type = 'data'; } -/// Build output extension for data assets. -extension DataAssetsBuildOutput on BuildOutput { - BuildOutputDataAssets get dataAssets => BuildOutputDataAssets(this); -} - -extension type BuildOutputDataAssets(BuildOutput _output) { - void add(DataAsset asset, {String? linkInPackage}) => - _output.addEncodedAsset(asset.encode(), linkInPackage: linkInPackage); - - void addAll(Iterable assets, {String? linkInPackage}) { - for (final asset in assets) { - add(asset, linkInPackage: linkInPackage); - } - } - - Iterable get all => _output.encodedAssets - .where((e) => e.type == DataAsset.type) - .map(DataAsset.fromEncoded); -} - -/// Link output extension for data assets. -extension DataAssetsLinkConfig on LinkConfig { - LinkConfigDataAssets get dataAssets => LinkConfigDataAssets(this); -} - -extension type LinkConfigDataAssets(LinkConfig _config) { - // Returns the data assets that were sent to this linker. - // - // NOTE: If the linker implementation depends on the contents of the files of - // the data assets (e.g. by transforming them, merging with other files, etc) - // then the linker script has to add those files as dependencies via - // [LinkOutput.addDependency] to ensure the linker script will be re-run if - // the content of the files changes. - Iterable get all => _config.encodedAssets - .where((e) => e.type == DataAsset.type) - .map(DataAsset.fromEncoded); -} - -/// Link output extension for data assets. -extension DataAssetsLinkOutput on LinkOutput { - LinkOutputDataAssets get dataAssets => LinkOutputDataAssets(this); -} - -extension type LinkOutputDataAssets(LinkOutput _output) { - void add(DataAsset asset) => _output.addEncodedAsset(asset.encode()); - - void addAll(Iterable assets) => assets.forEach(add); - - Iterable get all => _output.encodedAssets - .where((e) => e.type == DataAsset.type) - .map(DataAsset.fromEncoded); -} - const _nameKey = 'name'; const _packageKey = 'package'; const _fileKey = 'file'; diff --git a/pkgs/native_assets_cli/lib/src/data_assets/validation.dart b/pkgs/native_assets_cli/lib/src/data_assets/validation.dart index d6dd9de36..8b575a8ef 100644 --- a/pkgs/native_assets_cli/lib/src/data_assets/validation.dart +++ b/pkgs/native_assets_cli/lib/src/data_assets/validation.dart @@ -4,33 +4,55 @@ import 'dart:io'; -import '../../native_assets_cli_internal.dart'; +import '../../data_assets_builder.dart'; + +Future validateDataAssetBuildConfig( + BuildConfig config) async => + const []; + +Future validateDataAssetLinkConfig(LinkConfig config) async { + final errors = []; + for (final asset in config.dataAssets) { + if (!File.fromUri(asset.file).existsSync()) { + errors.add('LinkConfig.dataAssets contained asset ${asset.id} with file ' + '(${asset.file}) which does not exist.'); + } + } + return errors; +} Future validateDataAssetBuildOutput( - HookConfig config, + BuildConfig config, BuildOutput output, ) => - _validateDataAssetBuildOrLinkOutput(config, output as HookOutputImpl, true); + _validateDataAssetBuildOrLinkOutput( + config, + output.encodedAssets, + // ignore: deprecated_member_use_from_same_package + config.dryRun, + true, + ); Future validateDataAssetLinkOutput( - HookConfig config, + LinkConfig config, LinkOutput output, ) => _validateDataAssetBuildOrLinkOutput( - config, output as HookOutputImpl, false); + config, output.encodedAssets, false, false); Future _validateDataAssetBuildOrLinkOutput( HookConfig config, - HookOutputImpl output, + List encodedAssets, + bool dryRun, bool isBuild, ) async { final errors = []; final ids = {}; - for (final asset in output.encodedAssets) { + for (final asset in encodedAssets) { if (asset.type != DataAsset.type) continue; - _validateDataAssets(config, config.dryRun, DataAsset.fromEncoded(asset), - errors, ids, isBuild); + _validateDataAssets( + config, dryRun, DataAsset.fromEncoded(asset), errors, ids, isBuild); } return errors; } diff --git a/pkgs/native_assets_cli/lib/src/json_utils.dart b/pkgs/native_assets_cli/lib/src/json_utils.dart index 1680a1247..8c79c527d 100644 --- a/pkgs/native_assets_cli/lib/src/json_utils.dart +++ b/pkgs/native_assets_cli/lib/src/json_utils.dart @@ -22,17 +22,12 @@ extension MapJsonUtils on Map { core.int int(String key) => get(key); core.int? optionalInt(String key) => getOptional(key); - Uri path(String key, {bool mustExist = false}) => - _fileSystemPathToUri(get(key)); + Uri path(String key) => _fileSystemPathToUri(get(key)); - Uri? optionalPath(String key, {bool mustExist = false}) { + Uri? optionalPath(String key) { final value = getOptional(key); if (value == null) return null; - final uri = _fileSystemPathToUri(value); - if (mustExist) { - _throwIfNotExists(key, uri); - } - return uri; + return _fileSystemPathToUri(value); } List? optionalStringList(String key) { @@ -82,22 +77,7 @@ extension ListJsonUtils on List { } Map mapAt(int index) => get>(index); -} - -void _throwIfNotExists(String key, Uri value) { - final fileSystemEntity = value.fileSystemEntity; - if (!fileSystemEntity.existsSync()) { - throw FormatException("Path '$value' for key '$key' doesn't exist."); - } -} - -extension on Uri { - FileSystemEntity get fileSystemEntity { - if (path.endsWith(Platform.pathSeparator) || path.endsWith('/')) { - return Directory.fromUri(this); - } - return File.fromUri(this); - } + Uri pathAt(int index) => _fileSystemPathToUri(get(index)); } Uri _fileSystemPathToUri(String path) { diff --git a/pkgs/native_assets_cli/lib/src/model/metadata.dart b/pkgs/native_assets_cli/lib/src/metadata.dart similarity index 93% rename from pkgs/native_assets_cli/lib/src/model/metadata.dart rename to pkgs/native_assets_cli/lib/src/metadata.dart index 0a492b98f..e9dc00128 100644 --- a/pkgs/native_assets_cli/lib/src/model/metadata.dart +++ b/pkgs/native_assets_cli/lib/src/metadata.dart @@ -4,8 +4,8 @@ import 'package:collection/collection.dart'; -import '../utils/json.dart'; -import '../utils/map.dart'; +import 'utils/json.dart'; +import 'utils/map.dart'; class Metadata { final Map metadata; diff --git a/pkgs/native_assets_cli/lib/src/model/build_config.dart b/pkgs/native_assets_cli/lib/src/model/build_config.dart deleted file mode 100644 index 01b3ca7ce..000000000 --- a/pkgs/native_assets_cli/lib/src/model/build_config.dart +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -part of '../api/build_config.dart'; - -final class BuildConfigImpl extends HookConfigImpl implements BuildConfig { - @override - Hook get hook => Hook.build; - - @override - //TODO: Should be removed once migration to `hook/` is complete. - Uri get script { - final hookScript = packageRoot.resolve('hook/').resolve(hook.scriptName); - if (File.fromUri(hookScript).existsSync()) { - return hookScript; - } else { - return packageRoot.resolve(hook.scriptName); - } - } - - @override - String get outputName => 'build_output.json'; - - @override - Object? metadatum(String packageName, String key) { - HookConfigImpl.ensureNotDryRun(dryRun); - return _dependencyMetadata?[packageName]?.metadata[key]; - } - - final Map? _dependencyMetadata; - - @override - bool get linkingEnabled { - if (version == Version(1, 3, 0)) { - return true; - } - return _linkingEnabled as bool; - } - - final bool? _linkingEnabled; - - BuildConfigImpl({ - required super.outputDirectory, - required super.outputDirectoryShared, - required super.packageName, - required super.packageRoot, - Version? version, - super.buildMode, - super.cCompiler, - required super.supportedAssetTypes, - super.targetAndroidNdkApi, - required super.targetArchitecture, - super.targetIOSSdk, - super.targetIOSVersion, - super.targetMacOSVersion, - required super.targetOS, - required super.linkModePreference, - Map? dependencyMetadata, - required bool? linkingEnabled, - super.dryRun, - }) : _dependencyMetadata = dependencyMetadata, - _linkingEnabled = linkingEnabled, - super( - hook: Hook.build, - version: version ?? HookConfigImpl.latestVersion, - ) { - if (this.version < Version(1, 4, 0)) { - assert(linkingEnabled == null); - } else { - assert(linkingEnabled != null); - } - } - - BuildConfigImpl.dryRun({ - required super.outputDirectory, - required super.outputDirectoryShared, - required super.packageName, - required super.packageRoot, - required super.targetOS, - required super.linkModePreference, - required bool? linkingEnabled, - required super.supportedAssetTypes, - }) : _dependencyMetadata = null, - _linkingEnabled = linkingEnabled, - super.dryRun( - hook: Hook.build, - version: HookConfigImpl.latestVersion, - ); - - static BuildConfigImpl fromArguments( - List arguments, { - Map? environment, - Uri? workingDirectory, - }) { - final configPath = getConfigArgument(arguments); - final bytes = File(configPath).readAsBytesSync(); - final linkConfigJson = const Utf8Decoder() - .fuse(const JsonDecoder()) - .convert(bytes) as Map; - return fromJson(linkConfigJson); - } - - static const dependencyMetadataConfigKey = 'dependency_metadata'; - - static const linkingEnabledKey = 'linking_enabled'; - - static BuildConfigImpl fromJson(Map config) { - final dryRun = HookConfigImpl.parseDryRun(config) ?? false; - final targetOS = HookConfigImpl.parseTargetOS(config); - return BuildConfigImpl( - outputDirectory: HookConfigImpl.parseOutDir(config), - outputDirectoryShared: HookConfigImpl.parseOutDirShared(config), - packageName: HookConfigImpl.parsePackageName(config), - packageRoot: HookConfigImpl.parsePackageRoot(config), - buildMode: HookConfigImpl.parseBuildMode(config, dryRun), - targetOS: targetOS, - targetArchitecture: - HookConfigImpl.parseTargetArchitecture(config, dryRun, targetOS), - linkModePreference: HookConfigImpl.parseLinkModePreference(config), - dependencyMetadata: parseDependencyMetadata(config), - linkingEnabled: parseHasLinkPhase(config), - version: HookConfigImpl.parseVersion(config), - cCompiler: HookConfigImpl.parseCCompiler(config, dryRun), - supportedAssetTypes: - HookConfigImpl.parseSupportedEncodedAssetTypes(config), - targetAndroidNdkApi: - HookConfigImpl.parseTargetAndroidNdkApi(config, dryRun, targetOS), - targetIOSSdk: HookConfigImpl.parseTargetIOSSdk(config, dryRun, targetOS), - targetIOSVersion: - HookConfigImpl.parseTargetIosVersion(config, dryRun, targetOS), - targetMacOSVersion: - HookConfigImpl.parseTargetMacOSVersion(config, dryRun, targetOS), - dryRun: dryRun, - ); - } - - static Map? parseDependencyMetadata( - Map config) { - final fileValue = config.optionalMap(dependencyMetadataConfigKey); - if (fileValue == null) { - return null; - } - return fileValue - .map((key, defines) => MapEntry(as(key), defines)) - .map( - (packageName, defines) { - if (defines is! Map) { - throw FormatException("Unexpected value '$defines' for key " - "'$dependencyMetadataConfigKey.$packageName' in config file. " - 'Expected a Map.'); - } - return MapEntry( - packageName, - Metadata(defines - .map((key, value) => MapEntry(as(key), as(value))) - .sortOnKey()), - ); - }, - ).sortOnKey(); - } - - static bool? parseHasLinkPhase(Map config) => - config.optionalBool(linkingEnabledKey); - - @override - Map toJson() => { - ...hookToJson(), - if (!dryRun) ...{ - if (_dependencyMetadata != null && _dependencyMetadata.isNotEmpty) - dependencyMetadataConfigKey: _dependencyMetadata.map( - (packageName, metadata) => - MapEntry(packageName, metadata.toJson()), - ), - }, - if (version >= Version(1, 4, 0)) linkingEnabledKey: linkingEnabled, - }.sortOnKey(); - - @override - bool operator ==(Object other) { - if (super != other) { - return false; - } - if (other is! BuildConfigImpl) { - return false; - } - if (!dryRun && - !const DeepCollectionEquality() - .equals(other._dependencyMetadata, _dependencyMetadata)) { - return false; - } - if (_linkingEnabled != other._linkingEnabled) { - return false; - } - return true; - } - - @override - int get hashCode => Object.hashAll([ - super.hashCode, - linkModePreference, - linkingEnabled, - if (!dryRun) ...[ - const DeepCollectionEquality().hash(_dependencyMetadata), - ], - ]); - - @override - String toString() => 'BuildConfig(${toJson()})'; -} diff --git a/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md b/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md index f3126361e..c460ecc8a 100644 --- a/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md +++ b/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md @@ -1,9 +1,25 @@ ## 1.6.0 +- `BuildConfig.supportedAssetTypes` renamed to `BuildConfig.buildAssetTypes`. + Compatibility with older SDKs: Look for the old key. Compatibility with older + hooks: Also provide the old hook in the config. +- `BuildConfig.targetOS` is now only provided if `buildAssetTypes` contains the + code asset. + Compatibility with older SDKs: Fine, they always provide it. + Compatibility with older hooks: Currently, no embedders call hooks without + support for code assets. Once they do (data assets on web), existing hooks + will break. Mitigation: Update existing hooks to check for `buildAssetTypes` + and/or change `CBuilder` to be a no-op if `buildAssetTypes` does not contain + code assets. - `BuildConfig.outputDirectoryShared` for sharing between hook invocations. Compatibility with older SDKs: Create a sibling dir next to the output directory. This does not facilitate caching, but should not break the hook. Compatibility with older hooks: These will not read this field. +- `BuildConfig.buildMode` is removed. Instead it is specified by hook writers + in the `CBuilder` constructors. + Compatibility with older SDKs: The new hooks will not read the field. + Compatibility with older hooks: The field is now always passed as 'release' + until we can bump the SDK constraint in `package:native_assets_cli`. ## 1.5.0 diff --git a/pkgs/native_assets_cli/lib/src/model/hook.dart b/pkgs/native_assets_cli/lib/src/model/hook.dart index a7f3d56f3..abb69213a 100644 --- a/pkgs/native_assets_cli/lib/src/model/hook.dart +++ b/pkgs/native_assets_cli/lib/src/model/hook.dart @@ -12,7 +12,9 @@ enum Hook { final String _scriptName; + const Hook(this._scriptName); + String get scriptName => '$_scriptName.dart'; - const Hook(this._scriptName); + String get outputName => '${_scriptName}_output.json'; } diff --git a/pkgs/native_assets_cli/lib/src/model/hook_config.dart b/pkgs/native_assets_cli/lib/src/model/hook_config.dart deleted file mode 100644 index e209ab38c..000000000 --- a/pkgs/native_assets_cli/lib/src/model/hook_config.dart +++ /dev/null @@ -1,548 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -part of '../api/hook_config.dart'; - -abstract class HookConfigImpl implements HookConfig { - final Hook hook; - - @override - final Uri outputDirectory; - - @override - final Uri outputDirectoryShared; - - @override - final String packageName; - - @override - final Uri packageRoot; - - final Version version; - - final BuildMode? _buildMode; - - @override - BuildMode get buildMode { - ensureNotDryRun(dryRun); - return _buildMode!; - } - - final CCompilerConfig _cCompiler; - - @override - CCompilerConfig get cCompiler { - ensureNotDryRun(dryRun); - return _cCompiler; - } - - @override - final bool dryRun; - - @override - final Iterable supportedAssetTypes; - - final int? _targetAndroidNdkApi; - - @override - final LinkModePreference linkModePreference; - - @override - int? get targetAndroidNdkApi { - ensureNotDryRun(dryRun); - return _targetAndroidNdkApi; - } - - @override - final Architecture? targetArchitecture; - - final IOSSdk? _targetIOSSdk; - - @override - IOSSdk? get targetIOSSdk { - ensureNotDryRun(dryRun); - if (targetOS != OS.iOS) { - throw StateError( - 'This field is not available in if targetOS is not OS.iOS.', - ); - } - return _targetIOSSdk; - } - - final int? _targetIOSVersion; - - @override - int? get targetIOSVersion { - ensureNotDryRun(dryRun); - if (targetOS != OS.iOS) { - throw StateError( - 'This field is not available in if targetOS is not OS.iOS.', - ); - } - return _targetIOSVersion; - } - - final int? _targetMacOSVersion; - - @override - int? get targetMacOSVersion { - ensureNotDryRun(dryRun); - if (targetOS != OS.macOS) { - throw StateError( - 'This field is not available in if targetOS is not OS.macOS.', - ); - } - return _targetMacOSVersion; - } - - @override - final OS targetOS; - - /// Output file name based on the protocol version. - /// - /// Makes newer build hooks work with older Dart SDKs. - String get outputName; - - HookConfigImpl({ - required this.hook, - required this.outputDirectory, - required this.outputDirectoryShared, - required this.packageName, - required this.packageRoot, - required this.version, - required BuildMode? buildMode, - required CCompilerConfig? cCompiler, - required this.supportedAssetTypes, - required int? targetAndroidNdkApi, - required this.targetArchitecture, - required IOSSdk? targetIOSSdk, - required int? targetIOSVersion, - required int? targetMacOSVersion, - required this.linkModePreference, - required this.targetOS, - bool? dryRun, - }) : _targetAndroidNdkApi = targetAndroidNdkApi, - _targetIOSSdk = targetIOSSdk, - _targetIOSVersion = targetIOSVersion, - _targetMacOSVersion = targetMacOSVersion, - _buildMode = buildMode, - _cCompiler = cCompiler ?? CCompilerConfig(), - dryRun = dryRun ?? false; - - HookConfigImpl.dryRun({ - required this.hook, - required this.outputDirectory, - required this.outputDirectoryShared, - required this.packageName, - required this.packageRoot, - required this.version, - required this.supportedAssetTypes, - required this.linkModePreference, - required this.targetOS, - }) : _cCompiler = CCompilerConfig(), - dryRun = true, - targetArchitecture = null, - _buildMode = null, - _targetAndroidNdkApi = null, - _targetIOSSdk = null, - _targetIOSVersion = null, - _targetMacOSVersion = null; - - Uri get outputFile => outputDirectory.resolve(outputName); - - // This is currently overriden by [BuildConfig], do account for older versions - // still using a top-level build.dart. - Uri get script => packageRoot.resolve('hook/').resolve(hook.scriptName); - - String toJsonString() => const JsonEncoder.withIndent(' ').convert(toJson()); - - static const outDirConfigKey = 'out_dir'; - static const outDirSharedConfigKey = 'out_dir_shared'; - static const packageNameConfigKey = 'package_name'; - static const packageRootConfigKey = 'package_root'; - static const _versionKey = 'version'; - static const targetAndroidNdkApiConfigKey = 'target_android_ndk_api'; - static const targetIOSVersionConfigKey = 'target_ios_version'; - static const targetMacOSVersionConfigKey = 'target_macos_version'; - static const dryRunConfigKey = 'dry_run'; - static const supportedAssetTypesKey = 'supported_asset_types'; - - Map toJson(); - - Map hookToJson() { - late Map cCompilerJson; - if (!dryRun) { - cCompilerJson = cCompiler.toJson(); - } - - return { - outDirConfigKey: outputDirectory.toFilePath(), - outDirSharedConfigKey: outputDirectoryShared.toFilePath(), - packageNameConfigKey: packageName, - packageRootConfigKey: packageRoot.toFilePath(), - _targetOSConfigKey: targetOS.toString(), - supportedAssetTypesKey: supportedAssetTypes, - _versionKey: version.toString(), - if (dryRun) dryRunConfigKey: dryRun, - if (!dryRun) ...{ - _buildModeConfigKey: buildMode.toString(), - _targetArchitectureKey: targetArchitecture.toString(), - if (targetOS == OS.iOS && targetIOSSdk != null) - _targetIOSSdkConfigKey: targetIOSSdk.toString(), - if (targetOS == OS.iOS && targetIOSVersion != null) - targetIOSVersionConfigKey: targetIOSVersion!, - if (targetOS == OS.macOS && targetMacOSVersion != null) - targetMacOSVersionConfigKey: targetMacOSVersion!, - if (targetAndroidNdkApi != null) - targetAndroidNdkApiConfigKey: targetAndroidNdkApi!, - if (cCompilerJson.isNotEmpty) _compilerConfigKey: cCompilerJson, - }, - _linkModePreferenceConfigKey: linkModePreference.toString(), - }.sortOnKey(); - } - - static Version parseVersion(Map config) { - final version = Version.parse(config.string('version')); - if (version.major > latestVersion.major) { - throw FormatException( - 'The config version $version is newer than this ' - 'package:native_assets_cli config version $latestVersion, ' - 'please update native_assets_cli.', - ); - } - if (version.major < latestVersion.major) { - throw FormatException( - 'The config version $version is newer than this ' - 'package:native_assets_cli config version $latestVersion, ' - 'please update the Dart or Flutter SDK.', - ); - } - return version; - } - - static bool? parseDryRun(Map config) => - config.optionalBool(dryRunConfigKey); - - static Uri parseOutDir(Map config) => - config.path(outDirConfigKey, mustExist: true); - - static Uri parseOutDirShared(Map config) { - final configResult = - config.optionalPath(outDirSharedConfigKey, mustExist: true); - if (configResult != null) { - return configResult; - } - // Backwards compatibility, create a directory next to the output dir. - // This is will not be shared so caching doesn't work, but it will make - // the newer hooks not crash. - final outDir = config.path(outDirConfigKey); - final outDirShared = outDir.resolve('../out_shared/'); - Directory.fromUri(outDirShared).createSync(); - return outDirShared; - } - - static String parsePackageName(Map config) => - config.string(packageNameConfigKey); - - static Uri parsePackageRoot(Map config) => - config.path(packageRootConfigKey, mustExist: true); - - static BuildMode? parseBuildMode(Map config, bool dryRun) { - if (dryRun) { - _throwIfNotNullInDryRun(config, _buildModeConfigKey); - return null; - } else { - return BuildMode.fromString( - config.string( - _buildModeConfigKey, - validValues: BuildMode.values.map((e) => '$e'), - ), - ); - } - } - - static LinkModePreference parseLinkModePreference( - Map config) => - LinkModePreference.fromString( - config.string( - _linkModePreferenceConfigKey, - validValues: LinkModePreference.values.map((e) => '$e'), - ), - ); - - static OS parseTargetOS(Map config) => OS.fromString( - config.string( - _targetOSConfigKey, - validValues: OS.values.map((e) => '$e'), - ), - ); - - static Architecture? parseTargetArchitecture( - Map config, - bool dryRun, - OS? targetOS, - ) { - if (dryRun) { - _throwIfNotNullInDryRun(config, _targetArchitectureKey); - return null; - } else { - final validArchitectures = [ - if (targetOS == null) - ...Architecture.values - else - for (final target in Target.values) - if (target.os == targetOS) target.architecture - ]; - return Architecture.fromString( - config.string( - _targetArchitectureKey, - validValues: validArchitectures.map((e) => '$e'), - ), - ); - } - } - - static IOSSdk? parseTargetIOSSdk( - Map config, bool dryRun, OS? targetOS) { - if (dryRun) { - _throwIfNotNullInDryRun(config, _targetIOSSdkConfigKey); - return null; - } else { - return targetOS == OS.iOS - ? IOSSdk.fromString( - config.string( - _targetIOSSdkConfigKey, - validValues: IOSSdk.values.map((e) => '$e'), - ), - ) - : null; - } - } - - static int? parseTargetAndroidNdkApi( - Map config, - bool dryRun, - OS? targetOS, - ) { - if (dryRun) { - _throwIfNotNullInDryRun(config, targetAndroidNdkApiConfigKey); - return null; - } else { - return (targetOS == OS.android) - ? config.int(targetAndroidNdkApiConfigKey) - : null; - } - } - - static int? parseTargetIosVersion( - Map config, - bool dryRun, - OS? targetOS, - ) { - if (dryRun) { - _throwIfNotNullInDryRun(config, targetIOSVersionConfigKey); - return null; - } else { - return (targetOS == OS.iOS) - ? config.optionalInt(targetIOSVersionConfigKey) - : null; - } - } - - static int? parseTargetMacOSVersion( - Map config, - bool dryRun, - OS? targetOS, - ) { - if (dryRun) { - _throwIfNotNullInDryRun(config, targetMacOSVersionConfigKey); - return null; - } else { - return (targetOS == OS.macOS) - ? config.optionalInt(targetMacOSVersionConfigKey) - : null; - } - } - - static List parseSupportedEncodedAssetTypes( - Map config) => - config.optionalStringList(supportedAssetTypesKey) ?? []; - - static CCompilerConfig parseCCompiler( - Map config, bool dryRun) { - if (dryRun) { - _throwIfNotNullInDryRun(config, _compilerConfigKey); - } - - final cCompilerJson = - config.getOptional>(_compilerConfigKey); - if (cCompilerJson == null) return CCompilerConfig(); - - return CCompilerConfig.fromJson(cCompilerJson); - } - - static void _throwIfNotNullInDryRun( - Map config, String key) { - final object = config.getOptional(key); - if (object != null) { - throw const FormatException('''This field is not available in dry runs. -In Flutter projects, native builds are generated per OS which target multiple -architectures, build modes, etc. Therefore, the list of native assets produced -can _only_ depend on OS.'''); - } - } - - static void ensureNotDryRun(bool dryRun) { - if (dryRun) { - throw StateError('''This field is not available in dry runs. -In Flutter projects, native builds are generated per OS which target multiple -architectures, build modes, etc. Therefore, the list of native assets produced -can _only_ depend on OS.'''); - } - } - - @override - bool operator ==(Object other) { - if (other is! HookConfigImpl) { - return false; - } - if (other.outputDirectory != outputDirectory) return false; - if (other.outputDirectoryShared != outputDirectoryShared) return false; - if (other.packageName != packageName) return false; - if (other.packageRoot != packageRoot) return false; - if (other.dryRun != dryRun) return false; - if (other.targetOS != targetOS) return false; - if (other.linkModePreference != linkModePreference) return false; - if (!const DeepCollectionEquality() - .equals(other.supportedAssetTypes, supportedAssetTypes)) { - return false; - } - if (!dryRun) { - if (other.buildMode != buildMode) return false; - if (other.targetArchitecture != targetArchitecture) return false; - if (targetOS == OS.iOS && other.targetIOSSdk != targetIOSSdk) { - return false; - } - if (other.targetAndroidNdkApi != targetAndroidNdkApi) return false; - if (other.cCompiler != cCompiler) return false; - } - return true; - } - - @override - int get hashCode => Object.hashAll([ - outputDirectory, - outputDirectoryShared, - packageName, - packageRoot, - targetOS, - dryRun, - if (!dryRun) ...[ - buildMode, - targetArchitecture, - if (targetOS == OS.iOS) targetIOSSdk, - targetAndroidNdkApi, - cCompiler, - ], - ]); - - /// Constructs a checksum for a [BuildConfigImpl] based on the fields of a - /// buildconfig that influence the build. - /// - /// This can be used for an [outputDirectory], but should not be used for - /// dry-runs. - /// - /// In particular, it only takes the package name from [packageRoot], so that - /// the hash is equal across checkouts and ignores [outputDirectory] itself. - static String checksum({ - required String packageName, - required Uri packageRoot, - required Architecture targetArchitecture, - required OS targetOS, - required BuildMode buildMode, - IOSSdk? targetIOSSdk, - int? targetAndroidNdkApi, - CCompilerConfig? cCompiler, - required LinkModePreference linkModePreference, - Map? dependencyMetadata, - required Iterable supportedAssetTypes, - Version? version, - required Hook hook, - required bool? linkingEnabled, - }) { - final input = [ - version ?? latestVersion, - packageName, - targetArchitecture.toString(), - targetOS.toString(), - targetIOSSdk.toString(), - targetAndroidNdkApi.toString(), - buildMode.toString(), - linkModePreference.toString(), - cCompiler?.archiver.toString(), - cCompiler?.compiler.toString(), - cCompiler?.envScript.toString(), - cCompiler?.envScriptArgs.toString(), - cCompiler?.linker.toString(), - if (dependencyMetadata != null) - for (final entry in dependencyMetadata.entries) ...[ - entry.key, - json.encode(entry.value.toJson()), - ], - ...supportedAssetTypes, - hook.name, - linkingEnabled, - ].join('###'); - final sha256String = sha256.convert(utf8.encode(input)).toString(); - // 256 bit hashes lead to 64 hex character strings. - // To avoid overflowing file paths limits, only use 32. - // Using 16 hex characters would also be unlikely to have collisions. - const nameLength = 32; - return sha256String.substring(0, nameLength); - } - - static String checksumDryRun({ - required String packageName, - required Uri packageRoot, - required OS targetOS, - required LinkModePreference linkModePreference, - Version? version, - Iterable? supportedAssetTypes, - required Hook hook, - required bool? linkingEnabled, - }) { - final input = [ - version ?? latestVersion, - packageName, - targetOS.toString(), - linkModePreference.toString(), - ...supportedAssetTypes ?? [CodeAsset.type], - hook.name, - linkingEnabled, - ].join('###'); - final sha256String = sha256.convert(utf8.encode(input)).toString(); - // 256 bit hashes lead to 64 hex character strings. - // To avoid overflowing file paths limits, only use 32. - // Using 16 hex characters would also be unlikely to have collisions. - const nameLength = 32; - return sha256String.substring(0, nameLength); - } - - /// The version of [HookConfigImpl]. - /// - /// This class is used in the protocol between the Dart and Flutter SDKs - /// and packages through build hook invocations. - /// - /// If we ever were to make breaking changes, it would be useful to give - /// proper error messages rather than just fail to parse the JSON - /// representation in the protocol. - static Version latestVersion = Version(1, 5, 0); -} - -const String _compilerConfigKey = 'c_compiler'; -const String _buildModeConfigKey = 'build_mode'; -const String _targetOSConfigKey = 'target_os'; -const String _targetArchitectureKey = 'target_architecture'; -const String _targetIOSSdkConfigKey = 'target_ios_sdk'; -const String _linkModePreferenceConfigKey = 'link_mode_preference'; diff --git a/pkgs/native_assets_cli/lib/src/model/hook_output.dart b/pkgs/native_assets_cli/lib/src/model/hook_output.dart deleted file mode 100644 index 0d48d9fb7..000000000 --- a/pkgs/native_assets_cli/lib/src/model/hook_output.dart +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -part of '../api/build_output.dart'; - -final class HookOutputImpl implements BuildOutput, LinkOutput { - @override - final DateTime timestamp; - - final List _assets; - - @override - Iterable get encodedAssets => _assets; - - final Map> _assetsForLinking; - - @override - Map> get encodedAssetsForLinking => - _assetsForLinking; - - final Dependencies _dependencies; - - Dependencies get dependenciesModel => _dependencies; - - @override - Iterable get dependencies => _dependencies.dependencies; - - final Metadata metadata; - - HookOutputImpl({ - DateTime? timestamp, - Iterable? encodedAssets, - Map>? encodedAssetsForLinking, - Dependencies? dependencies, - Metadata? metadata, - }) : timestamp = (timestamp ?? DateTime.now()).roundDownToSeconds(), - _assets = [ - ...?encodedAssets, - ], - _assetsForLinking = encodedAssetsForLinking ?? {}, - // ignore: prefer_const_constructors - _dependencies = dependencies ?? Dependencies([]), - // ignore: prefer_const_constructors - metadata = metadata ?? Metadata({}); - - @override - void addDependency(Uri dependency) => - _dependencies.dependencies.add(dependency); - - @override - void addDependencies(Iterable dependencies) => - _dependencies.dependencies.addAll(dependencies); - - static const _assetsKey = 'assets'; - static const _assetsForLinkingKey = 'assetsForLinking'; - static const _dependenciesKey = 'dependencies'; - static const _metadataKey = 'metadata'; - static const _timestampKey = 'timestamp'; - static const _versionKey = 'version'; - - factory HookOutputImpl.fromJsonString(String jsonString) { - final Object? json = jsonDecode(jsonString); - return HookOutputImpl.fromJson(as>(json)); - } - - factory HookOutputImpl.fromJson(Map jsonMap) { - final outputVersion = Version.parse(get(jsonMap, 'version')); - if (outputVersion.major > latestVersion.major) { - throw FormatException( - 'The output version $outputVersion is newer than the ' - 'package:native_assets_cli config version $latestVersion in Dart or ' - 'Flutter, please update the Dart or Flutter SDK.', - ); - } - if (outputVersion.major < latestVersion.major) { - throw FormatException( - 'The output version $outputVersion is newer than this ' - 'package:native_assets_cli config version $latestVersion in Dart or ' - 'Flutter, please update native_assets_cli.', - ); - } - return HookOutputImpl( - timestamp: DateTime.parse(get(jsonMap, _timestampKey)), - encodedAssets: [ - for (final json in jsonMap.optionalList(_assetsKey) ?? []) - EncodedAsset.fromJson(json as Map), - ], - encodedAssetsForLinking: { - for (final MapEntry(:key, :value) - in (get?>(jsonMap, _assetsForLinkingKey) ?? {}) - .entries) - key: [ - for (final json in value as List) - EncodedAsset.fromJson(json as Map), - ], - }, - dependencies: - Dependencies.fromJson(get?>(jsonMap, _dependenciesKey)), - metadata: - Metadata.fromJson(get?>(jsonMap, _metadataKey)), - ); - } - - Map toJson(Version version) => { - _timestampKey: timestamp.toString(), - if (_assets.isNotEmpty) - _assetsKey: [ - for (final asset in encodedAssets) asset.toJson(), - ], - if (_assetsForLinking.isNotEmpty) - _assetsForLinkingKey: { - for (final MapEntry(:key, :value) - in encodedAssetsForLinking.entries) - key: [for (final asset in value) asset.toJson()], - }, - if (_dependencies.dependencies.isNotEmpty) - _dependenciesKey: _dependencies.toJson(), - if (metadata.metadata.isNotEmpty) _metadataKey: metadata.toJson(), - _versionKey: version.toString(), - }..sortOnKey(); - - String toJsonString(Version version) => - const JsonEncoder.withIndent(' ').convert(toJson(version)); - - /// The version of [HookOutputImpl]. - /// - /// This class is used in the protocol between the Dart and Flutter SDKs and - /// packages through build hook invocations. - /// - /// If we ever were to make breaking changes, it would be useful to give - /// proper error messages rather than just fail to parse the JSON - /// representation in the protocol. - /// - /// [BuildOutput.latestVersion] is tied to [BuildConfig.latestVersion]. This - /// enables making the JSON serialization in build hooks dependent on the - /// version of the Dart or Flutter SDK. When there is a need to split the - /// versions of BuildConfig and BuildOutput, the BuildConfig should start - /// passing the highest supported version of BuildOutput. - static Version latestVersion = HookConfigImpl.latestVersion; - - /// Reads the JSON file from [file]. - static HookOutputImpl? readFromFile({required Uri file}) { - final buildOutputFile = File.fromUri(file); - if (buildOutputFile.existsSync()) { - return HookOutputImpl.fromJsonString(buildOutputFile.readAsStringSync()); - } - - return null; - } - - /// Writes the [toJsonString] to the output file specified in the [config]. - Future writeToFile({required HookConfigImpl config}) async { - final configVersion = config.version; - final jsonString = toJsonString(configVersion); - await File.fromUri(config.outputFile) - .writeAsStringCreateDirectory(jsonString); - } - - @override - String toString() => toJsonString(HookConfigImpl.latestVersion); - - @override - bool operator ==(Object other) { - if (other is! HookOutputImpl) { - return false; - } - return other.timestamp == timestamp && - const ListEquality().equals(other._assets, _assets) && - other._dependencies == _dependencies && - other.metadata == metadata; - } - - @override - int get hashCode => Object.hash( - timestamp.hashCode, - const ListEquality().hash(_assets), - _dependencies, - metadata, - ); - - @override - void addMetadatum(String key, Object value) { - metadata.metadata[key] = value; - } - - @override - void addMetadata(Map metadata) { - this.metadata.metadata.addAll(metadata); - } - - Metadata get metadataModel => metadata; - - @override - void addEncodedAsset(EncodedAsset asset, {String? linkInPackage}) { - _getEncodedAssetList(linkInPackage).add(asset); - } - - @override - void addEncodedAssets(Iterable assets, - {String? linkInPackage}) { - _getEncodedAssetList(linkInPackage).addAll(assets.cast()); - } - - List _getEncodedAssetList(String? linkInPackage) => - linkInPackage == null - ? _assets - : (_assetsForLinking[linkInPackage] ??= []); - - HookOutputImpl copyWith({Iterable? encodedAssets}) => - HookOutputImpl( - timestamp: timestamp, - encodedAssets: encodedAssets?.toList() ?? _assets, - encodedAssetsForLinking: encodedAssetsForLinking, - dependencies: _dependencies, - metadata: metadata, - ); -} diff --git a/pkgs/native_assets_cli/lib/src/model/link_config.dart b/pkgs/native_assets_cli/lib/src/model/link_config.dart deleted file mode 100644 index 0f46876a7..000000000 --- a/pkgs/native_assets_cli/lib/src/model/link_config.dart +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -part of '../api/link_config.dart'; - -/// The input to the linking script. -/// -/// It consists of the fields inherited from the [HookConfig] and the -/// [encodedAssets] from the build step. -class LinkConfigImpl extends HookConfigImpl implements LinkConfig { - static const resourceIdentifierKey = 'resource_identifiers'; - - static const assetsKey = 'assets'; - - @override - final Iterable encodedAssets; - - // TODO: Placeholder for the resources.json file URL. We don't want to change - // native_assets_builder when implementing the parsing. - @override - final Uri? recordedUsagesFile; - - LinkConfigImpl({ - required this.encodedAssets, - this.recordedUsagesFile, - required super.outputDirectory, - required super.outputDirectoryShared, - required super.packageName, - required super.packageRoot, - Version? version, - required super.buildMode, - super.cCompiler, - required super.supportedAssetTypes, - super.targetAndroidNdkApi, - super.targetArchitecture, - super.targetIOSSdk, - super.targetIOSVersion, - super.targetMacOSVersion, - required super.targetOS, - required super.linkModePreference, - super.dryRun, - }) : super( - hook: Hook.link, - version: version ?? HookConfigImpl.latestVersion, - ); - - LinkConfigImpl.dryRun({ - required this.encodedAssets, - this.recordedUsagesFile, - required super.outputDirectory, - required super.outputDirectoryShared, - required super.packageName, - required super.packageRoot, - Version? version, - required super.supportedAssetTypes, - required super.linkModePreference, - required super.targetOS, - }) : super.dryRun( - hook: Hook.link, - version: version ?? HookConfigImpl.latestVersion, - ); - - @override - Hook get hook => Hook.link; - - @override - String get outputName => 'link_output.json'; - - @override - Map toJson() => { - ...hookToJson(), - if (recordedUsagesFile != null) - resourceIdentifierKey: recordedUsagesFile!.toFilePath(), - if (encodedAssets.isNotEmpty) - assetsKey: [ - for (final asset in encodedAssets) asset.toJson(), - ], - }.sortOnKey(); - - static LinkConfig fromArguments(List arguments) { - final configPath = getConfigArgument(arguments); - final bytes = File(configPath).readAsBytesSync(); - final linkConfigJson = const Utf8Decoder() - .fuse(const JsonDecoder()) - .convert(bytes) as Map; - return fromJson(linkConfigJson); - } - - static LinkConfigImpl fromJson(Map config) { - final dryRun = HookConfigImpl.parseDryRun(config) ?? false; - final targetOS = HookConfigImpl.parseTargetOS(config); - return LinkConfigImpl( - outputDirectory: HookConfigImpl.parseOutDir(config), - outputDirectoryShared: HookConfigImpl.parseOutDirShared(config), - packageName: HookConfigImpl.parsePackageName(config), - packageRoot: HookConfigImpl.parsePackageRoot(config), - buildMode: HookConfigImpl.parseBuildMode(config, dryRun), - targetOS: targetOS, - targetArchitecture: - HookConfigImpl.parseTargetArchitecture(config, dryRun, targetOS), - linkModePreference: HookConfigImpl.parseLinkModePreference(config), - version: HookConfigImpl.parseVersion(config), - cCompiler: HookConfigImpl.parseCCompiler(config, dryRun), - supportedAssetTypes: - HookConfigImpl.parseSupportedEncodedAssetTypes(config), - targetAndroidNdkApi: - HookConfigImpl.parseTargetAndroidNdkApi(config, dryRun, targetOS), - targetIOSSdk: HookConfigImpl.parseTargetIOSSdk(config, dryRun, targetOS), - targetIOSVersion: - HookConfigImpl.parseTargetIosVersion(config, dryRun, targetOS), - targetMacOSVersion: - HookConfigImpl.parseTargetMacOSVersion(config, dryRun, targetOS), - encodedAssets: [ - for (final json in config.optionalList(assetsKey) ?? []) - EncodedAsset.fromJson(json as Map), - ], - recordedUsagesFile: parseRecordedUsagesUri(config), - dryRun: dryRun, - ); - } - - static Uri? parseRecordedUsagesUri(Map config) => - config.optionalPath(resourceIdentifierKey); - - @override - bool operator ==(Object other) { - if (super != other) { - return false; - } - if (other is! LinkConfigImpl) { - return false; - } - if (other.recordedUsagesFile != recordedUsagesFile) { - return false; - } - if (!const DeepCollectionEquality() - .equals(other.encodedAssets, encodedAssets)) { - return false; - } - return true; - } - - @override - int get hashCode => Object.hashAll([ - super.hashCode, - recordedUsagesFile, - const DeepCollectionEquality().hash(encodedAssets), - ]); - - @override - String toString() => 'LinkConfig(${toJson()})'; -} diff --git a/pkgs/native_assets_cli/lib/src/model/target.dart b/pkgs/native_assets_cli/lib/src/target.dart similarity index 98% rename from pkgs/native_assets_cli/lib/src/model/target.dart rename to pkgs/native_assets_cli/lib/src/target.dart index d80673537..39cc5687e 100644 --- a/pkgs/native_assets_cli/lib/src/model/target.dart +++ b/pkgs/native_assets_cli/lib/src/target.dart @@ -5,8 +5,8 @@ import 'dart:ffi' show Abi; import 'dart:io'; -import '../architecture.dart'; -import '../os.dart'; +import 'code_assets/architecture.dart'; +import 'code_assets/os.dart'; final class Target implements Comparable { final Abi abi; diff --git a/pkgs/native_assets_cli/lib/src/validation.dart b/pkgs/native_assets_cli/lib/src/validation.dart index 5a17dc31f..72c01c7a3 100644 --- a/pkgs/native_assets_cli/lib/src/validation.dart +++ b/pkgs/native_assets_cli/lib/src/validation.dart @@ -2,10 +2,43 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../native_assets_cli_internal.dart'; +import 'dart:io'; + +import '../native_assets_cli_builder.dart'; typedef ValidationErrors = List; +Future validateBuildConfig(BuildConfig config) async => + _validateHookConfig(config); + +Future validateLinkConfig(LinkConfig config) async { + final errors = [ + ..._validateHookConfig(config), + ]; + final recordUses = config.recordedUsagesFile; + if (recordUses != null && !File.fromUri(recordUses).existsSync()) { + errors.add('Config.recordUses ($recordUses) does not exist.'); + } + return errors; +} + +ValidationErrors _validateHookConfig(HookConfig config) { + final errors = []; + if (!Directory.fromUri(config.packageRoot).existsSync()) { + errors.add('Config.packageRoot (${config.packageRoot}) ' + 'has to be an existing directory.'); + } + if (!Directory.fromUri(config.outputDirectory).existsSync()) { + errors.add('Config.outputDirectory (${config.outputDirectory}) ' + 'has to be an existing directory.'); + } + if (!Directory.fromUri(config.outputDirectoryShared).existsSync()) { + errors.add('Config.outputDirectoryShared (${config.outputDirectoryShared}) ' + 'has to be an existing directory'); + } + return errors; +} + /// Invoked by package:native_assets_builder Future validateBuildOutput( BuildConfig config, @@ -40,12 +73,12 @@ List _validateOutputAssetTypes( Iterable assets, ) { final errors = []; - final supportedAssetTypes = config.supportedAssetTypes; + final buildAssetTypes = config.buildAssetTypes; for (final asset in assets) { - if (!supportedAssetTypes.contains(asset.type)) { + if (!buildAssetTypes.contains(asset.type)) { final error = 'Asset with type "${asset.type}" is not a supported asset type ' - '(${supportedAssetTypes.join(' ')} are supported)'; + '(${buildAssetTypes.join(' ')} are supported)'; errors.add(error); } } @@ -67,3 +100,12 @@ List _validateAssetsForLinking( } return errors; } + +class ValidationFailure implements Exception { + final String? message; + + ValidationFailure(this.message); + + @override + String toString() => message.toString(); +} diff --git a/pkgs/native_assets_cli/lib/test.dart b/pkgs/native_assets_cli/lib/test.dart index af750284a..e18210a4b 100644 --- a/pkgs/native_assets_cli/lib/test.dart +++ b/pkgs/native_assets_cli/lib/test.dart @@ -1,5 +1,108 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -export 'src/api/test.dart' show testBuildHook; +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:yaml/yaml.dart'; + +import 'native_assets_cli_builder.dart'; +import 'native_assets_cli_internal.dart' show Hook; +import 'src/validation.dart'; + +export 'native_assets_cli_builder.dart'; + +/// Validate a build hook; this will throw an exception on validation errors. +/// +/// This is intended to be used from tests, e.g.: +/// +/// ``` +/// test('test my build hook', () async { +/// await testCodeBuildHook( +/// ... +/// ); +/// }); +/// ``` +Future testBuildHook({ + required void Function(BuildConfigBuilder) extraConfigSetup, + required FutureOr Function(List arguments) mainMethod, + required FutureOr Function(BuildConfig config, BuildOutput output) + check, + List? buildAssetTypes, + bool? linkingEnabled, +}) async { + const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; + + final tempDir = await Directory.systemTemp.createTemp(); + + try { + // Deal with Windows temp folder aliases. + final tempUri = + Directory(await tempDir.resolveSymbolicLinks()).uri.normalizePath(); + final outputDirectory = tempUri.resolve('output/'); + final outputDirectoryShared = tempUri.resolve('output_shared/'); + + await Directory.fromUri(outputDirectory).create(); + await Directory.fromUri(outputDirectoryShared).create(); + + final configBuilder = BuildConfigBuilder(); + configBuilder + ..setupHookConfig( + packageRoot: Directory.current.uri, + packageName: _readPackageNameFromPubspec(), + buildAssetTypes: buildAssetTypes ?? [], + ) + ..setupBuildConfig( + dryRun: false, + linkingEnabled: true, + ) + ..setupBuildRunConfig( + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared, + ); + extraConfigSetup(configBuilder); + + final config = BuildConfig(configBuilder.json); + + final configUri = tempUri.resolve(Hook.build.outputName); + _writeJsonTo(configUri, config.json); + await mainMethod(['--config=${configUri.toFilePath()}']); + final output = BuildOutput( + _readJsonFrom(config.outputDirectory.resolve(Hook.build.outputName))); + + // Test conformance of protocol invariants. + final validationErrors = await validateBuildOutput(config, output); + if (validationErrors.isNotEmpty) { + throw ValidationFailure( + 'encountered build output validation issues: $validationErrors'); + } + + // Run user-defined tests. + await check(config, output); + } finally { + final keepTempDir = (Platform.environment[keepTempKey] ?? '').isNotEmpty; + if (!keepTempDir) { + tempDir.deleteSync(recursive: true); + } + } +} + +void _writeJsonTo(Uri uri, Map json) { + final encoder = const JsonEncoder().fuse(const Utf8Encoder()); + File.fromUri(uri).writeAsBytesSync(encoder.convert(json)); +} + +Map _readJsonFrom(Uri uri) { + final decoder = const Utf8Decoder().fuse(const JsonDecoder()); + final bytes = File.fromUri(uri).readAsBytesSync(); + return decoder.convert(bytes) as Map; +} + +String _readPackageNameFromPubspec() { + final uri = Directory.current.uri.resolve('pubspec.yaml'); + final readAsString = File.fromUri(uri).readAsStringSync(); + final yaml = loadYaml(readAsString) as YamlMap; + return yaml['name'] as String; +} diff --git a/pkgs/native_assets_cli/pubspec.yaml b/pkgs/native_assets_cli/pubspec.yaml index 944665ffe..d72d7b095 100644 --- a/pkgs/native_assets_cli/pubspec.yaml +++ b/pkgs/native_assets_cli/pubspec.yaml @@ -4,9 +4,11 @@ description: >- native assets CLI. # Note: Bump BuildConfig.version and BuildOutput.version on breaking changes! -version: 0.9.0-wip +version: 0.10.0-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_cli +publish_to: none + topics: - ffi - interop @@ -21,10 +23,10 @@ dependencies: logging: ^1.2.0 meta: ^1.15.0 pub_semver: ^2.1.3 - test: ^1.25.7 - yaml: ^3.1.2 # Used for reading pubspec.yaml to obtain the package name + yaml: ^3.1.2 # Used for reading pubspec.yaml to obtain the package name dev_dependencies: dart_flutter_team_lints: ^2.1.1 file_testing: ^3.0.0 glob: any + test: ^1.25.7 diff --git a/pkgs/native_assets_cli/test/api/asset_test.dart b/pkgs/native_assets_cli/test/api/asset_test.dart index 8c260e281..9e580aed9 100644 --- a/pkgs/native_assets_cli/test/api/asset_test.dart +++ b/pkgs/native_assets_cli/test/api/asset_test.dart @@ -2,7 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; +import 'package:native_assets_cli/data_assets.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/api/build_config_test.dart b/pkgs/native_assets_cli/test/api/build_config_test.dart deleted file mode 100644 index 613c60dce..000000000 --- a/pkgs/native_assets_cli/test/api/build_config_test.dart +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// ignore_for_file: deprecated_member_use_from_same_package - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:native_assets_cli/src/api/build_config.dart'; -import 'package:test/test.dart'; - -void main() async { - late Uri tempUri; - late Uri outDirUri; - late Uri outDir2Uri; - late Uri outputDirectoryShared; - late Uri outputDirectoryShared2; - late String packageName; - late Uri packageRootUri; - late Uri fakeClang; - late Uri fakeLd; - late Uri fakeAr; - late Uri fakeCl; - late Uri fakeVcVars; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - outDirUri = tempUri.resolve('out1/'); - await Directory.fromUri(outDirUri).create(); - outDir2Uri = tempUri.resolve('out2/'); - await Directory.fromUri(outDir2Uri).create(); - outputDirectoryShared = tempUri.resolve('out_shared1/'); - await Directory.fromUri(outputDirectoryShared).create(); - outputDirectoryShared2 = tempUri.resolve('out_shared2/'); - await Directory.fromUri(outputDirectoryShared2).create(); - packageName = 'my_package'; - packageRootUri = tempUri.resolve('$packageName/'); - await Directory.fromUri(packageRootUri).create(); - fakeClang = tempUri.resolve('fake_clang'); - await File.fromUri(fakeClang).create(); - fakeLd = tempUri.resolve('fake_ld'); - await File.fromUri(fakeLd).create(); - fakeAr = tempUri.resolve('fake_ar'); - await File.fromUri(fakeAr).create(); - fakeCl = tempUri.resolve('cl.exe'); - await File.fromUri(fakeCl).create(); - fakeVcVars = tempUri.resolve('vcvarsall.bat'); - await File.fromUri(fakeVcVars).create(); - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - test('BuildConfig ==', () { - final config1 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - archiver: fakeAr, - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - - final config2 = BuildConfig.build( - outputDirectory: outDir2Uri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - - expect(config1, equals(config1)); - expect(config1 == config2, false); - expect(config1.outputDirectory != config2.outputDirectory, true); - expect(config1.packageRoot, config2.packageRoot); - expect(config1.targetArchitecture == config2.targetArchitecture, true); - expect(config1.targetOS != config2.targetOS, true); - expect(config1.targetIOSSdk, IOSSdk.iPhoneOS); - expect(() => config2.targetIOSSdk, throwsStateError); - expect(config1.cCompiler.compiler != config2.cCompiler.compiler, true); - expect(config1.cCompiler.linker != config2.cCompiler.linker, true); - expect(config1.cCompiler.archiver != config2.cCompiler.archiver, true); - expect(config1.cCompiler.envScript == config2.cCompiler.envScript, true); - expect(config1.cCompiler.envScriptArgs == config2.cCompiler.envScriptArgs, - true); - expect(config1.cCompiler != config2.cCompiler, true); - expect(config1.linkModePreference, config2.linkModePreference); - expect(config1.supportedAssetTypes, config2.supportedAssetTypes); - expect(config1.linkingEnabled, config2.linkingEnabled); - }); - - test('BuildConfig fromConfig', () { - final buildConfig2 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final config = { - 'build_mode': 'release', - 'supported_asset_types': [CodeAsset.type], - 'dry_run': false, - 'linking_enabled': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_android_ndk_api': 30, - 'target_architecture': 'arm64', - 'target_os': 'android', - 'version': BuildOutput.latestVersion.toString(), - }; - - final fromConfig = BuildConfigImpl.fromJson(config); - expect(fromConfig, equals(buildConfig2)); - }); - - test('BuildConfig.dryRun', () { - final buildConfig2 = BuildConfig.dryRun( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetOS: OS.android, - linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: true, - ); - - final config = { - 'dry_run': true, - 'supported_asset_types': [CodeAsset.type], - 'linking_enabled': true, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_os': 'android', - 'version': BuildOutput.latestVersion.toString(), - }; - - final fromConfig = BuildConfigImpl.fromJson(config); - expect(fromConfig, equals(buildConfig2)); - }); - - test('BuildConfig == dependency metadata', () { - final buildConfig1 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - dependencyMetadata: { - 'bar': { - 'key': 'value', - 'foo': ['asdf', 'fdsa'], - }, - 'foo': { - 'key': 321, - }, - }, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final buildConfig2 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - dependencyMetadata: { - 'bar': { - 'key': 'value', - }, - 'foo': { - 'key': 123, - }, - }, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - expect(buildConfig1, equals(buildConfig1)); - expect(buildConfig1 == buildConfig2, false); - expect(buildConfig1.hashCode == buildConfig2.hashCode, false); - - expect(buildConfig1.metadatum('bar', 'key'), 'value'); - }); - - test('BuildConfig == hasLinkConfig', () { - final buildConfig1 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.x64, - targetOS: OS.windows, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: true, - supportedAssetTypes: [CodeAsset.type], - ); - - final buildConfig2 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.x64, - targetOS: OS.windows, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - expect(buildConfig1, equals(buildConfig1)); - expect(buildConfig1.hashCode, isNot(buildConfig2.hashCode)); - expect(buildConfig1, isNot(buildConfig2)); - }); - - test('BuildConfig fromArgs', () async { - final buildConfig = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - final configFileContents = (buildConfig as BuildConfigImpl).toJsonString(); - final configUri = tempUri.resolve('config.json'); - final configFile = File.fromUri(configUri); - await configFile.writeAsString(configFileContents); - final buildConfigFromArgs = BuildConfig( - ['--config', configUri.toFilePath()], - environment: {}, // Don't inherit the test environment. - ); - expect(buildConfigFromArgs, buildConfig); - }); - - test('BuildConfig.version', () { - BuildConfig.latestVersion.toString(); - }); -} diff --git a/pkgs/native_assets_cli/test/api/build_output_test.dart b/pkgs/native_assets_cli/test/api/build_output_test.dart deleted file mode 100644 index 9bd10f474..000000000 --- a/pkgs/native_assets_cli/test/api/build_output_test.dart +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:test/test.dart'; - -void main() { - late Uri tempUri; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - test('BuildOutput constructor', () { - BuildOutput( - timestamp: DateTime.parse('2022-11-10 13:25:01.000'), - encodedAssets: [ - CodeAsset( - package: 'my_package', - name: 'foo', - file: Uri(path: 'path/to/libfoo.so'), - linkMode: DynamicLoadingBundled(), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - CodeAsset( - package: 'my_package', - name: 'foo2', - linkMode: DynamicLoadingSystem(Uri(path: 'path/to/libfoo2.so')), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - ], - dependencies: [ - Uri.file('path/to/file.ext'), - ], - // ignore: deprecated_member_use_from_same_package - metadata: { - 'key': 'value', - }, - ); - }); -} diff --git a/pkgs/native_assets_cli/test/api/build_test.dart b/pkgs/native_assets_cli/test/api/build_test.dart index baae8eba6..aa2801b37 100644 --- a/pkgs/native_assets_cli/test/api/build_test.dart +++ b/pkgs/native_assets_cli/test/api/build_test.dart @@ -2,11 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; import 'package:file_testing/file_testing.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:native_assets_cli/src/api/build_config.dart'; +import 'package:native_assets_cli/native_assets_cli.dart' show build; +import 'package:native_assets_cli/native_assets_cli_builder.dart'; +import 'package:native_assets_cli/native_assets_cli_internal.dart' show Hook; import 'package:test/test.dart'; void main() async { @@ -15,53 +17,36 @@ void main() async { late Uri outputDirectoryShared; late String packageName; late Uri packageRootUri; - late Uri fakeClang; - late Uri fakeLd; - late Uri fakeAr; - late Uri fakeCl; - late Uri fakeVcVars; late Uri buildConfigUri; - late BuildConfig config1; + late BuildConfig config; setUp(() async { tempUri = (await Directory.systemTemp.createTemp()).uri; outDirUri = tempUri.resolve('out1/'); await Directory.fromUri(outDirUri).create(); outputDirectoryShared = tempUri.resolve('out_shared1/'); - await Directory.fromUri(outputDirectoryShared).create(); packageName = 'my_package'; packageRootUri = tempUri.resolve('$packageName/'); await Directory.fromUri(packageRootUri).create(); - fakeClang = tempUri.resolve('fake_clang'); - await File.fromUri(fakeClang).create(); - fakeLd = tempUri.resolve('fake_ld'); - await File.fromUri(fakeLd).create(); - fakeAr = tempUri.resolve('fake_ar'); - await File.fromUri(fakeAr).create(); - fakeCl = tempUri.resolve('cl.exe'); - await File.fromUri(fakeCl).create(); - fakeVcVars = tempUri.resolve('vcvarsall.bat'); - await File.fromUri(fakeVcVars).create(); - config1 = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - archiver: fakeAr, - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferDynamic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - final configJson = (config1 as BuildConfigImpl).toJsonString(); + final configBuilder = BuildConfigBuilder(); + configBuilder + ..setupHookConfig( + packageRoot: tempUri, + packageName: packageName, + buildAssetTypes: ['foo'], + ) + ..setupBuildConfig( + dryRun: false, + linkingEnabled: false, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + ); + config = BuildConfig(configBuilder.json); + + final configJson = json.encode(config.json); buildConfigUri = tempUri.resolve('build_config.json'); await File.fromUri(buildConfigUri).writeAsString(configJson); }); @@ -72,7 +57,7 @@ void main() async { output.addDependency(packageRootUri.resolve('foo')); }); final buildOutputUri = - outDirUri.resolve((config1 as BuildConfigImpl).outputName); + config.outputDirectory.resolve(Hook.build.outputName); expect(File.fromUri(buildOutputUri), exists); }); } diff --git a/pkgs/native_assets_cli/test/api/link_config_test.dart b/pkgs/native_assets_cli/test/api/link_config_test.dart deleted file mode 100644 index bd739b65b..000000000 --- a/pkgs/native_assets_cli/test/api/link_config_test.dart +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:native_assets_cli/src/api/link_config.dart'; -import 'package:test/test.dart'; - -void main() async { - late Uri tempUri; - late Uri outDirUri; - late Uri outDir2Uri; - late Uri outputDirectoryShared; - late String packageName; - late Uri packageRootUri; - late Uri fakeClang; - late Uri fakeLd; - late Uri fakeAr; - late Uri fakeCl; - late Uri fakeVcVars; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - outDirUri = tempUri.resolve('out1/'); - await Directory.fromUri(outDirUri).create(); - outDir2Uri = tempUri.resolve('out2/'); - await Directory.fromUri(outDir2Uri).create(); - outputDirectoryShared = tempUri.resolve('out_shared1/'); - await Directory.fromUri(outputDirectoryShared).create(); - packageName = 'my_package'; - packageRootUri = tempUri.resolve('$packageName/'); - await Directory.fromUri(packageRootUri).create(); - fakeClang = tempUri.resolve('fake_clang'); - await File.fromUri(fakeClang).create(); - fakeLd = tempUri.resolve('fake_ld'); - await File.fromUri(fakeLd).create(); - fakeAr = tempUri.resolve('fake_ar'); - await File.fromUri(fakeAr).create(); - fakeCl = tempUri.resolve('cl.exe'); - await File.fromUri(fakeCl).create(); - fakeVcVars = tempUri.resolve('vcvarsall.bat'); - await File.fromUri(fakeVcVars).create(); - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - test('LinkConfig ==', () { - final config1 = LinkConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - archiver: fakeAr, - ), - buildMode: BuildMode.release, - supportedAssetTypes: [CodeAsset.type], - assets: [], - linkModePreference: LinkModePreference.preferStatic, - ); - - final config2 = LinkConfig.build( - outputDirectory: outDir2Uri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - supportedAssetTypes: [CodeAsset.type], - assets: [], - linkModePreference: LinkModePreference.preferStatic, - ); - - expect(config1, equals(config1)); - expect(config1 == config2, false); - expect(config1.outputDirectory != config2.outputDirectory, true); - expect(config1.packageRoot, config2.packageRoot); - expect(config1.targetArchitecture == config2.targetArchitecture, true); - expect(config1.targetOS != config2.targetOS, true); - expect(config1.targetIOSSdk, IOSSdk.iPhoneOS); - expect(() => config2.targetIOSSdk, throwsStateError); - expect(config1.cCompiler.compiler != config2.cCompiler.compiler, true); - expect(config1.cCompiler.linker != config2.cCompiler.linker, true); - expect(config1.cCompiler.archiver != config2.cCompiler.archiver, true); - expect(config1.cCompiler.envScript == config2.cCompiler.envScript, true); - expect(config1.cCompiler.envScriptArgs == config2.cCompiler.envScriptArgs, - true); - expect(config1.cCompiler != config2.cCompiler, true); - expect(config1.supportedAssetTypes, config2.supportedAssetTypes); - }); - - test('LinkConfig fromConfig', () { - final linkConfig2 = LinkConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - assets: [], - linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], - ); - - final config = { - 'build_mode': 'release', - 'dry_run': false, - 'supported_asset_types': [CodeAsset.type], - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_android_ndk_api': 30, - 'target_architecture': 'arm64', - 'target_os': 'android', - 'version': BuildOutput.latestVersion.toString(), - 'assets': [], - }; - - final fromConfig = LinkConfigImpl.fromJson(config); - expect(fromConfig, equals(linkConfig2)); - }); - - test('LinkConfig.dryRun', () { - final linkConfig2 = LinkConfig.dryRun( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetOS: OS.android, - supportedAssetTypes: [CodeAsset.type], - assets: [], - linkModePreference: LinkModePreference.preferStatic, - ); - - final config = { - 'dry_run': true, - 'supported_asset_types': [CodeAsset.type], - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_os': 'android', - 'version': BuildOutput.latestVersion.toString(), - 'assets': [], - }; - - final fromConfig = LinkConfigImpl.fromJson(config); - expect(fromConfig, equals(linkConfig2)); - }); - - test('LinkConfig fromArgs', () async { - final linkConfig = LinkConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - assets: [], - linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], - ); - final configFileContents = (linkConfig as LinkConfigImpl).toJsonString(); - final configUri = tempUri.resolve('config.json'); - final configFile = File.fromUri(configUri); - await configFile.writeAsString(configFileContents); - final linkConfigFromArgs = - LinkConfig.fromArguments(['--config', configUri.toFilePath()]); - expect(linkConfigFromArgs, linkConfig); - }); - - test('LinkConfig.version', () { - LinkConfig.latestVersion.toString(); - }); -} diff --git a/pkgs/native_assets_cli/test/api/target_test.dart b/pkgs/native_assets_cli/test/api/target_test.dart index 4d44547d1..155734e7c 100644 --- a/pkgs/native_assets_cli/test/api/target_test.dart +++ b/pkgs/native_assets_cli/test/api/target_test.dart @@ -4,7 +4,7 @@ import 'dart:ffi'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/build_config_test.dart b/pkgs/native_assets_cli/test/build_config_test.dart new file mode 100644 index 000000000..10e844ab0 --- /dev/null +++ b/pkgs/native_assets_cli/test/build_config_test.dart @@ -0,0 +1,218 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// ignore_for_file: deprecated_member_use_from_same_package + +import 'dart:convert'; +import 'dart:io'; + +import 'package:native_assets_cli/native_assets_cli_builder.dart'; +import 'package:native_assets_cli/src/config.dart' show latestVersion; +import 'package:test/test.dart'; + +void main() async { + late Uri outDirUri; + late Uri outputDirectoryShared; + late String packageName; + late Uri packageRootUri; + late Map metadata; + + setUp(() async { + final tempUri = Directory.systemTemp.uri; + outDirUri = tempUri.resolve('out1/'); + outputDirectoryShared = tempUri.resolve('out_shared1/'); + packageName = 'my_package'; + packageRootUri = tempUri.resolve('$packageName/'); + metadata = { + 'bar': const Metadata({ + 'key': 'value', + 'foo': ['asdf', 'fdsa'], + }), + 'foo': const Metadata({ + 'key': 321, + }), + }; + }); + + test('BuildConfigBuilder->JSON->BuildConfig', () { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageRootUri, + buildAssetTypes: ['my-asset-type'], + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + metadata: metadata, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + ); + final config = BuildConfig(configBuilder.json); + + final expectedConfigJson = { + 'build_asset_types': ['my-asset-type'], + 'build_mode': 'release', + 'dependency_metadata': { + 'bar': { + 'key': 'value', + 'foo': ['asdf', 'fdsa'], + }, + 'foo': { + 'key': 321, + }, + }, + 'dry_run': false, + 'linking_enabled': false, + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'out_dir': outDirUri.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'supported_asset_types': ['my-asset-type'], + 'version': latestVersion.toString(), + }; + + expect(config.json, expectedConfigJson); + expect(json.decode(config.toString()), expectedConfigJson); + + expect(config.outputDirectory, outDirUri); + expect(config.outputDirectoryShared, outputDirectoryShared); + + expect(config.packageName, packageName); + expect(config.packageRoot, packageRootUri); + expect(config.buildAssetTypes, ['my-asset-type']); + + expect(config.linkingEnabled, false); + expect(config.dryRun, false); + expect(config.metadata, metadata); + }); + + test('BuildConfig.dryRun', () { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageRootUri, + buildAssetTypes: ['my-asset-type'], + ) + ..setupBuildConfig( + linkingEnabled: true, + dryRun: true, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + ); + final config = BuildConfig(configBuilder.json); + + final expectedConfigJson = { + 'build_asset_types': ['my-asset-type'], + 'dependency_metadata': {}, + 'dry_run': true, + 'linking_enabled': true, + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'out_dir': outDirUri.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'supported_asset_types': ['my-asset-type'], + 'version': latestVersion.toString(), + }; + + expect(config.json, expectedConfigJson); + expect(json.decode(config.toString()), expectedConfigJson); + + expect(config.outputDirectory, outDirUri); + expect(config.outputDirectoryShared, outputDirectoryShared); + + expect(config.packageName, packageName); + expect(config.packageRoot, packageRootUri); + expect(config.buildAssetTypes, ['my-asset-type']); + + expect(config.linkingEnabled, true); + expect(config.dryRun, true); + expect(config.metadata, {}); + }); + + group('BuildConfig format issues', () { + for (final version in ['9001.0.0', '0.0.1']) { + test('BuildConfig version $version', () { + final outDir = outDirUri; + final config = { + 'link_mode_preference': 'prefer-static', + 'out_dir': outDir.toFilePath(), + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'package_root': packageRootUri.toFilePath(), + 'target_os': 'linux', + 'version': version, + 'package_name': packageName, + 'build_asset_types': ['my-asset-type'], + 'dry_run': true, + 'linking_enabled': false, + }; + expect( + () => BuildConfig(config), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains(version) && + e.message.contains(latestVersion.toString()), + )), + ); + }); + } + + test('BuildConfig FormatExceptions', () { + expect( + () => BuildConfig({}), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains( + 'No value was provided for required key: ', + ), + )), + ); + expect( + () => BuildConfig({ + 'version': latestVersion.toString(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'target_os': 'android', + 'linking_enabled': true, + 'build_asset_types': ['my-asset-type'], + }), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains( + 'No value was provided for required key: out_dir', + ), + )), + ); + expect( + () => BuildConfig({ + 'version': latestVersion.toString(), + 'out_dir': outDirUri.toFilePath(), + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'target_os': 'android', + 'linking_enabled': true, + 'build_asset_types': ['my-asset-type'], + 'dependency_metadata': { + 'bar': {'key': 'value'}, + 'foo': [], + }, + }), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains("Unexpected value '[]' ") && + e.message.contains('Expected a Map'), + )), + ); + }); + }); +} diff --git a/pkgs/native_assets_cli/test/build_output_test.dart b/pkgs/native_assets_cli/test/build_output_test.dart new file mode 100644 index 000000000..5c7e78e4f --- /dev/null +++ b/pkgs/native_assets_cli/test/build_output_test.dart @@ -0,0 +1,87 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// ignore_for_file: deprecated_member_use_from_same_package + +import 'package:native_assets_cli/native_assets_cli_builder.dart'; +import 'package:native_assets_cli/src/utils/datetime.dart'; +import 'package:test/test.dart'; + +void main() { + test('BuildOutputBuilder->JSON->BuildOutput', () { + final assets = [ + for (int i = 0; i < 3; i++) + EncodedAsset('my-asset-type', {'a-$i': 'v-$i'}) + ]; + final uris = [ + for (int i = 0; i < 3; ++i) Uri.file('path$i'), + ]; + final metadata0 = { + 'meta-a': 'meta-b', + }; + final metadata1 = { + for (int i = 0; i < 2; ++i) 'meta$i': 'meta$i-value', + }; + final before = DateTime.now().roundDownToSeconds(); + final builder = BuildOutputBuilder(); + final after = DateTime.now().roundDownToSeconds(); + + builder.addDependency(uris.take(1).single); + builder.addDependencies(uris.skip(1).toList()); + builder.addMetadatum(metadata0.keys.single, metadata0.values.single); + builder.addMetadata(metadata1); + + builder.addEncodedAsset(assets.take(1).single); + builder.addEncodedAsset(assets.skip(1).first, + linkInPackage: 'package:linker1'); + builder.addEncodedAssets(assets.skip(2).take(2).toList()); + builder.addEncodedAssets(assets.skip(4).toList(), + linkInPackage: 'package:linker2'); + + final config = BuildOutput(builder.json); + expect(config.timestamp.compareTo(before), greaterThanOrEqualTo(0)); + expect(config.timestamp.compareTo(after), lessThanOrEqualTo(0)); + expect( + config.timestamp + .isAtSameMomentAs(config.timestamp.roundDownToSeconds()), + true); + + // The JSON format of the build output. + { + 'version': '1.6.0', + 'dependencies': ['path0', 'path1', 'path2'], + 'metadata': { + 'meta-a': 'meta-b', + 'meta0': 'meta0-value', + 'meta1': 'meta1-value' + }, + 'assets': [ + {'a-0': 'v-0', 'type': 'my-asset-type'}, + {'a-2': 'v-2', 'type': 'my-asset-type'} + ], + 'assetsForLinking': { + 'package:linker1': [ + {'a-1': 'v-1', 'type': 'my-asset-type'} + ], + 'package:linker2': [], + } + }.forEach((k, v) { + expect(config.json[k], equals(v)); + }); + }); + + for (final version in ['9001.0.0', '0.0.1']) { + test('BuildOutput version $version', () { + expect( + () => BuildOutput({'version': version}), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains(version) && + e.message.contains(HookOutput.latestVersion.toString()), + )), + ); + }); + } +} diff --git a/pkgs/native_assets_cli/test/checksum_test.dart b/pkgs/native_assets_cli/test/checksum_test.dart new file mode 100644 index 000000000..3b2376d28 --- /dev/null +++ b/pkgs/native_assets_cli/test/checksum_test.dart @@ -0,0 +1,127 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'package:native_assets_cli/data_assets_builder.dart'; +import 'package:test/test.dart'; + +void main() { + test('checksum', () async { + // metadata, cc, link vs build, metadata, haslink + final configs = []; + final checksums = []; + for (final os in [OS.linux, OS.macOS]) { + for (final architecture in [Architecture.arm64, Architecture.x64]) { + for (final packageName in ['foo', 'bar']) { + for (final assetType in [CodeAsset.type, DataAsset.type]) { + for (final dryRun in [true, false]) { + for (final linking in [true, false]) { + final builder = BuildConfigBuilder() + ..setupHookConfig( + packageRoot: Uri.file('foo'), + packageName: packageName, + buildAssetTypes: [assetType], + ) + ..setupBuildConfig( + dryRun: dryRun, + linkingEnabled: linking, + ) + ..setupCodeConfig( + targetArchitecture: architecture, + targetOS: os, + linkModePreference: LinkModePreference.dynamic, + ); + configs.add( + const JsonEncoder.withIndent(' ').convert(builder.json), + ); + checksums.add(builder.computeChecksum()); + } + } + } + } + } + } + // As all variants have something different, we expect the checksums to be + // unique. + expect(checksums.toSet().length, checksums.length); + + // If format or algorithm for checksumming changes we'd like to know (by + // needing to update this list). + + final expectedChecksums = [ + 'd666127fab5478b736d505c0cbd2e08e', + '5d5cf5cf7916bd7adc26f5d5611f23ec', + '29cb9cf638acac26c1e7eb20bf4e359a', + '2214edee21375319f5612344dfe6acbc', + '40b61c96feff406659bc35e24875744b', + 'a0492f5322cea695e3bc1522d66a20ce', + '9f5269a2c0c663023af449e77ac39980', + 'c9add26b586b1fb897f9ff0d2edb235d', + '95ec14e605b3519f00ea8816b328e0ad', + 'fc5792f6beb3c0e0f7894537a3fa4850', + 'bbf84c44fb1ce09636a70d3e9a8590be', + '9c83dfb94b98c6f4ec79cbabc95e6198', + 'af8712f4857423f455d2912c55fe6766', + '99d1eba44f3e914b58768c210d139cc1', + '12cc255c3fc076d3550ac32b43166631', + '2188cca31e8306cbacb9c3d799b5513c', + '65ad5d4fb66745aad4e5a2969a1e45b1', + '29da0a967b9cfd5e4d21d61c97d2a99e', + 'efef4a8ab871ed05a9358a2e4d6d4e03', + '672a07ce5b6f82204ba92b45c287781c', + '4bcdd217687c15fb108dc9a9b8f8537c', + 'c0593c4282d42a659d66d8b72e44b2a6', + 'dd428de57da1d45149f4ff8a27fa3ea0', + 'c04f80b8be73bcfe435c586ef8a979bc', + '1056f2bf80b3c1979952af1e62e34576', + 'b7d943b4bab492e10c582bdd58aced0e', + 'ed56d7afbd306393c3206685e6d1ba81', + '1463940666f69e3b132f3766570ef83b', + '5451c1a2a24bc5e1206b245b028e0078', + '5f2c169a71039d3d6b2ae74e3c2723d7', + '67759625e5a0908dabcaeeb2b1264f84', + '921b2b7012548949e9b465addccc2e71', + '94bc85e935634df06e208ac8ab9643d3', + 'ee4cd19fc3ac5d4a85ceaf2e80e44682', + '661bf4e49dff3c104784a0d75cf45204', + '0b3529f1337b3759e97733095a868d29', + '1522580f1e96c5ea5dc68ca7a720adee', + '5c08a30f498edf9962c8ff20a1ab4fba', + '69f4f6640eba043f4df2e6f109f07b90', + '62db9da306210856e44bb7f8a75a15fd', + '125f6fa99282a3b7e8937030a3aa2c6d', + '1cf817dd1a1710bfacb82ef71da94e4f', + '1eccd6e8e62985cb9955db4fd8c22d2f', + '4becc04d3263f2b362dd76c0e0eb6d7b', + '74ecd3c74beb88f2f7f02921a8de1143', + 'ad6bf3865f8addf4233e3a83192f5464', + 'edf54995d97ad818449f09d9b2fc86e2', + '89014c91ebb4075bdea2d52f2d35b4ae', + 'cb59b4041a0a7bbf636ed4e3b30d06be', + '3dd69a72235c9b45e1f85c143e8f97bc', + 'b08bec82fca775aeec2e4f400b20a4a0', + '79381e4fd8c1191f2fceb7ad30b3fd64', + 'b8e5434a62d4b0a381363dca1152a0d5', + 'f70e0798fa96df0b6e1d14d69fd0deaa', + '3d807e9c6306c16f2ee61a32e8081e2f', + '0646eefc0cfd913506051f0c8a900983', + 'b5adb85aeaf88a23e7bafd29e63c03ac', + '7b269c3e21fe9e29285daba8c370073f', + '1a47af48f1e3158000d44ef59ab597da', + '2665c64ac2a9d919fff7420c0e770db3', + '27c0acf56ef48f3855fc20ea8810ff8d', + '2a9a03940008cdd6f9231f1f54dd94bf', + '86d87e3cb682646e5d1158898ed7913f', + '6a7b30ccd5a35694c515d22f165be589', + ]; + printOnFailure('final expectedChecksums = ['); + printOnFailure(checksums.map((e) => " '$e',").join('\n')); + printOnFailure('];'); + for (var i = 0; i < checksums.length; ++i) { + expect(checksums[i], expectedChecksums[i]); + } + }); +} diff --git a/pkgs/native_assets_cli/test/code_assets/code_asset_test.dart b/pkgs/native_assets_cli/test/code_assets/code_asset_test.dart new file mode 100644 index 000000000..1ffe89bbf --- /dev/null +++ b/pkgs/native_assets_cli/test/code_assets/code_asset_test.dart @@ -0,0 +1,28 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'package:test/test.dart'; + +void main() async { + test('DataAsset', () { + expect( + CodeAsset( + package: 'my_package', + name: 'name', + linkMode: DynamicLoadingBundled(), + os: OS.android, + file: Uri.file('not there'), + architecture: Architecture.riscv64, + ).encode().toJson(), + { + 'architecture': 'riscv64', + 'file': 'not there', + 'id': 'package:my_package/name', + 'link_mode': {'type': 'dynamic_loading_bundle'}, + 'os': 'android', + 'type': 'native_code', + }); + }); +} diff --git a/pkgs/native_assets_cli/test/code_assets/config_test.dart b/pkgs/native_assets_cli/test/code_assets/config_test.dart new file mode 100644 index 000000000..74ce351d3 --- /dev/null +++ b/pkgs/native_assets_cli/test/code_assets/config_test.dart @@ -0,0 +1,215 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'package:native_assets_cli/src/config.dart' show latestVersion; +import 'package:test/test.dart'; + +void main() async { + late Uri outDirUri; + late Uri outputDirectoryShared; + late String packageName; + late Uri packageRootUri; + late Uri fakeClang; + late Uri fakeLd; + late Uri fakeAr; + late List assets; + late Uri fakeVcVars; + + setUp(() async { + final tempUri = Directory.systemTemp.uri; + outDirUri = tempUri.resolve('out1/'); + outputDirectoryShared = tempUri.resolve('out_shared1/'); + packageName = 'my_package'; + packageRootUri = tempUri.resolve('$packageName/'); + fakeClang = tempUri.resolve('fake_clang'); + fakeLd = tempUri.resolve('fake_ld'); + fakeAr = tempUri.resolve('fake_ar'); + fakeVcVars = tempUri.resolve('vcvarsall.bat'); + + assets = [ + CodeAsset( + package: packageName, + name: 'name', + linkMode: DynamicLoadingBundled(), + os: OS.android, + file: Uri.file('not there'), + architecture: Architecture.riscv64, + ).encode(), + ]; + }); + + // Tests JSON encoding & accessors of code-asset configuration. + void expectCorrectCodeConfigDryRun( + Map json, CodeConfig codeConfig) { + { + 'build_asset_types': [CodeAsset.type], + 'link_mode_preference': 'prefer-static', + }.forEach((k, v) { + expect(json[k], v); + }); + + expect(() => codeConfig.targetArchitecture, throwsStateError); + expect(codeConfig.targetAndroidNdkApi, null); + expect(codeConfig.linkModePreference, LinkModePreference.preferStatic); + expect(codeConfig.cCompiler, null); + } + + void expectCorrectCodeConfig( + Map json, CodeConfig codeConfig) { + { + 'build_asset_types': [CodeAsset.type], + 'link_mode_preference': 'prefer-static', + 'target_android_ndk_api': 30, + 'target_architecture': 'arm64', + 'c_compiler': { + 'ar': fakeAr.toFilePath(), + 'ld': fakeLd.toFilePath(), + 'cc': fakeClang.toFilePath(), + 'env_script': fakeVcVars.toFilePath(), + 'env_script_arguments': ['arg0', 'arg1'], + }, + }.forEach((k, v) { + expect(json[k], v); + }); + + expect(codeConfig.targetArchitecture, Architecture.arm64); + expect(codeConfig.targetAndroidNdkApi, 30); + expect(codeConfig.linkModePreference, LinkModePreference.preferStatic); + expect(codeConfig.cCompiler?.compiler, fakeClang); + expect(codeConfig.cCompiler?.linker, fakeLd); + expect(codeConfig.cCompiler?.archiver, fakeAr); + } + + test('BuildConfig.codeConfig (dry-run)', () { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageRootUri, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildConfig( + linkingEnabled: true, + dryRun: true, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + ) + ..setupCodeConfig( + targetOS: OS.android, + targetArchitecture: null, // not available in dry run + cCompilerConfig: null, // not available in dry run + linkModePreference: LinkModePreference.preferStatic, + ); + final config = BuildConfig(configBuilder.json); + expectCorrectCodeConfigDryRun(config.json, config.codeConfig); + }); + + test('BuildConfig.codeConfig', () { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageRootUri, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + ) + ..setupCodeConfig( + targetOS: OS.android, + targetArchitecture: Architecture.arm64, + targetAndroidNdkApi: 30, + linkModePreference: LinkModePreference.preferStatic, + cCompilerConfig: CCompilerConfig( + compiler: fakeClang, + linker: fakeLd, + archiver: fakeAr, + envScript: fakeVcVars, + envScriptArgs: ['arg0', 'arg1'], + ), + ); + final config = BuildConfig(configBuilder.json); + expectCorrectCodeConfig(config.json, config.codeConfig); + }); + + test('LinkConfig.{codeConfig,codeAssets}', () { + final configBuilder = LinkConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageRootUri, + buildAssetTypes: [CodeAsset.type], + ) + ..setupLinkConfig(assets: assets) + ..setupLinkRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + recordedUsesFile: null, + ) + ..setupCodeConfig( + targetOS: OS.android, + targetArchitecture: Architecture.arm64, + targetAndroidNdkApi: 30, + linkModePreference: LinkModePreference.preferStatic, + cCompilerConfig: CCompilerConfig( + compiler: fakeClang, + linker: fakeLd, + archiver: fakeAr, + envScript: fakeVcVars, + envScriptArgs: ['arg0', 'arg1'], + ), + ); + final config = LinkConfig(configBuilder.json); + expectCorrectCodeConfig(config.json, config.codeConfig); + expect(config.encodedAssets, assets); + }); + + test('BuildConfig.codeConfig: invalid architecture', () { + final config = { + 'dry_run': false, + 'linking_enabled': false, + 'link_mode_preference': 'prefer-static', + 'out_dir': outDirUri.toFilePath(), + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'target_android_ndk_api': 30, + 'target_architecture': 'invalid_architecture', + 'target_os': 'android', + 'build_asset_types': ['my-asset-type'], + 'version': latestVersion.toString(), + }; + expect( + () => BuildConfig(config).codeConfig, + throwsFormatException, + ); + }); + + test('LinkConfig.codeConfig: invalid architecture', () { + final config = { + 'build_asset_types': [CodeAsset.type], + 'dry_run': false, + 'link_mode_preference': 'prefer-static', + 'out_dir': outDirUri.toFilePath(), + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'target_android_ndk_api': 30, + 'target_architecture': 'invalid_architecture', + 'target_os': 'android', + 'version': latestVersion.toString(), + }; + expect( + () => LinkConfig(config).codeConfig, + throwsFormatException, + ); + }); +} diff --git a/pkgs/native_assets_cli/test/code_assets/validation_test.dart b/pkgs/native_assets_cli/test/code_assets/validation_test.dart new file mode 100644 index 000000000..09aa23571 --- /dev/null +++ b/pkgs/native_assets_cli/test/code_assets/validation_test.dart @@ -0,0 +1,287 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'package:test/test.dart'; + +void main() { + late Uri tempUri; + late Uri outDirUri; + late Uri outDirSharedUri; + late String packageName; + late Uri packageRootUri; + + setUp(() async { + tempUri = (await Directory.systemTemp.createTemp()).uri; + outDirUri = tempUri.resolve('out/'); + await Directory.fromUri(outDirUri).create(); + outDirSharedUri = tempUri.resolve('out_shared/'); + await Directory.fromUri(outDirSharedUri).create(); + packageName = 'my_package'; + packageRootUri = tempUri.resolve('$packageName/'); + await Directory.fromUri(packageRootUri).create(); + }); + + tearDown(() async { + await Directory.fromUri(tempUri).delete(recursive: true); + }); + + BuildConfigBuilder makeBuildConfigBuilder() { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: tempUri, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outDirSharedUri, + ); + return configBuilder; + } + + BuildConfig makeCodeBuildConfig({ + LinkModePreference linkModePreference = LinkModePreference.dynamic, + OS os = OS.iOS, + }) { + final builder = makeBuildConfigBuilder() + ..setupCodeConfig( + targetOS: os, + targetArchitecture: Architecture.arm64, + linkModePreference: linkModePreference, + ); + return BuildConfig(builder.json); + } + + test('file not set', () async { + final config = makeCodeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + outputBuilder.codeAssets.add(CodeAsset( + package: config.packageName, + name: 'foo.dylib', + architecture: config.codeConfig.targetArchitecture, + os: config.codeConfig.targetOS, + linkMode: DynamicLoadingBundled(), + )); + final errors = await validateCodeAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('has no file')), + ); + }); + + for (final (linkModePreference, linkMode) in [ + (LinkModePreference.static, DynamicLoadingBundled()), + (LinkModePreference.dynamic, StaticLinking()), + ]) { + test('native code asset wrong linking $linkModePreference', () async { + final config = + makeCodeBuildConfig(linkModePreference: linkModePreference); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.codeAssets.add( + CodeAsset( + package: config.packageName, + name: 'foo.dart', + file: assetFile.uri, + linkMode: linkMode, + os: config.codeConfig.targetOS, + architecture: config.codeConfig.targetArchitecture, + ), + ); + final errors = await validateCodeAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains( + 'which is not allowed by by the config link mode preference', + )), + ); + }); + } + + test('native code wrong architecture', () async { + final config = makeCodeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.codeAssets.add( + CodeAsset( + package: config.packageName, + name: 'foo.dart', + file: assetFile.uri, + linkMode: DynamicLoadingBundled(), + os: config.codeConfig.targetOS, + architecture: Architecture.x64, + ), + ); + final errors = await validateCodeAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains( + 'which is not the target architecture', + )), + ); + }); + + test('native code no architecture', () async { + final config = makeCodeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.codeAssets.add( + CodeAsset( + package: config.packageName, + name: 'foo.dart', + file: assetFile.uri, + linkMode: DynamicLoadingBundled(), + os: config.codeConfig.targetOS, + ), + ); + final errors = await validateCodeAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains( + 'has no architecture', + )), + ); + }); + + test('native code asset wrong os', () async { + final config = makeCodeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.codeAssets.add( + CodeAsset( + package: config.packageName, + name: 'foo.dart', + file: assetFile.uri, + linkMode: DynamicLoadingBundled(), + os: OS.windows, + architecture: config.codeConfig.targetArchitecture, + ), + ); + final errors = await validateCodeAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains( + 'which is not the target os', + )), + ); + }); + + test('duplicate dylib name', () async { + final config = makeCodeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final fileName = config.codeConfig.targetOS.dylibFileName('foo'); + final assetFile = File.fromUri(outDirUri.resolve(fileName)); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.codeAssets.addAll([ + CodeAsset( + package: config.packageName, + name: 'src/foo.dart', + file: assetFile.uri, + linkMode: DynamicLoadingBundled(), + os: config.codeConfig.targetOS, + architecture: config.codeConfig.targetArchitecture, + ), + CodeAsset( + package: config.packageName, + name: 'src/bar.dart', + file: assetFile.uri, + linkMode: DynamicLoadingBundled(), + os: config.codeConfig.targetOS, + architecture: config.codeConfig.targetArchitecture, + ), + ]); + final errors = await validateCodeAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('Duplicate dynamic library file name')), + ); + }); + + group('BuildConfig.codeConfig validation', () { + test('Missing targetIOSVersion', () async { + final builder = makeBuildConfigBuilder() + ..setupCodeConfig( + targetOS: OS.iOS, + targetArchitecture: Architecture.arm64, + linkModePreference: LinkModePreference.dynamic, + ); + final errors = + await validateCodeAssetBuildConfig(BuildConfig(builder.json)); + expect( + errors, + contains( + contains('BuildConfig.codeConfig.targetIOSVersion was missing'))); + expect( + errors, + contains( + contains('BuildConfig.codeConfig.targetIOSSdk was missing'))); + }); + test('Missing targetAndroidNdkApi', () async { + final builder = makeBuildConfigBuilder() + ..setupCodeConfig( + targetOS: OS.android, + targetArchitecture: Architecture.arm64, + linkModePreference: LinkModePreference.dynamic, + ); + expect( + await validateCodeAssetBuildConfig(BuildConfig(builder.json)), + contains(contains( + 'BuildConfig.codeConfig.targetAndroidNdkApi was missing'))); + }); + test('Missing targetMacOSVersion', () async { + final builder = makeBuildConfigBuilder() + ..setupCodeConfig( + targetOS: OS.macOS, + targetArchitecture: Architecture.arm64, + linkModePreference: LinkModePreference.dynamic, + ); + expect( + await validateCodeAssetBuildConfig(BuildConfig(builder.json)), + contains(contains( + 'BuildConfig.codeConfig.targetMacOSVersion was missing'))); + }); + test('Nonexisting compiler/archiver/linker/envScript', () async { + final nonExistent = outDirUri.resolve('foo baz'); + final builder = makeBuildConfigBuilder() + ..setupCodeConfig( + targetOS: OS.linux, + targetArchitecture: Architecture.arm64, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: CCompilerConfig( + compiler: nonExistent, + linker: nonExistent, + archiver: nonExistent, + envScript: nonExistent, + )); + final errors = + await validateCodeAssetBuildConfig(BuildConfig(builder.json)); + + bool matches(String error, String field) => + RegExp('BuildConfig.codeConfig.$field (.*foo baz).* does not exist.') + .hasMatch(error); + + expect(errors.any((e) => matches(e, 'compiler')), true); + expect(errors.any((e) => matches(e, 'linker')), true); + expect(errors.any((e) => matches(e, 'archiver')), true); + expect(errors.any((e) => matches(e, 'envScript')), true); + }); + }); +} diff --git a/pkgs/native_assets_cli/test/data_assets/data_asset_test.dart b/pkgs/native_assets_cli/test/data_assets/data_asset_test.dart new file mode 100644 index 000000000..3649b9b8b --- /dev/null +++ b/pkgs/native_assets_cli/test/data_assets/data_asset_test.dart @@ -0,0 +1,23 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:native_assets_cli/data_assets_builder.dart'; +import 'package:test/test.dart'; + +void main() async { + test('DataAsset', () { + expect( + DataAsset( + package: 'my_package', + name: 'name', + file: Uri.file('not there'), + ).encode().toJson(), + { + 'file': 'not there', + 'package': 'my_package', + 'name': 'name', + 'type': 'data', + }); + }); +} diff --git a/pkgs/native_assets_cli/test/data_assets/validation_test.dart b/pkgs/native_assets_cli/test/data_assets/validation_test.dart new file mode 100644 index 000000000..f38180203 --- /dev/null +++ b/pkgs/native_assets_cli/test/data_assets/validation_test.dart @@ -0,0 +1,108 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:native_assets_cli/data_assets_builder.dart'; +import 'package:test/test.dart'; + +void main() { + late Uri tempUri; + late Uri outDirUri; + late Uri outDirSharedUri; + late String packageName; + late Uri packageRootUri; + + setUp(() async { + tempUri = (await Directory.systemTemp.createTemp()).uri; + outDirUri = tempUri.resolve('out/'); + await Directory.fromUri(outDirUri).create(); + outDirSharedUri = tempUri.resolve('out_shared/'); + await Directory.fromUri(outDirSharedUri).create(); + packageName = 'my_package'; + packageRootUri = tempUri.resolve('$packageName/'); + await Directory.fromUri(packageRootUri).create(); + }); + + tearDown(() async { + await Directory.fromUri(tempUri).delete(recursive: true); + }); + + BuildConfig makeDataBuildConfig() { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: tempUri, + buildAssetTypes: [DataAsset.type]) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outDirSharedUri, + ); + return BuildConfig(configBuilder.json); + } + + test('file exists', () async { + final config = makeDataBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.txt')); + outputBuilder.dataAssets.add(DataAsset( + package: config.packageName, + name: 'foo.txt', + file: assetFile.uri, + )); + final errors = await validateDataAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('which does not exist')), + ); + }); + + test('asset id in wrong package', () async { + final config = makeDataBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.dataAssets.add(DataAsset( + package: 'different_package', + name: 'foo.txt', + file: assetFile.uri, + )); + final errors = await validateDataAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('Data asset must have package name my_package')), + ); + }); + + test('duplicate asset id', () async { + final config = makeDataBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.dataAssets.addAll([ + DataAsset( + package: config.packageName, + name: 'foo.txt', + file: assetFile.uri, + ), + DataAsset( + package: config.packageName, + name: 'foo.txt', + file: assetFile.uri, + ), + ]); + final errors = await validateDataAssetBuildOutput( + config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('More than one')), + ); + }); +} diff --git a/pkgs/native_assets_cli/test/example/local_asset_test.dart b/pkgs/native_assets_cli/test/example/local_asset_test.dart index 31f15c0a8..ce57a4b62 100644 --- a/pkgs/native_assets_cli/test/example/local_asset_test.dart +++ b/pkgs/native_assets_cli/test/example/local_asset_test.dart @@ -11,7 +11,7 @@ library; import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:test/test.dart'; import '../helpers.dart'; @@ -40,25 +40,26 @@ void main() async { final testPackageUri = packageUri.resolve('example/build/$name/'); final dartUri = Uri.file(Platform.resolvedExecutable); - final config = BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: name, - packageRoot: testPackageUri, - targetOS: OS.current, - version: HookConfigImpl.latestVersion, - linkModePreference: LinkModePreference.dynamic, - dryRun: dryRun, - linkingEnabled: false, - targetArchitecture: dryRun ? null : Architecture.current, - buildMode: dryRun ? null : BuildMode.debug, - cCompiler: dryRun ? null : cCompiler, - supportedAssetTypes: [CodeAsset.type], - ); + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageRoot: testPackageUri, + packageName: name, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildRunConfig( + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared) + ..setupBuildConfig(linkingEnabled: false, dryRun: dryRun) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: dryRun ? null : Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: dryRun ? null : cCompiler, + ); final buildConfigUri = testTempUri.resolve('build_config.json'); await File.fromUri(buildConfigUri) - .writeAsString(jsonEncode(config.toJson())); + .writeAsString(jsonEncode(configBuilder.json)); final processResult = await Process.run( dartUri.toFilePath(), @@ -76,12 +77,13 @@ void main() async { expect(processResult.exitCode, 0); final buildOutputUri = outputDirectory.resolve('build_output.json'); - final buildOutput = HookOutputImpl.fromJsonString( - await File.fromUri(buildOutputUri).readAsString()) as BuildOutput; + final buildOutput = BuildOutput( + json.decode(await File.fromUri(buildOutputUri).readAsString()) + as Map); final assets = buildOutput.encodedAssets; final dependencies = buildOutput.dependencies; if (dryRun) { - final codeAsset = buildOutput.codeAssets.all.first; + final codeAsset = buildOutput.codeAssets.first; expect(assets.length, greaterThanOrEqualTo(1)); expect(await File.fromUri(codeAsset.file!).exists(), false); expect(dependencies, []); diff --git a/pkgs/native_assets_cli/test/example/native_add_library_test.dart b/pkgs/native_assets_cli/test/example/native_add_library_test.dart index 5c82eca99..2a3415901 100644 --- a/pkgs/native_assets_cli/test/example/native_add_library_test.dart +++ b/pkgs/native_assets_cli/test/example/native_add_library_test.dart @@ -11,7 +11,7 @@ library; import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:test/test.dart'; import '../helpers.dart'; @@ -40,25 +40,26 @@ void main() async { final testPackageUri = packageUri.resolve('example/build/$name/'); final dartUri = Uri.file(Platform.resolvedExecutable); - final config = BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: name, - packageRoot: testPackageUri, - targetOS: OS.current, - version: HookConfigImpl.latestVersion, - linkModePreference: LinkModePreference.dynamic, - dryRun: dryRun, - linkingEnabled: false, - targetArchitecture: dryRun ? null : Architecture.current, - buildMode: dryRun ? null : BuildMode.debug, - cCompiler: dryRun ? null : cCompiler, - supportedAssetTypes: [CodeAsset.type], - ); + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageRoot: testPackageUri, + packageName: name, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildRunConfig( + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared) + ..setupBuildConfig(linkingEnabled: false, dryRun: dryRun) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: dryRun ? null : Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: dryRun ? null : cCompiler, + ); final buildConfigUri = testTempUri.resolve('build_config.json'); await File.fromUri(buildConfigUri) - .writeAsString(jsonEncode(config.toJson())); + .writeAsString(jsonEncode(configBuilder.json)); final processResult = await Process.run( dartUri.toFilePath(), @@ -76,8 +77,9 @@ void main() async { expect(processResult.exitCode, 0); final buildOutputUri = outputDirectory.resolve('build_output.json'); - final buildOutput = HookOutputImpl.fromJsonString( - await File.fromUri(buildOutputUri).readAsString()); + final buildOutput = BuildOutput( + json.decode(await File.fromUri(buildOutputUri).readAsString()) + as Map); final assets = buildOutput.encodedAssets; final dependencies = buildOutput.dependencies; if (dryRun) { diff --git a/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart b/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart index 4d7ea3feb..f90d91f15 100644 --- a/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart +++ b/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart @@ -6,26 +6,21 @@ 'mac-os': Timeout.factor(2), 'windows': Timeout.factor(10), }) -// TODO(https://github.com/dart-lang/native/issues/1415): Enable support -// for Windows once linker flags are supported by CBuilder. +// TODO(https://github.com/dart-lang/native/issues/190): Enable on windows once +// https://github.com/dart-lang/sdk/commit/903eea6bfb8ee405587f0866a1d1e92eea45d29e +// has landed in dev channel. @TestOn('!windows') library; import 'dart:convert'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:test/test.dart'; import '../helpers.dart'; void main() async { - if (Platform.isWindows) { - // TODO(https://github.com/dart-lang/native/issues/1415): Enable support - // for Windows once linker flags are supported by CBuilder. - return; - } - late Uri tempUri; const name = 'native_dynamic_linking'; @@ -49,25 +44,27 @@ void main() async { final testPackageUri = packageUri.resolve('example/build/$name/'); final dartUri = Uri.file(Platform.resolvedExecutable); - final config = BuildConfigImpl( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared, - packageName: name, - packageRoot: testPackageUri, - targetOS: OS.current, - version: HookConfigImpl.latestVersion, - linkModePreference: LinkModePreference.dynamic, - dryRun: dryRun, - linkingEnabled: false, - targetArchitecture: dryRun ? null : Architecture.current, - buildMode: dryRun ? null : BuildMode.debug, - cCompiler: dryRun ? null : cCompiler, - supportedAssetTypes: [CodeAsset.type], - ); + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageRoot: testPackageUri, + packageName: name, + buildAssetTypes: [CodeAsset.type], + ) + ..setupBuildRunConfig( + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared, + ) + ..setupBuildConfig(linkingEnabled: false, dryRun: dryRun) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: dryRun ? null : Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: dryRun ? null : cCompiler, + ); final buildConfigUri = testTempUri.resolve('build_config.json'); - File.fromUri(buildConfigUri) - .writeAsStringSync(jsonEncode(config.toJson())); + await File.fromUri(buildConfigUri) + .writeAsString(jsonEncode(configBuilder.json)); final processResult = await Process.run( dartUri.toFilePath(), @@ -85,8 +82,9 @@ void main() async { expect(processResult.exitCode, 0); final buildOutputUri = outputDirectory.resolve('build_output.json'); - final buildOutput = HookOutputImpl.fromJsonString( - await File.fromUri(buildOutputUri).readAsString()); + final buildOutput = BuildOutput( + json.decode(await File.fromUri(buildOutputUri).readAsString()) + as Map); final assets = buildOutput.encodedAssets; final dependencies = buildOutput.dependencies; if (dryRun) { diff --git a/pkgs/native_assets_cli/test/helpers.dart b/pkgs/native_assets_cli/test/helpers.dart index 6f02de316..cdd9c5d2b 100644 --- a/pkgs/native_assets_cli/test/helpers.dart +++ b/pkgs/native_assets_cli/test/helpers.dart @@ -5,8 +5,8 @@ import 'dart:io'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; -import 'package:native_assets_cli/native_assets_cli_internal.dart' as internal; +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'package:native_assets_cli/data_assets_builder.dart'; import 'package:test/test.dart'; const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; @@ -115,13 +115,15 @@ final List? _envScriptArgs = Platform /// Configuration for the native toolchain. /// /// Provided on Dart CI. -final cCompiler = internal.CCompilerConfig( - compiler: _cc, - archiver: _ar, - linker: _ld, - envScript: _envScript, - envScriptArgs: _envScriptArgs, -); +final cCompiler = (_cc == null || _ar == null || _ld == null) + ? null + : CCompilerConfig( + compiler: _cc!, + archiver: _ar!, + linker: _ld!, + envScript: _envScript, + envScriptArgs: _envScriptArgs, + ); extension on String { Uri asFileUri() => Uri.file(this); diff --git a/pkgs/native_assets_cli/test/link_config_test.dart b/pkgs/native_assets_cli/test/link_config_test.dart new file mode 100644 index 000000000..2cf9616ea --- /dev/null +++ b/pkgs/native_assets_cli/test/link_config_test.dart @@ -0,0 +1,143 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; + +import 'package:native_assets_cli/native_assets_cli_builder.dart'; +import 'package:native_assets_cli/src/config.dart' show latestVersion; +import 'package:test/test.dart'; + +void main() async { + late Uri outDirUri; + late Uri outputDirectoryShared; + late String packageName; + late Uri packageRootUri; + late List assets; + + setUp(() async { + final tempUri = Directory.systemTemp.uri; + outDirUri = tempUri.resolve('out1/'); + outputDirectoryShared = tempUri.resolve('out_shared1/'); + packageName = 'my_package'; + packageRootUri = tempUri.resolve('$packageName/'); + assets = [ + for (int i = 0; i < 3; i++) + EncodedAsset('my-asset-type', {'a-$i': 'v-$i'}) + ]; + }); + + test('LinkConfigBuilder->JSON->LinkConfig', () { + final configBuilder = LinkConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: packageRootUri, + buildAssetTypes: ['asset-type-1', 'asset-type-2'], + ) + ..setupLinkConfig(assets: assets) + ..setupLinkRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outputDirectoryShared, + recordedUsesFile: null, + ); + final config = LinkConfig(configBuilder.json); + + final expectedConfigJson = { + 'assets': [for (final asset in assets) asset.toJson()], + 'build_asset_types': ['asset-type-1', 'asset-type-2'], + 'build_mode': 'release', + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'out_dir': outDirUri.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'supported_asset_types': ['asset-type-1', 'asset-type-2'], + 'version': latestVersion.toString(), + }; + expect(config.json, expectedConfigJson); + expect(json.decode(config.toString()), expectedConfigJson); + + expect(config.outputDirectory, outDirUri); + expect(config.outputDirectoryShared, outputDirectoryShared); + + expect(config.packageName, packageName); + expect(config.packageRoot, packageRootUri); + expect(config.buildAssetTypes, ['asset-type-1', 'asset-type-2']); + expect(config.encodedAssets, assets); + }); + + group('LinkConfig FormatExceptions', () { + for (final version in ['9001.0.0', '0.0.1']) { + test('LinkConfig version $version', () { + final outDir = outDirUri; + final config = { + 'link_mode_preference': 'prefer-static', + 'out_dir': outDir.toFilePath(), + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'package_root': packageRootUri.toFilePath(), + 'target_os': 'linux', + 'version': version, + 'package_name': packageName, + 'build_asset_types': ['my-asset-type'], + 'dry_run': true, + }; + expect( + () => LinkConfig(config), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains(version) && + e.message.contains(latestVersion.toString()), + )), + ); + }); + } + test('LinkConfig FormatExceptions', () { + expect( + () => LinkConfig({}), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains('No value was provided for required key: '), + )), + ); + expect( + () => LinkConfig({ + 'version': latestVersion.toString(), + 'build_asset_types': ['my-asset-type'], + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'target_os': 'android', + 'assets': [], + }), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains( + 'No value was provided for required key: out_dir', + ), + )), + ); + expect( + () => LinkConfig({ + 'version': latestVersion.toString(), + 'build_asset_types': ['my-asset-type'], + 'out_dir': outDirUri.toFilePath(), + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'target_os': 'android', + 'assets': 'astring', + }), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains( + "Unexpected value 'astring' for key '.assets' in config file. " + 'Expected a List?.', + ), + )), + ); + }); + }); +} diff --git a/pkgs/native_assets_cli/test/link_output_test.dart b/pkgs/native_assets_cli/test/link_output_test.dart new file mode 100644 index 000000000..5d3a7d74d --- /dev/null +++ b/pkgs/native_assets_cli/test/link_output_test.dart @@ -0,0 +1,63 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:native_assets_cli/native_assets_cli_builder.dart'; +import 'package:native_assets_cli/src/utils/datetime.dart'; +import 'package:test/test.dart'; + +void main() { + test('LinkOutputBuilder->JSON->LinkOutput', () { + final assets = [ + for (int i = 0; i < 3; i++) + EncodedAsset('my-asset-type', {'a-$i': 'v-$i'}) + ]; + final uris = [ + for (int i = 0; i < 3; ++i) Uri.file('path$i'), + ]; + final before = DateTime.now().roundDownToSeconds(); + final builder = LinkOutputBuilder(); + final after = DateTime.now().roundDownToSeconds(); + + builder.addDependency(uris.take(1).single); + builder.addDependencies(uris.skip(1).toList()); + + builder.addEncodedAsset(assets.take(1).single); + builder.addEncodedAssets(assets.skip(1).take(2).toList()); + + final config = BuildOutput(builder.json); + expect(config.timestamp.compareTo(before), greaterThanOrEqualTo(0)); + expect(config.timestamp.compareTo(after), lessThanOrEqualTo(0)); + expect( + config.timestamp + .isAtSameMomentAs(config.timestamp.roundDownToSeconds()), + true); + + // The JSON format of the link output. + { + 'version': '1.6.0', + 'dependencies': ['path0', 'path1', 'path2'], + 'assets': [ + {'a-0': 'v-0', 'type': 'my-asset-type'}, + {'a-1': 'v-1', 'type': 'my-asset-type'}, + {'a-2': 'v-2', 'type': 'my-asset-type'} + ] + }.forEach((k, v) { + expect(config.json[k], equals(v)); + }); + }); + + for (final version in ['9001.0.0', '0.0.1']) { + test('LinkOutput version $version', () { + expect( + () => LinkOutput({'version': version}), + throwsA(predicate( + (e) => + e is FormatException && + e.message.contains(version) && + e.message.contains(HookOutput.latestVersion.toString()), + )), + ); + }); + } +} diff --git a/pkgs/native_assets_cli/test/model/asset_test.dart b/pkgs/native_assets_cli/test/model/asset_test.dart index e6d268812..af23ffaf3 100644 --- a/pkgs/native_assets_cli/test/model/asset_test.dart +++ b/pkgs/native_assets_cli/test/model/asset_test.dart @@ -3,7 +3,8 @@ // BSD-style license that can be found in the LICENSE file. import 'package:collection/collection.dart'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'package:native_assets_cli/data_assets.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/model/build_config_test.dart b/pkgs/native_assets_cli/test/model/build_config_test.dart deleted file mode 100644 index 08afdbb0d..000000000 --- a/pkgs/native_assets_cli/test/model/build_config_test.dart +++ /dev/null @@ -1,604 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import 'package:test/test.dart'; - -void main() async { - const packageName = 'my_package'; - late Uri tempUri; - late Uri outDirUri; - late Uri outDir2Uri; - late Uri outputDirectoryShared; - late Uri outputDirectoryShared2; - late Uri packageRootUri; - late Uri fakeClang; - late Uri fakeLd; - late Uri fakeAr; - late Uri fakeCl; - late Uri fakeVcVars; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - outDirUri = tempUri.resolve('out1/'); - await Directory.fromUri(outDirUri).create(); - outDir2Uri = tempUri.resolve('out2/'); - await Directory.fromUri(outDir2Uri).create(); - outputDirectoryShared = tempUri.resolve('out_shared1/'); - await Directory.fromUri(outputDirectoryShared).create(); - outputDirectoryShared2 = tempUri.resolve('out_shared2/'); - await Directory.fromUri(outputDirectoryShared2).create(); - packageRootUri = tempUri.resolve('$packageName/'); - await Directory.fromUri(packageRootUri).create(); - fakeClang = tempUri.resolve('fake_clang'); - await File.fromUri(fakeClang).create(); - fakeLd = tempUri.resolve('fake_ld'); - await File.fromUri(fakeLd).create(); - fakeAr = tempUri.resolve('fake_ar'); - await File.fromUri(fakeAr).create(); - fakeCl = tempUri.resolve('cl.exe'); - await File.fromUri(fakeCl).create(); - fakeVcVars = tempUri.resolve('vcvarsall.bat'); - await File.fromUri(fakeVcVars).create(); - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - test('BuildConfig ==', () { - final config1 = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - archiver: fakeAr, - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final config2 = BuildConfigImpl( - outputDirectory: outDir2Uri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - expect(config1, equals(config1)); - expect(config1 == config2, false); - expect(config1.outputDirectory != config2.outputDirectory, true); - expect(config1.packageRoot, config2.packageRoot); - expect(config1.targetArchitecture == config2.targetArchitecture, true); - expect(config1.targetOS != config2.targetOS, true); - expect(config1.targetIOSSdk, IOSSdk.iPhoneOS); - expect(() => config2.targetIOSSdk, throwsStateError); - expect(config1.cCompiler.compiler != config2.cCompiler.compiler, true); - expect(config1.cCompiler.linker != config2.cCompiler.linker, true); - expect(config1.cCompiler.archiver != config2.cCompiler.archiver, true); - expect(config1.cCompiler.envScript == config2.cCompiler.envScript, true); - expect(config1.cCompiler.envScriptArgs == config2.cCompiler.envScriptArgs, - true); - expect(config1.cCompiler != config2.cCompiler, true); - expect(config1.linkModePreference, config2.linkModePreference); - expect(config1.linkingEnabled, config2.linkingEnabled); - }); - - test('BuildConfig fromConfig', () { - final buildConfig2 = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final config = { - 'supported_asset_types': [CodeAsset.type], - 'build_mode': 'release', - 'dry_run': false, - 'linking_enabled': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_android_ndk_api': 30, - 'target_architecture': 'arm64', - 'target_os': 'android', - 'version': HookOutputImpl.latestVersion.toString(), - }; - - final fromConfig = BuildConfigImpl.fromJson(config); - expect(fromConfig, equals(buildConfig2)); - }); - - test('BuildConfig.dryRun', () { - final buildConfig2 = BuildConfigImpl.dryRun( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetOS: OS.android, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final config = { - 'dry_run': true, - 'supported_asset_types': [CodeAsset.type], - 'linking_enabled': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_os': 'android', - 'version': HookOutputImpl.latestVersion.toString(), - }; - - final fromConfig = BuildConfigImpl.fromJson(config); - expect(fromConfig, equals(buildConfig2)); - }); - - test('BuildConfig toJson fromConfig', () { - final buildConfig1 = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final configFile = buildConfig1.toJson(); - final fromConfig = BuildConfigImpl.fromJson(configFile); - expect(fromConfig, equals(buildConfig1)); - }); - - test('BuildConfig == dependency metadata', () { - final buildConfig1 = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - dependencyMetadata: { - 'bar': const Metadata({ - 'key': 'value', - 'foo': ['asdf', 'fdsa'], - }), - 'foo': const Metadata({ - 'key': 321, - }), - }, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final buildConfig2 = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - dependencyMetadata: { - 'bar': const Metadata({ - 'key': 'value', - }), - 'foo': const Metadata({ - 'key': 123, - }), - }, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - expect(buildConfig1, equals(buildConfig1)); - expect(buildConfig1 == buildConfig2, false); - expect(buildConfig1.hashCode == buildConfig2.hashCode, false); - }); - - test('BuildConfig toJson fromJson', () { - final outDir = outDirUri; - final buildConfig1 = BuildConfigImpl( - outputDirectory: outDir, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - // This map should be sorted on key for two layers. - dependencyMetadata: { - 'foo': const Metadata({ - 'z': ['z', 'a'], - 'a': 321, - }), - 'bar': const Metadata({ - 'key': 'value', - }), - }, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final jsonObject = buildConfig1.toJson(); - final expectedJson = { - 'build_mode': 'release', - 'c_compiler': {'cc': fakeClang.toFilePath(), 'ld': fakeLd.toFilePath()}, - 'dependency_metadata': { - 'bar': {'key': 'value'}, - 'foo': { - 'a': 321, - 'z': ['z', 'a'] - } - }, - 'linking_enabled': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'supported_asset_types': [CodeAsset.type], - 'target_architecture': 'arm64', - 'target_ios_sdk': 'iphoneos', - 'target_os': 'ios', - 'version': '${HookConfigImpl.latestVersion}' - }; - expect( - jsonObject, - equals(expectedJson), - ); - - final buildConfig2 = BuildConfigImpl.fromJson(jsonObject); - expect(buildConfig2, buildConfig1); - }); - - test('BuildConfig FormatExceptions', () { - expect( - () => BuildConfigImpl.fromJson({}), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - 'No value was provided for required key: target_os', - ), - )), - ); - expect( - () => BuildConfigImpl.fromJson({ - 'version': HookConfigImpl.latestVersion.toString(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_os': 'android', - 'target_android_ndk_api': 30, - 'link_mode_preference': 'prefer-static', - 'supported_asset_types': [CodeAsset.type], - }), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - 'No value was provided for required key: out_dir', - ), - )), - ); - expect( - () => BuildConfigImpl.fromJson({ - 'version': HookConfigImpl.latestVersion.toString(), - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_os': 'android', - 'target_android_ndk_api': 30, - 'link_mode_preference': 'prefer-static', - 'build_mode': BuildMode.release.name, - 'supported_asset_types': [CodeAsset.type], - 'dependency_metadata': { - 'bar': {'key': 'value'}, - 'foo': [], - }, - }), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - "Unexpected value '[]' for key 'dependency_metadata.foo' in " - 'config file. Expected a Map.', - ), - )), - ); - expect( - () => BuildConfigImpl.fromJson({ - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'version': HookConfigImpl.latestVersion.toString(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_os': 'android', - 'link_mode_preference': 'prefer-static', - 'supported_asset_types': [CodeAsset.type], - 'build_mode': BuildMode.release.name, - }), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - 'No value was provided for required key: target_android_ndk_api', - ), - )), - ); - }); - - test('BuildConfig toString', () { - final config = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - config.toString(); - }); - - test('BuildConfig fromArgs', () async { - final buildConfig = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.preferStatic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - final configFileContents = buildConfig.toJsonString(); - final configUri = tempUri.resolve('config.json'); - final configFile = File.fromUri(configUri); - await configFile.writeAsString(configFileContents); - final buildConfig2 = BuildConfigImpl.fromArguments( - ['--config', configUri.toFilePath()], - environment: {}, // Don't inherit the test environment. - ); - expect(buildConfig2, buildConfig); - }); - - test('envScript', () { - final buildConfig1 = BuildConfigImpl( - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.x64, - targetOS: OS.windows, - cCompiler: CCompilerConfig( - compiler: fakeCl, - envScript: fakeVcVars, - envScriptArgs: ['x64'], - ), - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - - final configFile = buildConfig1.toJson(); - final fromConfig = BuildConfigImpl.fromJson(configFile); - expect(fromConfig, equals(buildConfig1)); - }); - - for (final version in ['9001.0.0', '0.0.1']) { - test('BuildConfig version $version', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_root': tempUri.toFilePath(), - 'target_os': 'linux', - 'version': version, - 'package_name': packageName, - 'supported_asset_types': [CodeAsset.type], - 'dry_run': true, - }; - expect( - () => BuildConfigImpl.fromJson(config), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains(version) && - e.message.contains(HookConfigImpl.latestVersion.toString()), - )), - ); - }); - } - - test('BuildConfig invalid target os architecture combination', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'windows', - 'target_architecture': 'arm', - 'build_mode': 'debug', - 'supported_asset_types': [CodeAsset.type], - 'version': HookConfigImpl.latestVersion.toString(), - }; - expect( - () => BuildConfigImpl.fromJson(config), - throwsA(predicate( - (e) => e is FormatException && e.message.contains('arm'), - )), - ); - }); - - test('BuildConfig dry_run access invalid args', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'windows', - 'target_architecture': 'arm64', - 'build_mode': 'debug', - 'dry_run': true, - 'supported_asset_types': [CodeAsset.type], - 'version': HookConfigImpl.latestVersion.toString(), - }; - expect( - () => BuildConfigImpl.fromJson(config), - throwsA(predicate( - (e) => - e is FormatException && e.message.contains('In Flutter projects'), - )), - ); - }); - - test('BuildConfig dry_run access invalid args', () { - final outDir = outDirUri; - final config = { - 'dry_run': true, - 'linking_enabled': true, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'android', - 'supported_asset_types': [CodeAsset.type], - 'version': HookConfigImpl.latestVersion.toString(), - }; - final buildConfig = BuildConfigImpl.fromJson(config); - expect( - () => buildConfig.targetAndroidNdkApi, - throwsA(predicate( - (e) => e is StateError && e.message.contains('In Flutter projects'), - )), - ); - }); - - test('BuildConfig dry_run target arch', () { - final outDir = outDirUri; - final config = { - 'dry_run': true, - 'linking_enabled': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'windows', - 'supported_asset_types': [CodeAsset.type], - 'version': HookConfigImpl.latestVersion.toString(), - }; - final buildConfig = BuildConfigImpl.fromJson(config); - expect(buildConfig.targetArchitecture, isNull); - }); - - test('BuildConfig dry_run toString', () { - final buildConfig = BuildConfigImpl.dryRun( - packageName: packageName, - outputDirectoryShared: outputDirectoryShared, - outputDirectory: outDirUri, - packageRoot: tempUri, - targetOS: OS.windows, - linkModePreference: LinkModePreference.dynamic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - buildConfig.toJsonString(); - // No crash. - }); - - test('invalid architecture', () { - final config = { - 'build_mode': 'release', - 'dry_run': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_android_ndk_api': 30, - 'target_architecture': 'invalid_architecture', - 'target_os': 'android', - 'supported_asset_types': [CodeAsset.type], - 'version': HookOutputImpl.latestVersion.toString(), - }; - expect( - () => BuildConfigImpl.fromJson(config), - throwsFormatException, - ); - }); -} diff --git a/pkgs/native_assets_cli/test/model/build_output_test.dart b/pkgs/native_assets_cli/test/model/build_output_test.dart deleted file mode 100644 index 7f28a0ffb..000000000 --- a/pkgs/native_assets_cli/test/model/build_output_test.dart +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import 'package:pub_semver/pub_semver.dart'; -import 'package:test/test.dart'; - -void main() { - late Uri tempUri; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - final jsonEncoding = { - 'timestamp': '2022-11-10 13:25:01.000', - 'assets': [ - { - 'architecture': 'x64', - 'file': Uri.file('path/to/libfoo.so').toFilePath(), - 'id': 'package:my_package/foo', - 'link_mode': {'type': 'dynamic_loading_bundle'}, - 'os': 'android', - 'type': 'native_code' - }, - { - 'architecture': 'x64', - 'id': 'package:my_package/foo2', - 'link_mode': { - 'type': 'dynamic_loading_system', - 'uri': Uri.file('path/to/libfoo2.so').toFilePath(), - }, - 'os': 'android', - 'type': 'native_code' - }, - { - 'architecture': 'x64', - 'id': 'package:my_package/foo3', - 'link_mode': {'type': 'dynamic_loading_process'}, - 'os': 'android', - 'type': 'native_code' - }, - { - 'architecture': 'x64', - 'id': 'package:my_package/foo4', - 'link_mode': {'type': 'dynamic_loading_executable'}, - 'os': 'android', - 'type': 'native_code' - } - ], - 'assetsForLinking': { - 'my_package': [ - { - 'name': 'data', - 'package': 'my_package', - 'file': Uri.file('path/to/data').toFilePath(), - 'type': 'data' - } - ], - 'my_package_2': [ - { - 'name': 'data', - 'package': 'my_package', - 'file': Uri.file('path/to/data2').toFilePath(), - 'type': 'data' - } - ] - }, - 'dependencies': [ - Uri.file('path/to/file.ext').toFilePath(), - ], - 'metadata': {'key': 'value'}, - 'version': '${HookOutputImpl.latestVersion}' - }; - - test('built info json', () { - final buildOutput = getBuildOutput(); - final json = buildOutput.toJson(HookOutputImpl.latestVersion); - expect(json, jsonEncoding); - - final buildOutput2 = HookOutputImpl.fromJson(json); - expect(buildOutput.hashCode, buildOutput2.hashCode); - expect(buildOutput, buildOutput2); - }); - - test('BuildOutput.toString', getBuildOutput().toString); - - test('BuildOutput.hashCode', () { - final buildOutput = getBuildOutput(); - final buildOutput2 = HookOutputImpl.fromJson(jsonEncoding); - expect(buildOutput.hashCode, buildOutput2.hashCode); - - final buildOutput3 = HookOutputImpl( - timestamp: DateTime.parse('2022-11-10 13:25:01.000'), - ); - expect(buildOutput.hashCode != buildOutput3.hashCode, true); - }); - - test('BuildOutput.readFromFile BuildOutput.writeToFile', () async { - final outDir = tempUri.resolve('out_dir/'); - final outDirShared = tempUri.resolve('out_dir_shared/'); - final packageRoot = tempUri.resolve('package_root/'); - await Directory.fromUri(outDir).create(); - await Directory.fromUri(outDirShared).create(); - await Directory.fromUri(packageRoot).create(); - final config = BuildConfigImpl( - outputDirectory: outDir, - outputDirectoryShared: outDirShared, - packageName: 'dontcare', - packageRoot: packageRoot, - buildMode: BuildMode.debug, - targetArchitecture: Architecture.arm64, - targetOS: OS.macOS, - linkModePreference: LinkModePreference.dynamic, - linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], - ); - final buildOutput = getBuildOutput(); - await buildOutput.writeToFile(config: config); - final buildOutput2 = HookOutputImpl.readFromFile(file: config.outputFile); - expect(buildOutput2, buildOutput); - }); - - test('BuildOutput.readFromFile BuildOutput.writeToFile V1.1.0', () async { - final outDir = tempUri.resolve('out_dir/'); - final outDirShared = tempUri.resolve('out_dir_shared/'); - final packageRoot = tempUri.resolve('package_root/'); - await Directory.fromUri(outDir).create(); - await Directory.fromUri(outDirShared).create(); - await Directory.fromUri(packageRoot).create(); - final config = BuildConfigImpl( - outputDirectory: outDir, - outputDirectoryShared: outDirShared, - packageName: 'dontcare', - packageRoot: packageRoot, - buildMode: BuildMode.debug, - targetArchitecture: Architecture.arm64, - targetOS: OS.macOS, - linkModePreference: LinkModePreference.dynamic, - version: Version(1, 1, 0), - linkingEnabled: null, // version < 1.4.0 - supportedAssetTypes: [CodeAsset.type], - ); - final buildOutput = getBuildOutput(withLinkedAssets: false); - await buildOutput.writeToFile(config: config); - final buildOutput2 = HookOutputImpl.readFromFile(file: config.outputFile); - expect(buildOutput2, buildOutput); - }); - - test('Round timestamp', () { - final buildOutput3 = HookOutputImpl( - timestamp: DateTime.parse('2022-11-10 13:25:01.372257'), - ); - expect(buildOutput3.timestamp, DateTime.parse('2022-11-10 13:25:01.000')); - }); - - for (final version in ['9001.0.0', '0.0.1']) { - test('BuildOutput version $version', () { - expect( - () => HookOutputImpl.fromJsonString('{"version": "$version"}'), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains(version) && - e.message.contains(HookOutputImpl.latestVersion.toString()), - )), - ); - }); - } - - test('BuildOutput dependencies can be modified', () { - final buildOutput = HookOutputImpl(); - expect( - () => buildOutput.addDependencies([Uri.file('path/to/file.ext')]), - returnsNormally, - ); - }); - - test('BuildOutput setters', () { - final buildOutput = HookOutputImpl( - timestamp: DateTime.parse('2022-11-10 13:25:01.000'), - encodedAssets: [ - CodeAsset( - package: 'my_package', - name: 'foo', - file: Uri(path: 'path/to/libfoo.so'), - linkMode: DynamicLoadingBundled(), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - CodeAsset( - package: 'my_package', - name: 'foo2', - linkMode: DynamicLoadingSystem(Uri(path: 'path/to/libfoo2.so')), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - ], - dependencies: Dependencies([ - Uri.file('path/to/file.ext'), - Uri.file('path/to/file2.ext'), - ]), - metadata: const Metadata({ - 'key': 'value', - 'key2': 'value2', - }), - ); - - final buildOutput2 = HookOutputImpl( - timestamp: DateTime.parse('2022-11-10 13:25:01.000'), - ); - buildOutput2.addEncodedAsset( - CodeAsset( - package: 'my_package', - name: 'foo', - file: Uri(path: 'path/to/libfoo.so'), - linkMode: DynamicLoadingBundled(), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - ); - buildOutput2.addEncodedAssets([ - CodeAsset( - package: 'my_package', - name: 'foo2', - linkMode: DynamicLoadingSystem(Uri(path: 'path/to/libfoo2.so')), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - ]); - buildOutput2.addDependency( - Uri.file('path/to/file.ext'), - ); - buildOutput2.addDependencies([ - Uri.file('path/to/file2.ext'), - ]); - buildOutput2.addMetadata({ - 'key': 'value', - }); - buildOutput2.addMetadatum('key2', 'value2'); - - expect(buildOutput2, equals(buildOutput)); - expect( - buildOutput2.dependenciesModel, equals(buildOutput.dependenciesModel)); - expect(buildOutput2.metadataModel, equals(buildOutput.metadataModel)); - }); -} - -HookOutputImpl getBuildOutput({bool withLinkedAssets = true}) => HookOutputImpl( - timestamp: DateTime.parse('2022-11-10 13:25:01.000'), - encodedAssets: [ - CodeAsset( - package: 'my_package', - name: 'foo', - file: Uri(path: 'path/to/libfoo.so'), - linkMode: DynamicLoadingBundled(), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - CodeAsset( - package: 'my_package', - name: 'foo2', - linkMode: DynamicLoadingSystem(Uri(path: 'path/to/libfoo2.so')), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - CodeAsset( - package: 'my_package', - name: 'foo3', - linkMode: LookupInProcess(), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - CodeAsset( - package: 'my_package', - name: 'foo4', - linkMode: LookupInExecutable(), - os: OS.android, - architecture: Architecture.x64, - ).encode(), - ], - encodedAssetsForLinking: withLinkedAssets - ? { - 'my_package': [ - DataAsset( - file: Uri.file('path/to/data'), - name: 'data', - package: 'my_package', - ).encode() - ], - 'my_package_2': [ - DataAsset( - file: Uri.file('path/to/data2'), - name: 'data', - package: 'my_package', - ).encode() - ] - } - : null, - dependencies: Dependencies([ - Uri.file('path/to/file.ext'), - ]), - metadata: const Metadata({ - 'key': 'value', - }), - ); diff --git a/pkgs/native_assets_cli/test/model/checksum_test.dart b/pkgs/native_assets_cli/test/model/checksum_test.dart deleted file mode 100644 index cff247336..000000000 --- a/pkgs/native_assets_cli/test/model/checksum_test.dart +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import 'package:test/test.dart'; - -import '../helpers.dart'; - -void main() { - const packageName = 'my_package'; - test('checksum', () async { - await inTempDir((tempUri) async { - final nativeAddUri = tempUri.resolve('native_add/'); - final fakeClangUri = tempUri.resolve('fake_clang'); - await File.fromUri(fakeClangUri).create(); - - final name1 = HookConfigImpl.checksum( - packageName: packageName, - packageRoot: nativeAddUri, - targetArchitecture: Architecture.x64, - targetOS: OS.linux, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - hook: Hook.build, - version: HookConfigImpl.latestVersion, - linkingEnabled: true, - ); - - // Using the checksum for a build folder should be stable. - expect(name1, '8780162e48a4539f01ea483fda6c1efc'); - - // Build folder different due to metadata. - final name2 = HookConfigImpl.checksum( - packageName: packageName, - packageRoot: nativeAddUri, - targetArchitecture: Architecture.x64, - targetOS: OS.linux, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - dependencyMetadata: { - 'foo': const Metadata({'key': 'value'}) - }, - hook: Hook.build, - version: HookConfigImpl.latestVersion, - linkingEnabled: true, - ); - printOnFailure([name1, name2].toString()); - expect(name1 != name2, true); - - // Build folder different due to cc. - final name3 = HookConfigImpl.checksum( - packageName: packageName, - packageRoot: nativeAddUri, - targetArchitecture: Architecture.x64, - targetOS: OS.linux, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - cCompiler: CCompilerConfig( - compiler: fakeClangUri, - ), - hook: Hook.build, - version: HookConfigImpl.latestVersion, - linkingEnabled: true, - ); - printOnFailure([name1, name3].toString()); - expect(name1 != name3, true); - - // Build folder different due to hook. - final name4 = HookConfigImpl.checksum( - packageName: packageName, - packageRoot: nativeAddUri, - targetArchitecture: Architecture.x64, - targetOS: OS.linux, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - cCompiler: CCompilerConfig( - compiler: fakeClangUri, - ), - hook: Hook.link, - version: HookConfigImpl.latestVersion, - linkingEnabled: true, - ); - printOnFailure([name1, name4].toString()); - expect(name1 != name4, true); - - // Build folder different due to haslinkPhase. - final name5 = HookConfigImpl.checksum( - packageName: packageName, - packageRoot: nativeAddUri, - targetArchitecture: Architecture.x64, - targetOS: OS.linux, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - hook: Hook.build, - version: HookConfigImpl.latestVersion, - linkingEnabled: false, - ); - printOnFailure([name1, name5].toString()); - expect(name1, isNot(name5)); - }); - }); -} diff --git a/pkgs/native_assets_cli/test/model/dependencies_test.dart b/pkgs/native_assets_cli/test/model/dependencies_test.dart index e11aeb954..549431160 100644 --- a/pkgs/native_assets_cli/test/model/dependencies_test.dart +++ b/pkgs/native_assets_cli/test/model/dependencies_test.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/native_assets_cli_builder.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/model/link_config_test.dart b/pkgs/native_assets_cli/test/model/link_config_test.dart deleted file mode 100644 index 1f07cc4e2..000000000 --- a/pkgs/native_assets_cli/test/model/link_config_test.dart +++ /dev/null @@ -1,517 +0,0 @@ -// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import 'package:test/test.dart'; - -void main() async { - late Uri tempUri; - late Uri outDirUri; - late Uri outDir2Uri; - late Uri outputDirectoryShared; - late Uri outputDirectoryShared2; - const packageName = 'my_package'; - late Uri packageRootUri; - late Uri fakeClang; - late Uri fakeLd; - late Uri fakeAr; - late Uri fakeCl; - late Uri fakeVcVars; - late Uri recordedUsagesFile; - final assets = [ - DataAsset( - package: packageName, - name: 'name', - file: Uri.file('nonexistent'), - ).encode(), - CodeAsset( - package: packageName, - name: 'name2', - linkMode: DynamicLoadingBundled(), - os: OS.android, - file: Uri.file('not there'), - architecture: Architecture.riscv64, - ).encode(), - ]; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - outDirUri = tempUri.resolve('out1/'); - await Directory.fromUri(outDirUri).create(); - outDir2Uri = tempUri.resolve('out2/'); - await Directory.fromUri(outDir2Uri).create(); - outputDirectoryShared = tempUri.resolve('out_shared1/'); - await Directory.fromUri(outputDirectoryShared).create(); - outputDirectoryShared2 = tempUri.resolve('out_shared2/'); - await Directory.fromUri(outputDirectoryShared2).create(); - packageRootUri = tempUri.resolve('$packageName/'); - await Directory.fromUri(packageRootUri).create(); - fakeClang = tempUri.resolve('fake_clang'); - await File.fromUri(fakeClang).create(); - fakeLd = tempUri.resolve('fake_ld'); - await File.fromUri(fakeLd).create(); - fakeAr = tempUri.resolve('fake_ar'); - await File.fromUri(fakeAr).create(); - fakeCl = tempUri.resolve('cl.exe'); - await File.fromUri(fakeCl).create(); - fakeVcVars = tempUri.resolve('vcvarsall.bat'); - await File.fromUri(fakeVcVars).create(); - recordedUsagesFile = tempUri.resolve('recorded_usages.json'); - File.fromUri(recordedUsagesFile).createSync(); - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - test('LinkConfig ==', () { - final config1 = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - archiver: fakeAr, - ), - buildMode: BuildMode.release, - encodedAssets: assets, - recordedUsagesFile: recordedUsagesFile, - linkModePreference: LinkModePreference.preferStatic, - ); - - final config2 = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDir2Uri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - encodedAssets: [], - recordedUsagesFile: null, - linkModePreference: LinkModePreference.preferStatic, - ); - - expect(config1, equals(config1)); - expect(config1 == config2, false); - expect(config1.outputDirectory != config2.outputDirectory, true); - expect(config1.packageRoot, config2.packageRoot); - expect(config1.targetArchitecture == config2.targetArchitecture, true); - expect(config1.targetOS != config2.targetOS, true); - expect(config1.targetIOSSdk, IOSSdk.iPhoneOS); - expect(() => config2.targetIOSSdk, throwsStateError); - expect(config1.cCompiler.compiler != config2.cCompiler.compiler, true); - expect(config1.cCompiler.linker != config2.cCompiler.linker, true); - expect(config1.cCompiler.archiver != config2.cCompiler.archiver, true); - expect(config1.cCompiler.envScript == config2.cCompiler.envScript, true); - expect(config1.cCompiler.envScriptArgs == config2.cCompiler.envScriptArgs, - true); - expect(config1.cCompiler != config2.cCompiler, true); - expect(config1.encodedAssets != config2.encodedAssets, true); - }); - - test('LinkConfig fromConfig', () { - final buildConfig2 = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - encodedAssets: assets, - linkModePreference: LinkModePreference.preferStatic, - ); - - final config = { - 'build_mode': 'release', - 'supported_asset_types': [CodeAsset.type], - 'dry_run': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_android_ndk_api': 30, - 'target_architecture': 'arm64', - 'target_os': 'android', - 'version': HookOutputImpl.latestVersion.toString(), - 'assets': [for (final asset in assets) asset.toJson()], - }; - - final fromConfig = LinkConfigImpl.fromJson(config); - expect(fromConfig, equals(buildConfig2)); - }); - - test('LinkConfig.dryRun', () { - final buildConfig2 = LinkConfigImpl.dryRun( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetOS: OS.android, - encodedAssets: [], - linkModePreference: LinkModePreference.preferStatic, - ); - - final config = { - 'dry_run': true, - 'supported_asset_types': [CodeAsset.type], - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_os': 'android', - 'version': HookOutputImpl.latestVersion.toString(), - 'assets': [], - }; - - final fromConfig = LinkConfigImpl.fromJson(config); - expect(fromConfig, equals(buildConfig2)); - }); - - test('LinkConfig toJson fromConfig', () { - final buildConfig1 = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: packageRootUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - ), - buildMode: BuildMode.release, - encodedAssets: assets, - linkModePreference: LinkModePreference.preferStatic, - ); - - final configFile = buildConfig1.toJson(); - final fromConfig = LinkConfigImpl.fromJson(configFile); - expect(fromConfig, equals(buildConfig1)); - }); - - test('LinkConfig toJson fromJson', () { - final outDir = outDirUri; - final buildConfig1 = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDir, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - ), - buildMode: BuildMode.release, - encodedAssets: assets, - linkModePreference: LinkModePreference.preferStatic, - ); - - final jsonObject = buildConfig1.toJson(); - final expectedJson = { - 'assets': [for (final asset in assets) asset.toJson()], - 'supported_asset_types': [CodeAsset.type], - 'build_mode': 'release', - 'c_compiler': {'cc': fakeClang.toFilePath(), 'ld': fakeLd.toFilePath()}, - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_ios_sdk': 'iphoneos', - 'target_os': 'ios', - 'version': '${HookConfigImpl.latestVersion}', - 'link_mode_preference': 'prefer-static', - }; - expect(jsonObject, equals(expectedJson)); - - final buildConfig2 = LinkConfigImpl.fromJson(jsonObject); - expect(buildConfig2, buildConfig1); - }); - - test('LinkConfig FormatExceptions', () { - expect( - () => LinkConfigImpl.fromJson({}), - throwsA(predicate( - (e) => - e is FormatException && - e.message - .contains('No value was provided for required key: target_os'), - )), - ); - expect( - () => LinkConfigImpl.fromJson({ - 'version': HookConfigImpl.latestVersion.toString(), - 'supported_asset_types': [CodeAsset.type], - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_os': 'android', - 'target_android_ndk_api': 30, - 'assets': [], - }), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - 'No value was provided for required key: out_dir', - ), - )), - ); - expect( - () => LinkConfigImpl.fromJson({ - 'version': HookConfigImpl.latestVersion.toString(), - 'supported_asset_types': [CodeAsset.type], - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_os': 'android', - 'target_android_ndk_api': 30, - 'build_mode': BuildMode.release.name, - 'assets': 'astring', - 'link_mode_preference': LinkModePreference.preferStatic.name, - }), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - "Unexpected value 'astring' for key '.assets' in config file. " - 'Expected a List?.', - ), - )), - ); - expect( - () => LinkConfigImpl.fromJson({ - 'supported_asset_types': [CodeAsset.type], - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'version': HookConfigImpl.latestVersion.toString(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_architecture': 'arm64', - 'target_os': 'android', - 'build_mode': BuildMode.release.name, - 'link_mode_preference': LinkModePreference.preferStatic.name, - }), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains( - 'No value was provided for required key: target_android_ndk_api', - ), - )), - ); - }); - - test('LinkConfig toString', () { - final config = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - cCompiler: CCompilerConfig( - compiler: fakeClang, - linker: fakeLd, - ), - buildMode: BuildMode.release, - encodedAssets: assets, - linkModePreference: LinkModePreference.preferStatic, - ); - expect(config.toString(), isNotEmpty); - }); - - test('LinkConfig fromArgs', () async { - final buildConfig = LinkConfigImpl( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.android, - targetAndroidNdkApi: 30, - buildMode: BuildMode.release, - encodedAssets: assets, - recordedUsagesFile: recordedUsagesFile, - linkModePreference: LinkModePreference.preferStatic, - ); - final configFileContents = buildConfig.toJsonString(); - final configUri = tempUri.resolve('config.json'); - final configFile = File.fromUri(configUri); - await configFile.writeAsString(configFileContents); - final buildConfig2 = - LinkConfigImpl.fromArguments(['--config', configUri.toFilePath()]); - expect(buildConfig2, buildConfig); - }); - - for (final version in ['9001.0.0', '0.0.1']) { - test('LinkConfig version $version', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_root': tempUri.toFilePath(), - 'target_os': 'linux', - 'version': version, - 'package_name': packageName, - 'dry_run': true, - }; - expect( - () => LinkConfigImpl.fromJson(config), - throwsA(predicate( - (e) => - e is FormatException && - e.message.contains(version) && - e.message.contains(HookConfigImpl.latestVersion.toString()), - )), - ); - }); - } - - test('LinkConfig invalid target os architecture combination', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'windows', - 'target_architecture': 'arm', - 'build_mode': 'debug', - 'version': HookConfigImpl.latestVersion.toString(), - }; - expect( - () => LinkConfigImpl.fromJson(config), - throwsA(predicate( - (e) => e is FormatException && e.message.contains('arm'), - )), - ); - }); - - test('LinkConfig dry_run access invalid args', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'windows', - 'target_architecture': 'arm64', - 'build_mode': 'debug', - 'dry_run': true, - 'version': HookConfigImpl.latestVersion.toString(), - }; - expect( - () => LinkConfigImpl.fromJson(config), - throwsA(predicate( - (e) => - e is FormatException && e.message.contains('In Flutter projects'), - )), - ); - }); - - test('LinkConfig dry_run access invalid args', () { - final outDir = outDirUri; - final config = { - 'link_mode_preference': 'prefer-static', - 'supported_asset_types': [CodeAsset.type], - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'android', - 'dry_run': true, - 'version': HookConfigImpl.latestVersion.toString(), - }; - final buildConfig = LinkConfigImpl.fromJson(config); - expect( - () => buildConfig.targetAndroidNdkApi, - throwsA(predicate( - (e) => e is StateError && e.message.contains('In Flutter projects'), - )), - ); - }); - - test('LinkConfig dry_run target arch', () { - final outDir = outDirUri; - final config = { - 'supported_asset_types': [CodeAsset.type], - 'link_mode_preference': 'prefer-static', - 'out_dir': outDir.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': tempUri.toFilePath(), - 'target_os': 'windows', - 'dry_run': true, - 'version': HookConfigImpl.latestVersion.toString(), - }; - final buildConfig = LinkConfigImpl.fromJson(config); - expect(buildConfig.targetArchitecture, isNull); - }); - - test('LinkConfig dry_run toString', () { - final buildConfig = LinkConfigImpl.dryRun( - supportedAssetTypes: [CodeAsset.type], - packageName: packageName, - outputDirectory: outDirUri, - outputDirectoryShared: outputDirectoryShared, - packageRoot: tempUri, - targetOS: OS.windows, - encodedAssets: assets, - linkModePreference: LinkModePreference.preferStatic, - ); - expect(buildConfig.toJsonString(), isNotEmpty); - }); - - test('invalid architecture', () { - final config = { - 'supported_asset_types': [CodeAsset.type], - 'build_mode': 'release', - 'dry_run': false, - 'link_mode_preference': 'prefer-static', - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_android_ndk_api': 30, - 'target_architecture': 'invalid_architecture', - 'target_os': 'android', - 'version': HookOutputImpl.latestVersion.toString(), - }; - expect( - () => LinkConfigImpl.fromJson(config), - throwsFormatException, - ); - }); -} diff --git a/pkgs/native_assets_cli/test/model/link_mode_test.dart b/pkgs/native_assets_cli/test/model/link_mode_test.dart index d27fdc129..52a2d0276 100644 --- a/pkgs/native_assets_cli/test/model/link_mode_test.dart +++ b/pkgs/native_assets_cli/test/model/link_mode_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/model/metadata_test.dart b/pkgs/native_assets_cli/test/model/metadata_test.dart index e1e2dfa68..4f5ed0442 100644 --- a/pkgs/native_assets_cli/test/model/metadata_test.dart +++ b/pkgs/native_assets_cli/test/model/metadata_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/model/target_test.dart b/pkgs/native_assets_cli/test/model/target_test.dart index f63f16856..96e49337f 100644 --- a/pkgs/native_assets_cli/test/model/target_test.dart +++ b/pkgs/native_assets_cli/test/model/target_test.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli_internal.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:test/test.dart'; void main() { diff --git a/pkgs/native_assets_cli/test/validation_test.dart b/pkgs/native_assets_cli/test/validation_test.dart new file mode 100644 index 000000000..fae2834d1 --- /dev/null +++ b/pkgs/native_assets_cli/test/validation_test.dart @@ -0,0 +1,80 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:native_assets_cli/native_assets_cli_builder.dart'; +import 'package:test/test.dart'; + +void main() { + late Uri tempUri; + late Uri outDirUri; + late Uri outDirSharedUri; + late String packageName; + late Uri packageRootUri; + + setUp(() async { + tempUri = (await Directory.systemTemp.createTemp()).uri; + outDirUri = tempUri.resolve('out/'); + await Directory.fromUri(outDirUri).create(); + outDirSharedUri = tempUri.resolve('out_shared/'); + await Directory.fromUri(outDirSharedUri).create(); + packageName = 'my_package'; + packageRootUri = tempUri.resolve('$packageName/'); + await Directory.fromUri(packageRootUri).create(); + }); + + tearDown(() async { + await Directory.fromUri(tempUri).delete(recursive: true); + }); + + BuildConfig makeBuildConfig() { + final configBuilder = BuildConfigBuilder() + ..setupHookConfig( + packageName: packageName, + packageRoot: tempUri, + buildAssetTypes: ['my-asset-type'], + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupBuildRunConfig( + outputDirectory: outDirUri, + outputDirectoryShared: outDirSharedUri, + ); + return BuildConfig(configBuilder.json); + } + + test('linking not enabled', () async { + final config = makeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.addEncodedAsset( + EncodedAsset('my-asset-type', {}), + linkInPackage: 'bar', + ); + final errors = + await validateBuildOutput(config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('linkingEnabled is false')), + ); + }); + + test('supported asset type', () async { + final config = makeBuildConfig(); + final outputBuilder = BuildOutputBuilder(); + final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); + await assetFile.writeAsBytes([1, 2, 3]); + outputBuilder.addEncodedAsset(EncodedAsset('baz', {})); + final errors = + await validateBuildOutput(config, BuildOutput(outputBuilder.json)); + expect( + errors, + contains(contains('"baz" is not a supported asset type')), + ); + }); +} diff --git a/pkgs/native_assets_cli/test/validator/validator_test.dart b/pkgs/native_assets_cli/test/validator/validator_test.dart deleted file mode 100644 index e37ab9de7..000000000 --- a/pkgs/native_assets_cli/test/validator/validator_test.dart +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:native_assets_cli/native_assets_cli_internal.dart'; -import 'package:test/test.dart'; - -void main() { - late Uri tempUri; - late Uri outDirUri; - late Uri outDirSharedUri; - late String packageName; - late Uri packageRootUri; - - setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; - outDirUri = tempUri.resolve('out/'); - await Directory.fromUri(outDirUri).create(); - outDirSharedUri = tempUri.resolve('out_shared/'); - await Directory.fromUri(outDirSharedUri).create(); - packageName = 'my_package'; - packageRootUri = tempUri.resolve('$packageName/'); - await Directory.fromUri(packageRootUri).create(); - }); - - tearDown(() async { - await Directory.fromUri(tempUri).delete(recursive: true); - }); - - test('linking not enabled', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.codeAssets.add( - CodeAsset( - package: config.packageName, - name: 'foo.dart', - file: assetFile.uri, - linkMode: DynamicLoadingBundled(), - os: config.targetOS, - architecture: config.targetArchitecture, - ), - linkInPackage: 'bar', - ); - final errors = await validateBuildOutput(config, output); - expect( - errors, - contains(contains('linkingEnabled is false')), - ); - }); - - test('supported asset type', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.dataAssets.add(DataAsset( - package: config.packageName, - name: 'foo.txt', - file: assetFile.uri, - )); - final errors = await validateBuildOutput(config, output); - expect( - errors, - contains(contains('"data" is not a supported asset type')), - ); - }); - - test('file exists', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [DataAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - output.dataAssets.add(DataAsset( - package: config.packageName, - name: 'foo.txt', - file: assetFile.uri, - )); - final errors = await validateDataAssetBuildOutput(config, output); - expect( - errors, - contains(contains('which does not exist')), - ); - }); - - test('file not set', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - output.codeAssets.add(CodeAsset( - package: config.packageName, - name: 'foo.dylib', - architecture: config.targetArchitecture, - os: config.targetOS, - linkMode: DynamicLoadingBundled(), - )); - final errors = await validateCodeAssetBuildOutput(config, output); - expect( - errors, - contains(contains('has no file')), - ); - }); - - for (final (linkModePreference, linkMode) in [ - (LinkModePreference.static, DynamicLoadingBundled()), - (LinkModePreference.dynamic, StaticLinking()), - ]) { - test('native code asset wrong linking $linkModePreference', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: linkModePreference, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.codeAssets.add( - CodeAsset( - package: config.packageName, - name: 'foo.dart', - file: assetFile.uri, - linkMode: linkMode, - os: config.targetOS, - architecture: config.targetArchitecture, - ), - ); - final errors = await validateCodeAssetBuildOutput(config, output); - expect( - errors, - contains(contains( - 'which is not allowed by by the config link mode preference', - )), - ); - }); - } - - test('native code wrong architecture', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.codeAssets.add( - CodeAsset( - package: config.packageName, - name: 'foo.dart', - file: assetFile.uri, - linkMode: DynamicLoadingBundled(), - os: config.targetOS, - architecture: Architecture.x64, - ), - ); - final errors = await validateCodeAssetBuildOutput(config, output); - expect( - errors, - contains(contains( - 'which is not the target architecture', - )), - ); - }); - - test('native code no architecture', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.codeAssets.add( - CodeAsset( - package: config.packageName, - name: 'foo.dart', - file: assetFile.uri, - linkMode: DynamicLoadingBundled(), - os: config.targetOS, - ), - ); - final errors = await validateCodeAssetBuildOutput(config, output); - expect( - errors, - contains(contains( - 'has no architecture', - )), - ); - }); - - test('native code asset wrong os', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.codeAssets.add( - CodeAsset( - package: config.packageName, - name: 'foo.dart', - file: assetFile.uri, - linkMode: DynamicLoadingBundled(), - os: OS.windows, - architecture: config.targetArchitecture, - ), - ); - final errors = await validateCodeAssetBuildOutput(config, output); - expect( - errors, - contains(contains( - 'which is not the target os', - )), - ); - }); - - test('asset id in wrong package', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [DataAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.dataAssets.add(DataAsset( - package: 'different_package', - name: 'foo.txt', - file: assetFile.uri, - )); - final errors = await validateDataAssetBuildOutput(config, output); - expect( - errors, - contains(contains('Data asset must have package name my_package')), - ); - }); - - test('duplicate asset id', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [DataAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.dataAssets.addAll([ - DataAsset( - package: config.packageName, - name: 'foo.txt', - file: assetFile.uri, - ), - DataAsset( - package: config.packageName, - name: 'foo.txt', - file: assetFile.uri, - ), - ]); - final errors = await validateDataAssetBuildOutput(config, output); - expect( - errors, - contains(contains('More than one')), - ); - }); - - test('link hook validation', () async { - final config = LinkConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - assets: [], - ); - final output = LinkOutput(); - final assetFile = File.fromUri(outDirUri.resolve('foo.dylib')); - await assetFile.writeAsBytes([1, 2, 3]); - output.dataAssets.add(DataAsset( - package: config.packageName, - name: 'foo.txt', - file: assetFile.uri, - )); - final errors = await validateLinkOutput(config, output); - expect( - errors, - contains(contains('"data" is not a supported asset type')), - ); - }); - - test('duplicate dylib name', () async { - final config = BuildConfig.build( - outputDirectory: outDirUri, - outputDirectoryShared: outDirSharedUri, - packageName: packageName, - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], - linkingEnabled: false, - ); - final output = BuildOutput(); - final fileName = config.targetOS.dylibFileName('foo'); - final assetFile = File.fromUri(outDirUri.resolve(fileName)); - await assetFile.writeAsBytes([1, 2, 3]); - output.codeAssets.addAll([ - CodeAsset( - package: config.packageName, - name: 'src/foo.dart', - file: assetFile.uri, - linkMode: DynamicLoadingBundled(), - os: config.targetOS, - architecture: config.targetArchitecture, - ), - CodeAsset( - package: config.packageName, - name: 'src/bar.dart', - file: assetFile.uri, - linkMode: DynamicLoadingBundled(), - os: config.targetOS, - architecture: config.targetArchitecture, - ), - ]); - final errors = await validateCodeAssetBuildOutput(config, output); - expect( - errors, - contains(contains('Duplicate dynamic library file name')), - ); - }); -} diff --git a/pkgs/native_toolchain_c/CHANGELOG.md b/pkgs/native_toolchain_c/CHANGELOG.md index 3715b49c8..0d1a8e172 100644 --- a/pkgs/native_toolchain_c/CHANGELOG.md +++ b/pkgs/native_toolchain_c/CHANGELOG.md @@ -1,7 +1,17 @@ -## 0.5.5-wip +## 0.6.1-wip + +- For Android, produce dylibs with page-size set to 16kb by default. + https://github.com/dart-lang/native/issues/1611 +- Make optimization level configurable. Defaults to `-3s` and `/O3`. + https://github.com/dart-lang/native/issues/1267 +- Add `libraries` and `libraryDirectories` to `CTool`. + +## 0.6.0 - Address analyzer info diagnostic about multi-line if requiring a block body. -- Bump `package:native_assets_cli` to `0.9.0`. +- Bump `package:native_assets_cli` to `0.9.0`. This makes + `package:native_toolchain_c` now take `BuildOutputBuilder` and + `LinkOutputBuilder` objects. ## 0.5.4 diff --git a/pkgs/native_toolchain_c/lib/native_toolchain_c.dart b/pkgs/native_toolchain_c/lib/native_toolchain_c.dart index fa001799d..4efdfa5fd 100644 --- a/pkgs/native_toolchain_c/lib/native_toolchain_c.dart +++ b/pkgs/native_toolchain_c/lib/native_toolchain_c.dart @@ -5,9 +5,11 @@ /// A library to invoke the native C compiler installed on the host machine. library; +export 'src/cbuilder/build_mode.dart'; export 'src/cbuilder/cbuilder.dart' show CBuilder; export 'src/cbuilder/clinker.dart' show CLinker; export 'src/cbuilder/language.dart' show Language; export 'src/cbuilder/linker_options.dart' show LinkerOptions; +export 'src/cbuilder/optimization_level.dart'; export 'src/cbuilder/output_type.dart' show OutputType; export 'src/utils/env_from_bat.dart'; diff --git a/pkgs/native_assets_cli/lib/src/build_mode.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/build_mode.dart similarity index 100% rename from pkgs/native_assets_cli/lib/src/build_mode.dart rename to pkgs/native_toolchain_c/lib/src/cbuilder/build_mode.dart diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart index 34c28ae1e..c2e3c0a34 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart @@ -6,11 +6,13 @@ import 'dart:io'; import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; +import 'build_mode.dart'; import 'ctool.dart'; import 'language.dart'; import 'linkmode.dart'; +import 'optimization_level.dart'; import 'output_type.dart'; import 'run_cbuilder.dart'; @@ -46,12 +48,16 @@ class CBuilder extends CTool implements Builder { /// Defaults to `true`. final bool ndebugDefine; + final BuildMode buildMode; + CBuilder.library({ required super.name, super.assetName, super.sources = const [], super.includes = const [], super.frameworks = CTool.defaultFrameworks, + super.libraries = const [], + super.libraryDirectories = CTool.defaultLibraryDirectories, @Deprecated( 'Newer Dart and Flutter SDKs automatically add the Dart hook ' 'sources as dependencies.', @@ -67,6 +73,8 @@ class CBuilder extends CTool implements Builder { super.language = Language.c, super.cppLinkStdLib, super.linkModePreference, + super.optimizationLevel = OptimizationLevel.o3, + this.buildMode = BuildMode.release, }) : super(type: OutputType.library); CBuilder.executable({ @@ -74,6 +82,8 @@ class CBuilder extends CTool implements Builder { super.sources = const [], super.includes = const [], super.frameworks = CTool.defaultFrameworks, + super.libraries = const [], + super.libraryDirectories = CTool.defaultLibraryDirectories, @Deprecated( 'Newer Dart and Flutter SDKs automatically add the Dart hook ' 'sources as dependencies.', @@ -87,6 +97,8 @@ class CBuilder extends CTool implements Builder { super.std, super.language = Language.c, super.cppLinkStdLib, + super.optimizationLevel = OptimizationLevel.o3, + this.buildMode = BuildMode.release, }) : super( type: OutputType.executable, assetName: null, @@ -101,7 +113,7 @@ class CBuilder extends CTool implements Builder { @override Future run({ required BuildConfig config, - required BuildOutput output, + required BuildOutputBuilder output, required Logger? logger, String? linkInPackage, }) async { @@ -113,10 +125,11 @@ class CBuilder extends CTool implements Builder { final packageRoot = config.packageRoot; await Directory.fromUri(outDir).create(recursive: true); final linkMode = - getLinkMode(linkModePreference ?? config.linkModePreference); - final libUri = - outDir.resolve(config.targetOS.libraryFileName(name, linkMode)); - final exeUri = outDir.resolve(config.targetOS.executableFileName(name)); + getLinkMode(linkModePreference ?? config.codeConfig.linkModePreference); + final libUri = outDir + .resolve(config.codeConfig.targetOS.libraryFileName(name, linkMode)); + final exeUri = + outDir.resolve(config.codeConfig.targetOS.executableFileName(name)); final sources = [ for (final source in this.sources) packageRoot.resolveUri(Uri.file(source)), @@ -129,13 +142,21 @@ class CBuilder extends CTool implements Builder { // ignore: deprecated_member_use_from_same_package for (final source in this.dartBuildFiles) packageRoot.resolve(source), ]; + final libraryDirectories = [ + for (final directory in this.libraryDirectories) + outDir.resolveUri(Uri.file(directory)), + ]; + // ignore: deprecated_member_use if (!config.dryRun) { final task = RunCBuilder( config: config, + codeConfig: config.codeConfig, logger: logger, sources: sources, includes: includes, frameworks: frameworks, + libraries: libraries, + libraryDirectories: libraryDirectories, dynamicLibrary: type == OutputType.library && linkMode == DynamicLoadingBundled() ? libUri @@ -149,14 +170,14 @@ class CBuilder extends CTool implements Builder { flags: flags, defines: { ...defines, - if (buildModeDefine) config.buildMode.name.toUpperCase(): null, - if (ndebugDefine && config.buildMode != BuildMode.debug) - 'NDEBUG': null, + if (buildModeDefine) buildMode.name.toUpperCase(): null, + if (ndebugDefine && buildMode != BuildMode.debug) 'NDEBUG': null, }, pic: pic, std: std, language: language, cppLinkStdLib: cppLinkStdLib, + optimizationLevel: optimizationLevel, ); await task.run(); } @@ -168,12 +189,15 @@ class CBuilder extends CTool implements Builder { name: assetName!, file: libUri, linkMode: linkMode, - os: config.targetOS, - architecture: config.dryRun ? null : config.targetArchitecture, + os: config.codeConfig.targetOS, + architecture: + // ignore: deprecated_member_use + config.dryRun ? null : config.codeConfig.targetArchitecture, ), linkInPackage: linkInPackage, ); } + // ignore: deprecated_member_use if (!config.dryRun) { final includeFiles = await Stream.fromIterable(includes) .asyncExpand( diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/clinker.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/clinker.dart index 3ac153901..425944630 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/clinker.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/clinker.dart @@ -6,12 +6,13 @@ import 'dart:io'; import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'ctool.dart'; import 'language.dart'; import 'linker_options.dart'; import 'linkmode.dart'; +import 'optimization_level.dart'; import 'output_type.dart'; import 'run_cbuilder.dart'; @@ -28,6 +29,8 @@ class CLinker extends CTool implements Linker { super.sources = const [], super.includes = const [], super.frameworks = CTool.defaultFrameworks, + super.libraries = const [], + super.libraryDirectories = CTool.defaultLibraryDirectories, @visibleForTesting super.installName, super.flags = const [], super.defines = const {}, @@ -36,6 +39,7 @@ class CLinker extends CTool implements Linker { super.language = Language.c, super.cppLinkStdLib, super.linkModePreference, + super.optimizationLevel = OptimizationLevel.o3, }) : super(type: OutputType.library); /// Runs the C Linker with on this C build spec. @@ -44,10 +48,10 @@ class CLinker extends CTool implements Linker { @override Future run({ required LinkConfig config, - required LinkOutput output, + required LinkOutputBuilder output, required Logger? logger, }) async { - if (OS.current != OS.linux || config.targetOS != OS.linux) { + if (OS.current != OS.linux || config.codeConfig.targetOS != OS.linux) { throw UnsupportedError('Currently, only linux is supported for this ' 'feature. See also https://github.com/dart-lang/native/issues/1376'); } @@ -55,9 +59,9 @@ class CLinker extends CTool implements Linker { final packageRoot = config.packageRoot; await Directory.fromUri(outDir).create(recursive: true); final linkMode = - getLinkMode(linkModePreference ?? config.linkModePreference); - final libUri = - outDir.resolve(config.targetOS.libraryFileName(name, linkMode)); + getLinkMode(linkModePreference ?? config.codeConfig.linkModePreference); + final libUri = outDir + .resolve(config.codeConfig.targetOS.libraryFileName(name, linkMode)); final sources = [ for (final source in this.sources) packageRoot.resolveUri(Uri.file(source)), @@ -66,55 +70,57 @@ class CLinker extends CTool implements Linker { for (final directory in this.includes) packageRoot.resolveUri(Uri.file(directory)), ]; - if (!config.dryRun) { - final task = RunCBuilder( - config: config, - linkerOptions: linkerOptions, - logger: logger, - sources: sources, - includes: includes, - frameworks: frameworks, - dynamicLibrary: linkMode == DynamicLoadingBundled() ? libUri : null, - staticLibrary: linkMode == StaticLinking() ? libUri : null, - // ignore: invalid_use_of_visible_for_testing_member - installName: installName, - flags: flags, - defines: defines, - pic: pic, - std: std, - language: language, - cppLinkStdLib: cppLinkStdLib, - ); - await task.run(); - } + final libraryDirectories = [ + for (final directory in this.libraryDirectories) + outDir.resolveUri(Uri.file(directory)), + ]; + final task = RunCBuilder( + config: config, + codeConfig: config.codeConfig, + linkerOptions: linkerOptions, + logger: logger, + sources: sources, + includes: includes, + frameworks: frameworks, + libraries: libraries, + libraryDirectories: libraryDirectories, + dynamicLibrary: linkMode == DynamicLoadingBundled() ? libUri : null, + staticLibrary: linkMode == StaticLinking() ? libUri : null, + // ignore: invalid_use_of_visible_for_testing_member + installName: installName, + flags: flags, + defines: defines, + pic: pic, + std: std, + language: language, + cppLinkStdLib: cppLinkStdLib, + optimizationLevel: optimizationLevel, + ); + await task.run(); if (assetName != null) { - output.codeAssets.add( - CodeAsset( - package: config.packageName, - name: assetName!, - file: libUri, - linkMode: linkMode, - os: config.targetOS, - architecture: config.dryRun ? null : config.targetArchitecture, - ), - ); + output.codeAssets.add(CodeAsset( + package: config.packageName, + name: assetName!, + file: libUri, + linkMode: linkMode, + os: config.codeConfig.targetOS, + architecture: config.codeConfig.targetArchitecture, + )); } - if (!config.dryRun) { - final includeFiles = await Stream.fromIterable(includes) - .asyncExpand( - (include) => Directory(include.toFilePath()) - .list(recursive: true) - .where((entry) => entry is File) - .map((file) => file.uri), - ) - .toList(); + final includeFiles = await Stream.fromIterable(includes) + .asyncExpand( + (include) => Directory(include.toFilePath()) + .list(recursive: true) + .where((entry) => entry is File) + .map((file) => file.uri), + ) + .toList(); - output.addDependencies({ - // Note: We use a Set here to deduplicate the dependencies. - ...sources, - ...includeFiles, - }); - } + output.addDependencies({ + // Note: We use a Set here to deduplicate the dependencies. + ...sources, + ...includeFiles, + }); } } diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart index b33a12199..e329435eb 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart @@ -5,7 +5,7 @@ import 'dart:io'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import '../native_toolchain/android_ndk.dart'; import '../native_toolchain/apple_clang.dart'; @@ -20,13 +20,13 @@ import '../tool/tool_instance.dart'; // TODO(dacoharkes): This should support alternatives. // For example use Clang or MSVC on Windows. class CompilerResolver { - final HookConfig hookConfig; + final CodeConfig codeConfig; final Logger? logger; final OS hostOS; final Architecture hostArchitecture; CompilerResolver({ - required this.hookConfig, + required this.codeConfig, required this.logger, OS? hostOS, // Only visible for testing. Architecture? hostArchitecture, // Only visible for testing. @@ -47,8 +47,8 @@ class CompilerResolver { return result; } - final targetOS = hookConfig.targetOS; - final targetArchitecture = hookConfig.targetArchitecture; + final targetOS = codeConfig.targetOS; + final targetArchitecture = codeConfig.targetArchitecture; final errorMessage = "No tools configured on host '${hostOS}_$hostArchitecture' with target " "'${targetOS}_$targetArchitecture'."; @@ -58,8 +58,8 @@ class CompilerResolver { /// Select the right compiler for cross compiling to the specified target. Tool? _selectCompiler() { - final targetOS = hookConfig.targetOS; - final targetArch = hookConfig.targetArchitecture; + final targetOS = codeConfig.targetOS; + final targetArch = codeConfig.targetArchitecture; // TODO(dacoharkes): Support falling back on other tools. if (targetArch == hostArchitecture && @@ -99,7 +99,7 @@ class CompilerResolver { } Future _tryLoadCompilerFromConfig() async { - final configCcUri = hookConfig.cCompiler.compiler; + final configCcUri = codeConfig.cCompiler?.compiler; if (configCcUri != null) { assert(await File.fromUri(configCcUri).exists()); logger?.finer('Using compiler ${configCcUri.toFilePath()} ' @@ -133,8 +133,8 @@ class CompilerResolver { return result; } - final targetOS = hookConfig.targetOS; - final targetArchitecture = hookConfig.targetArchitecture; + final targetOS = codeConfig.targetOS; + final targetArchitecture = codeConfig.targetArchitecture; final errorMessage = "No tools configured on host '${hostOS}_$hostArchitecture' with target " "'${targetOS}_$targetArchitecture'."; @@ -144,8 +144,8 @@ class CompilerResolver { /// Select the right archiver for cross compiling to the specified target. Tool? _selectArchiver() { - final targetOS = hookConfig.targetOS; - final targetArchitecture = hookConfig.targetArchitecture; + final targetOS = codeConfig.targetOS; + final targetArchitecture = codeConfig.targetArchitecture; // TODO(dacoharkes): Support falling back on other tools. if (targetArchitecture == hostArchitecture && @@ -184,7 +184,7 @@ class CompilerResolver { } Future _tryLoadArchiverFromConfig() async { - final configArUri = hookConfig.cCompiler.archiver; + final configArUri = codeConfig.cCompiler?.archiver; if (configArUri != null) { assert(await File.fromUri(configArUri).exists()); logger?.finer('Using archiver ${configArUri.toFilePath()} ' @@ -197,7 +197,7 @@ class CompilerResolver { } Future toolchainEnvironmentScript(ToolInstance compiler) async { - final fromConfig = hookConfig.cCompiler.envScript; + final fromConfig = codeConfig.cCompiler?.envScript; if (fromConfig != null) { logger?.fine('Using envScript from config: $fromConfig'); return fromConfig; @@ -211,7 +211,7 @@ class CompilerResolver { } List? toolchainEnvironmentScriptArguments() { - final fromConfig = hookConfig.cCompiler.envScriptArgs; + final fromConfig = codeConfig.cCompiler?.envScriptArgs; if (fromConfig != null) { logger?.fine('Using envScriptArgs from config: $fromConfig'); return fromConfig; @@ -222,8 +222,8 @@ class CompilerResolver { } Future resolveLinker() async { - final targetOS = hookConfig.targetOS; - final targetArchitecture = hookConfig.targetArchitecture; + final targetOS = codeConfig.targetOS; + final targetArchitecture = codeConfig.targetArchitecture; // First, check if the launcher provided a direct path to the compiler. var result = await _tryLoadLinkerFromConfig(); @@ -245,7 +245,7 @@ class CompilerResolver { } Future _tryLoadLinkerFromConfig() async { - final configLdUri = hookConfig.cCompiler.linker; + final configLdUri = codeConfig.cCompiler?.linker; if (configLdUri != null) { assert(await File.fromUri(configLdUri).exists()); logger?.finer('Using linker ${configLdUri.toFilePath()} ' @@ -259,8 +259,8 @@ class CompilerResolver { /// Select the right compiler for cross compiling to the specified target. Tool? _selectLinker() { - final targetOS = hookConfig.targetOS; - final targetArchitecture = hookConfig.targetArchitecture; + final targetOS = codeConfig.targetOS; + final targetArchitecture = codeConfig.targetArchitecture; if (targetOS == OS.macOS || targetOS == OS.iOS) return appleLd; if (targetOS == OS.android) return androidNdkLld; diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/ctool.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/ctool.dart index 3902ea6d0..4234337e2 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/ctool.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/ctool.dart @@ -3,19 +3,22 @@ // BSD-style license that can be found in the LICENSE file. import 'package:meta/meta.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'cbuilder.dart'; +import 'clinker.dart'; import 'language.dart'; +import 'optimization_level.dart'; import 'output_type.dart'; +/// Common options for [CBuilder] and [CLinker]. abstract class CTool { /// What kind of artifact to build. final OutputType type; - /// Name of the library or executable to linkg. + /// Name of the library or executable to build or link. /// - /// The filename will be decided by [LinkConfig.targetOS] and + /// The filename will be decided by [CodeConfig.targetOS] and /// [OSLibraryNaming.libraryFileName] or /// [OSLibraryNaming.executableFileName]. /// @@ -33,14 +36,14 @@ abstract class CTool { /// /// Resolved against [LinkConfig.packageRoot]. /// - /// Used to output the [LinkOutput.dependencies]. + /// The sources will be reported as dependencies of the hook. final List sources; /// Include directories to pass to the linker. /// /// Resolved against [LinkConfig.packageRoot]. /// - /// Used to output the [LinkOutput.dependencies]. + /// The sources will be reported as dependencies of the hook. final List includes; /// Frameworks to link. @@ -49,14 +52,39 @@ abstract class CTool { /// /// Defaults to `['Foundation']`. /// - /// Not used to output the [LinkOutput.dependencies], frameworks can be - /// mentioned by name if they are available on the system, so the file path - /// is not known. If you're depending on your own frameworks add them to - /// [LinkOutput.dependencies] manually. + /// Frameworks will not be automatically reported as dependencies of the hook. + /// Frameworks can be mentioned by name if they are available on the system, + /// so the file path is not known. If you're depending on your own frameworks + /// report them as dependencies of the hook by calling + /// [BuildOutputBuilder.addDependency] / [LinkOutputBuilder.addDependency] + /// manually. final List frameworks; + /// The default [frameworks]. static const List defaultFrameworks = ['Foundation']; + /// Libraries to link to. + /// + /// In addition to the system default directories, libraries will be searched + /// for in [libraryDirectories]. + /// + /// If you want to link to a library that was built by another [CBuilder] or + /// [CLinker], either leave the default [libraryDirectories] or include `'.'` + /// in the list. + final List libraries; + + /// Directories to search for [libraries], in addition to the system default + /// directories. + /// + /// Resolved against [LinkConfig.outputDirectory]. + /// + /// Defaults to `['.']`, which means the [LinkConfig.outputDirectory] will be + /// searched for libraries. + final List libraryDirectories; + + /// The default [libraryDirectories]. + static const List defaultLibraryDirectories = ['.']; + /// TODO(https://github.com/dart-lang/native/issues/54): Move to [LinkConfig] /// or hide in public API. @visibleForTesting @@ -118,12 +146,17 @@ abstract class CTool { /// the value is instead retrieved from the [LinkConfig]. final LinkModePreference? linkModePreference; + /// What optimization level should be used for compiling. + final OptimizationLevel optimizationLevel; + CTool({ required this.name, required this.assetName, required this.sources, required this.includes, required this.frameworks, + required this.libraries, + required this.libraryDirectories, required this.installName, required this.flags, required this.defines, @@ -133,5 +166,6 @@ abstract class CTool { required this.cppLinkStdLib, required this.linkModePreference, required this.type, + required this.optimizationLevel, }); } diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/linkmode.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/linkmode.dart index d5d08c5be..da7154e28 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/linkmode.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/linkmode.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; LinkMode getLinkMode(LinkModePreference preference) { if (preference == LinkModePreference.dynamic || diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/optimization_level.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/optimization_level.dart new file mode 100644 index 000000000..2c8398f89 --- /dev/null +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/optimization_level.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Optimization level for code compilation. +/// +/// For more information refer to compiler documentation: +/// * https://clang.llvm.org/docs/CommandGuide/clang.html#code-generation-options +/// * https://learn.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=msvc-170 +final class OptimizationLevel { + /// The optimization level. + final String _level; + + const OptimizationLevel._(this._level); + + /// No optimization; prioritize fast compilation. + static const OptimizationLevel o0 = OptimizationLevel._('O0'); + + /// Basic optimizations; balance compilation speed and code size. + static const OptimizationLevel o1 = OptimizationLevel._('O1'); + + /// More aggressive optimizations; prioritize code size reduction. + static const OptimizationLevel o2 = OptimizationLevel._('O2'); + + /// The most aggressive optimizations; prioritize runtime performance. + /// + /// Not supported in MSVC, defaults to [o2] for MSVC. + static const OptimizationLevel o3 = OptimizationLevel._('O3'); + + /// Optimize for code size, even if it impacts runtime performance. + static const OptimizationLevel oS = OptimizationLevel._('Os'); + + /// Unspecified optimization level; the default or compiler-chosen level. + static const OptimizationLevel unspecified = + OptimizationLevel._('unspecified'); + + /// Returns the string representation of the optimization level. + @override + String toString() => _level; + + String clangFlag() => '-$_level'; + + String msvcFlag() => switch (this) { + o3 => o2.msvcFlag(), + _ => '/$_level', + }; + + static const List values = [ + o0, + o1, + o2, + o3, + oS, + unspecified, + ]; +} diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart index 3b31c92c4..23d61225c 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart @@ -5,7 +5,7 @@ import 'dart:math'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import '../native_toolchain/msvc.dart'; import '../native_toolchain/tool_likeness.dart'; @@ -16,16 +16,20 @@ import '../utils/run_process.dart'; import 'compiler_resolver.dart'; import 'language.dart'; import 'linker_options.dart'; +import 'optimization_level.dart'; class RunCBuilder { /// The options are for linking only, so this will be non-null iff a linker /// should be run. final LinkerOptions? linkerOptions; final HookConfig config; + final CodeConfig codeConfig; final Logger? logger; final List sources; final List includes; final List frameworks; + final List libraries; + final List libraryDirectories; final Uri? executable; final Uri? dynamicLibrary; final Uri? staticLibrary; @@ -44,14 +48,18 @@ class RunCBuilder { final String? std; final Language language; final String? cppLinkStdLib; + final OptimizationLevel optimizationLevel; RunCBuilder({ required this.config, + required this.codeConfig, this.linkerOptions, this.logger, this.sources = const [], this.includes = const [], required this.frameworks, + this.libraries = const [], + this.libraryDirectories = const [], this.executable, this.dynamicLibrary, this.staticLibrary, @@ -62,12 +70,13 @@ class RunCBuilder { this.std, this.language = Language.c, this.cppLinkStdLib, + required this.optimizationLevel, }) : outDir = config.outputDirectory, assert([executable, dynamicLibrary, staticLibrary] .whereType() .length == 1) { - if (config.targetOS == OS.windows && cppLinkStdLib != null) { + if (codeConfig.targetOS == OS.windows && cppLinkStdLib != null) { throw ArgumentError.value( cppLinkStdLib, 'cppLinkStdLib', @@ -76,7 +85,8 @@ class RunCBuilder { } } - late final _resolver = CompilerResolver(hookConfig: config, logger: logger); + late final _resolver = + CompilerResolver(codeConfig: codeConfig, logger: logger); Future compiler() async => await _resolver.resolveCompiler(); @@ -129,8 +139,8 @@ class RunCBuilder { } final IOSSdk? targetIosSdk; - if (config.targetOS == OS.iOS) { - targetIosSdk = config.targetIOSSdk; + if (codeConfig.targetOS == OS.iOS) { + targetIosSdk = codeConfig.targetIOSSdk; } else { targetIosSdk = null; } @@ -139,20 +149,20 @@ class RunCBuilder { // invoking clang. Mimic that behavior here. // See https://github.com/dart-lang/native/issues/171. final int? targetAndroidNdkApi; - if (config.targetOS == OS.android) { + if (codeConfig.targetOS == OS.android) { final minimumApi = - config.targetArchitecture == Architecture.riscv64 ? 35 : 21; - targetAndroidNdkApi = max(config.targetAndroidNdkApi!, minimumApi); + codeConfig.targetArchitecture == Architecture.riscv64 ? 35 : 21; + targetAndroidNdkApi = max(codeConfig.targetAndroidNdkApi!, minimumApi); } else { targetAndroidNdkApi = null; } final targetIOSVersion = - config.targetOS == OS.iOS ? config.targetIOSVersion : null; + codeConfig.targetOS == OS.iOS ? codeConfig.targetIOSVersion : null; final targetMacOSVersion = - config.targetOS == OS.macOS ? config.targetMacOSVersion : null; + codeConfig.targetOS == OS.macOS ? codeConfig.targetMacOSVersion : null; - final architecture = config.targetArchitecture; + final architecture = codeConfig.targetArchitecture; final sourceFiles = sources.map((e) => e.toFilePath()).toList(); final objectFiles = []; if (staticLibrary != null) { @@ -209,24 +219,24 @@ class RunCBuilder { await runProcess( executable: toolInstance.uri, arguments: [ - if (config.targetOS == OS.android) ...[ + if (codeConfig.targetOS == OS.android) ...[ '--target=' '${androidNdkClangTargetFlags[architecture]!}' '${targetAndroidNdkApi!}', '--sysroot=${androidSysroot(toolInstance).toFilePath()}', ], - if (config.targetOS == OS.macOS) + if (codeConfig.targetOS == OS.macOS) '--target=${appleClangMacosTargetFlags[architecture]!}', - if (config.targetOS == OS.iOS) + if (codeConfig.targetOS == OS.iOS) '--target=${appleClangIosTargetFlags[architecture]![targetIosSdk]!}', if (targetIOSVersion != null) '-mios-version-min=$targetIOSVersion', if (targetMacOSVersion != null) '-mmacos-version-min=$targetMacOSVersion', - if (config.targetOS == OS.iOS) ...[ + if (codeConfig.targetOS == OS.iOS) ...[ '-isysroot', (await iosSdk(targetIosSdk!, logger: logger)).toFilePath(), ], - if (config.targetOS == OS.macOS) ...[ + if (codeConfig.targetOS == OS.macOS) ...[ '-isysroot', (await macosSdk(logger: logger)).toFilePath(), ], @@ -270,9 +280,14 @@ class RunCBuilder { '-x', 'c++', '-l', - cppLinkStdLib ?? defaultCppLinkStdLib[config.targetOS]! + cppLinkStdLib ?? defaultCppLinkStdLib[codeConfig.targetOS]! ], + if (optimizationLevel != OptimizationLevel.unspecified) + optimizationLevel.clangFlag(), ...linkerOptions?.preSourcesFlags(toolInstance.tool, sourceFiles) ?? [], + // Support Android 15 page size by default, can be overridden by + // passing [flags]. + if (codeConfig.targetOS == OS.android) '-Wl,-z,max-page-size=16384', ...flags, for (final MapEntry(key: name, :value) in defines.entries) if (value == null) '-D$name' else '-D$name=$value', @@ -287,8 +302,7 @@ class RunCBuilder { if (executable != null) ...[ '-o', outDir.resolveUri(executable!).toFilePath(), - ], - if (dynamicLibrary != null) ...[ + ] else if (dynamicLibrary != null) ...[ '--shared', '-o', outFile!.toFilePath(), @@ -299,6 +313,19 @@ class RunCBuilder { ], ...linkerOptions?.postSourcesFlags(toolInstance.tool, sourceFiles) ?? [], + if (executable != null || dynamicLibrary != null) ...[ + if (codeConfig.targetOS case OS.android || OS.linux) + // During bundling code assets are all placed in the same directory. + // Setting this rpath allows the binary to find other code assets + // it is linked against. + if (linkerOptions != null) + '-rpath=\$ORIGIN' + else + '-Wl,-rpath=\$ORIGIN', + for (final directory in libraryDirectories) + '-L${directory.toFilePath()}', + for (final library in libraries) '-l$library', + ], ], logger: logger, captureOutput: false, @@ -321,6 +348,8 @@ class RunCBuilder { final result = await runProcess( executable: tool.uri, arguments: [ + if (optimizationLevel != OptimizationLevel.unspecified) + optimizationLevel.msvcFlag(), if (std != null) '/std:$std', if (language == Language.cpp) '/TP', ...flags, @@ -331,17 +360,20 @@ class RunCBuilder { ...sources.map((e) => e.toFilePath()), '/link', '/out:${outDir.resolveUri(executable!).toFilePath()}', - ], - if (dynamicLibrary != null) ...[ + ] else if (dynamicLibrary != null) ...[ ...sources.map((e) => e.toFilePath()), '/link', '/DLL', '/out:${outDir.resolveUri(dynamicLibrary!).toFilePath()}', - ], - if (staticLibrary != null) ...[ + ] else if (staticLibrary != null) ...[ '/c', ...sources.map((e) => e.toFilePath()), ], + if (executable != null || dynamicLibrary != null) ...[ + for (final directory in libraryDirectories) + '/LIBPATH:${directory.toFilePath()}', + for (final library in libraries) '$library.lib', + ], ], workingDirectory: outDir, environment: environment, diff --git a/pkgs/native_toolchain_c/lib/src/native_toolchain/android_ndk.dart b/pkgs/native_toolchain_c/lib/src/native_toolchain/android_ndk.dart index 964a97a35..9d4547e71 100644 --- a/pkgs/native_toolchain_c/lib/src/native_toolchain/android_ndk.dart +++ b/pkgs/native_toolchain_c/lib/src/native_toolchain/android_ndk.dart @@ -5,7 +5,7 @@ import 'dart:io'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import '../tool/tool.dart'; import '../tool/tool_instance.dart'; diff --git a/pkgs/native_toolchain_c/lib/src/native_toolchain/gcc.dart b/pkgs/native_toolchain_c/lib/src/native_toolchain/gcc.dart index c7bf2cd4b..b6d280fcf 100644 --- a/pkgs/native_toolchain_c/lib/src/native_toolchain/gcc.dart +++ b/pkgs/native_toolchain_c/lib/src/native_toolchain/gcc.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import '../tool/tool.dart'; import '../tool/tool_resolver.dart'; diff --git a/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart b/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart index e8aef12ed..a9463b4e7 100644 --- a/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart +++ b/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart @@ -6,7 +6,7 @@ import 'dart:io'; import 'package:glob/glob.dart'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import '../tool/tool.dart'; import '../tool/tool_instance.dart'; diff --git a/pkgs/native_toolchain_c/lib/src/native_toolchain/recognizer.dart b/pkgs/native_toolchain_c/lib/src/native_toolchain/recognizer.dart index 6c8b430e9..a1cfbbe65 100644 --- a/pkgs/native_toolchain_c/lib/src/native_toolchain/recognizer.dart +++ b/pkgs/native_toolchain_c/lib/src/native_toolchain/recognizer.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import '../tool/tool.dart'; import '../tool/tool_instance.dart'; diff --git a/pkgs/native_toolchain_c/lib/src/tool/tool_resolver.dart b/pkgs/native_toolchain_c/lib/src/tool/tool_resolver.dart index 18f5f075c..f665a7d92 100644 --- a/pkgs/native_toolchain_c/lib/src/tool/tool_resolver.dart +++ b/pkgs/native_toolchain_c/lib/src/tool/tool_resolver.dart @@ -8,7 +8,7 @@ import 'dart:io'; import 'package:glob/glob.dart'; import 'package:glob/list_local_fs.dart'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:pub_semver/pub_semver.dart'; import '../utils/run_process.dart'; diff --git a/pkgs/native_toolchain_c/lib/src/utils/run_process.dart b/pkgs/native_toolchain_c/lib/src/utils/run_process.dart index f9204e5b9..989251409 100644 --- a/pkgs/native_toolchain_c/lib/src/utils/run_process.dart +++ b/pkgs/native_toolchain_c/lib/src/utils/run_process.dart @@ -18,25 +18,11 @@ Future runProcess({ List arguments = const [], Uri? workingDirectory, Map? environment, - bool includeParentEnvironment = true, required Logger? logger, bool captureOutput = true, int expectedExitCode = 0, bool throwOnUnexpectedExitCode = false, }) async { - if (Platform.isWindows && !includeParentEnvironment) { - const winEnvKeys = [ - 'SYSTEMROOT', - 'TEMP', - 'TMP', - ]; - environment = { - for (final winEnvKey in winEnvKeys) - winEnvKey: Platform.environment[winEnvKey]!, - ...?environment, - }; - } - final printWorkingDir = workingDirectory != null && workingDirectory != Directory.current.uri; final commandString = [ @@ -55,8 +41,7 @@ Future runProcess({ arguments, workingDirectory: workingDirectory?.toFilePath(), environment: environment, - includeParentEnvironment: includeParentEnvironment, - runInShell: Platform.isWindows && !includeParentEnvironment, + runInShell: Platform.isWindows && workingDirectory != null, ); final stdoutSub = process.stdout diff --git a/pkgs/native_toolchain_c/pubspec.yaml b/pkgs/native_toolchain_c/pubspec.yaml index 2a632ae7f..2147b4d37 100644 --- a/pkgs/native_toolchain_c/pubspec.yaml +++ b/pkgs/native_toolchain_c/pubspec.yaml @@ -1,7 +1,7 @@ name: native_toolchain_c description: >- A library to invoke the native C compiler installed on the host machine. -version: 0.5.5-wip +version: 0.6.1-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/native_toolchain_c publish_to: none @@ -20,7 +20,7 @@ dependencies: glob: ^2.1.1 logging: ^1.1.1 meta: ^1.9.1 - # native_assets_cli: ^0.8.0 + # native_assets_cli: ^0.9.0 native_assets_cli: path: ../native_assets_cli/ pub_semver: ^2.1.3 diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart index 1d9b85f37..7e906878d 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart @@ -10,7 +10,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:test/test.dart'; @@ -30,25 +29,35 @@ void main() { await File.fromUri(addCUri).writeAsString(addCBrokenContents); const name = 'add'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - linkModePreference: LinkModePreference.dynamic, - buildMode: BuildMode.release, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( sources: [addCUri.toFilePath()], name: name, assetName: name, + buildMode: BuildMode.release, ); expect( () => cbuilder.run( diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart index 12c0cd713..cb8e80201 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart @@ -4,7 +4,6 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:native_toolchain_c/src/utils/run_process.dart'; import 'package:test/test.dart'; @@ -37,6 +36,9 @@ void main() { /// From https://docs.flutter.dev/reference/supported-platforms. const flutterAndroidNdkVersionHighestSupported = 34; + const optimizationLevels = OptimizationLevel.values; + var selectOptimizationLevel = 0; + for (final linkMode in [DynamicLoadingBundled(), StaticLinking()]) { for (final target in targets) { for (final apiLevel in [ @@ -44,14 +46,20 @@ void main() { flutterAndroidNdkVersionLowestSupported, flutterAndroidNdkVersionHighestSupported, ]) { - test('CBuilder $linkMode library $target minSdkVersion $apiLevel', - () async { + // Cycle through all optimization levels. + final optimizationLevel = optimizationLevels[selectOptimizationLevel]; + selectOptimizationLevel = + (selectOptimizationLevel + 1) % optimizationLevels.length; + test( + 'CBuilder $linkMode library $target minSdkVersion $apiLevel ' + '$optimizationLevel', () async { final tempUri = await tempDirForTest(); final libUri = await buildLib( tempUri, target, apiLevel, linkMode, + optimizationLevel: optimizationLevel, ); if (Platform.isLinux) { final machine = await readelfMachine(libUri.path); @@ -68,6 +76,9 @@ void main() { .firstWhere((e) => e.contains('file format')); expect(machine, contains(objdumpFileFormat[target])); } + if (linkMode == DynamicLoadingBundled()) { + await expectPageSize(libUri, 16 * 1024); + } }); } } @@ -96,41 +107,76 @@ void main() { // Identical API levels should lead to an identical binary. expect(bytes2, bytes3); }); + + test('page size override', () async { + const target = Architecture.arm64; + final linkMode = DynamicLoadingBundled(); + const apiLevel1 = flutterAndroidNdkVersionLowestSupported; + final tempUri = await tempDirForTest(); + final outUri = tempUri.resolve('out1/'); + await Directory.fromUri(outUri).create(); + const pageSize = 4 * 1024; + final libUri = await buildLib( + outUri, + target, + apiLevel1, + linkMode, + flags: ['-Wl,-z,max-page-size=$pageSize'], + ); + if (Platform.isMacOS || Platform.isLinux) { + final address = await textSectionAddress(libUri); + expect(address, greaterThanOrEqualTo(pageSize)); + expect(address, isNot(greaterThanOrEqualTo(pageSize * 4))); + } + }); } Future buildLib( Uri tempUri, Architecture targetArchitecture, int androidNdkApi, - LinkMode linkMode, -) async { + LinkMode linkMode, { + List flags = const [], + OptimizationLevel optimizationLevel = OptimizationLevel.o3, +}) async { final addCUri = packageUri.resolve('test/cbuilder/testfiles/add/src/add.c'); const name = 'add'; final tempUriShared = tempUri.resolve('shared/'); await Directory.fromUri(tempUriShared).create(); - - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.android, + targetArchitecture: targetArchitecture, + cCompilerConfig: cCompiler, + targetAndroidNdkApi: androidNdkApi, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUriShared, - packageName: name, - packageRoot: tempUri, - targetArchitecture: targetArchitecture, - targetOS: OS.android, - targetAndroidNdkApi: androidNdkApi, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [addCUri.toFilePath()], + flags: flags, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart index 34afa5f47..90e358aa5 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart @@ -10,7 +10,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:native_toolchain_c/src/utils/run_process.dart'; import 'package:test/test.dart'; @@ -36,6 +35,9 @@ void main() { const name = 'add'; + const optimizationLevels = OptimizationLevel.values; + var selectOptimizationLevel = 0; + for (final language in [Language.c, Language.objectiveC]) { for (final linkMode in [DynamicLoadingBundled(), StaticLinking()]) { for (final targetIOSSdk in IOSSdk.values) { @@ -43,16 +45,20 @@ void main() { if (target == Architecture.x64 && targetIOSSdk == IOSSdk.iPhoneOS) { continue; } - final libName = OS.iOS.libraryFileName(name, linkMode); for (final installName in [ null, if (linkMode == DynamicLoadingBundled()) Uri.file('@executable_path/Frameworks/$libName'), ]) { + // Cycle through all optimization levels. + final optimizationLevel = + optimizationLevels[selectOptimizationLevel]; + selectOptimizationLevel = + (selectOptimizationLevel + 1) % optimizationLevels.length; test( 'CBuilder $linkMode $language library $targetIOSSdk $target' - ' ${installName ?? ''}' + ' ${installName ?? ''} $optimizationLevel' .trim(), () async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); @@ -63,22 +69,33 @@ void main() { 'test/cbuilder/testfiles/add_objective_c/src/add.m'), Language() => throw UnimplementedError(), }; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.iOS, + targetArchitecture: target, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + targetIOSSdk: targetIOSSdk, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: target, - targetOS: OS.iOS, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - targetIOSSdk: targetIOSSdk, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, @@ -86,6 +103,8 @@ void main() { sources: [sourceUri.toFilePath()], installName: installName, language: language, + optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -209,28 +228,39 @@ Future buildLib( final addCUri = packageUri.resolve('test/cbuilder/testfiles/add/src/add.c'); const name = 'add'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.iOS, + targetArchitecture: targetArchitecture, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + targetIOSSdk: IOSSdk.iPhoneOS, + targetIOSVersion: targetIOSVersion, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: targetArchitecture, - targetOS: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOS, - targetIOSVersion: targetIOSVersion, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [addCUri.toFilePath()], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart index c659f2f7a..d0be152b7 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart @@ -7,7 +7,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:test/test.dart'; @@ -27,35 +26,54 @@ void main() { Architecture.riscv64, ]; + const optimizationLevels = OptimizationLevel.values; + var selectOptimizationLevel = 0; + for (final linkMode in [DynamicLoadingBundled(), StaticLinking()]) { for (final target in targets) { - test('CBuilder $linkMode library $target', () async { + // Cycle through all optimization levels. + final optimizationLevel = optimizationLevels[selectOptimizationLevel]; + selectOptimizationLevel = + (selectOptimizationLevel + 1) % optimizationLevels.length; + test('CBuilder $linkMode library $target $optimizationLevel', () async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); final addCUri = packageUri.resolve('test/cbuilder/testfiles/add/src/add.c'); const name = 'add'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.linux, + targetArchitecture: target, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: target, - targetOS: OS.linux, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [addCUri.toFilePath()], + optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart index a24bd5c7b..9df36f3ad 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart @@ -10,7 +10,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:native_toolchain_c/src/utils/run_process.dart'; import 'package:test/test.dart'; @@ -34,10 +33,19 @@ void main() { Architecture.x64: '64-bit x86-64', }; + const optimizationLevels = OptimizationLevel.values; + var selectOptimizationLevel = 0; + for (final language in [Language.c, Language.objectiveC]) { for (final linkMode in [DynamicLoadingBundled(), StaticLinking()]) { for (final target in targets) { - test('CBuilder $linkMode $language library $target', () async { + // Cycle through all optimization levels. + final optimizationLevel = optimizationLevels[selectOptimizationLevel]; + selectOptimizationLevel = + (selectOptimizationLevel + 1) % optimizationLevels.length; + + test('CBuilder $linkMode $language library $target $optimizationLevel', + () async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); final sourceUri = switch (language) { @@ -49,27 +57,38 @@ void main() { }; const name = 'add'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.macOS, + targetArchitecture: target, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: target, - targetOS: OS.macOS, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [sourceUri.toFilePath()], language: language, + optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -139,27 +158,38 @@ Future buildLib( final addCUri = packageUri.resolve('test/cbuilder/testfiles/add/src/add.c'); const name = 'add'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.macOS, + targetArchitecture: targetArchitecture, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + targetMacOSVersion: targetMacOSVersion, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: targetArchitecture, - targetOS: OS.macOS, - targetMacOSVersion: targetMacOSVersion, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [addCUri.toFilePath()], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart index 9fe63c0ee..92109a604 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart @@ -10,7 +10,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:native_toolchain_c/src/native_toolchain/msvc.dart'; import 'package:native_toolchain_c/src/utils/run_process.dart'; @@ -41,6 +40,9 @@ void main() { Architecture.x64: 'x64', }; + const optimizationLevels = OptimizationLevel.values; + var selectOptimizationLevel = 0; + final dumpbinFileType = { DynamicLoadingBundled(): 'DLL', StaticLinking(): 'LIBRARY', @@ -48,33 +50,49 @@ void main() { for (final linkMode in [DynamicLoadingBundled(), StaticLinking()]) { for (final target in targets) { - test('CBuilder $linkMode library $target', () async { + // Cycle through all optimization levels. + final optimizationLevel = optimizationLevels[selectOptimizationLevel]; + selectOptimizationLevel = + (selectOptimizationLevel + 1) % optimizationLevels.length; + test('CBuilder $linkMode library $target $optimizationLevel', () async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); final addCUri = packageUri.resolve('test/cbuilder/testfiles/add/src/add.c'); const name = 'add'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.windows, + targetArchitecture: target, + linkModePreference: linkMode == DynamicLoadingBundled() + ? LinkModePreference.dynamic + : LinkModePreference.static, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetOS: OS.windows, - targetArchitecture: target, - buildMode: BuildMode.release, - linkModePreference: linkMode == DynamicLoadingBundled() - ? LinkModePreference.dynamic - : LinkModePreference.static, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [addCUri.toFilePath()], + optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart index faa0c7ece..3873a5b85 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart @@ -11,7 +11,6 @@ library; import 'dart:ffi'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:native_toolchain_c/src/utils/run_process.dart'; import 'package:test/test.dart'; @@ -44,25 +43,36 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: buildMode, - // Ignored by executables. - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); + final cbuilder = CBuilder.executable( name: name, sources: [helloWorldCUri.toFilePath()], pie: pic, + buildMode: buildMode, ); await cbuilder.run( config: buildConfig, @@ -87,7 +97,7 @@ void main() { (message) => message.contains(helloWorldCUri.toFilePath()), ); - switch ((buildConfig.targetOS, pic)) { + switch ((buildConfig.codeConfig.targetOS, pic)) { case (OS.windows, _) || (_, null): expect(compilerInvocation, isNot(contains('-fPIC'))); expect(compilerInvocation, isNot(contains('-fPIE'))); @@ -115,37 +125,35 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = dryRun - ? BuildConfig.dryRun( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: tempUri, - outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetOS: OS.current, - linkModePreference: LinkModePreference.dynamic, - linkingEnabled: false, - ) - : BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: tempUri, - outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, - ); - final buildOutput = BuildOutput(); + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: dryRun, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: dryRun ? null : cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( + outputDirectory: tempUri, + outputDirectoryShared: tempUri2, + ); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( sources: [addCUri.toFilePath()], name: name, assetName: name, pic: pic, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -164,7 +172,7 @@ void main() { final compilerInvocation = logMessages.singleWhere( (message) => message.contains(addCUri.toFilePath()), ); - switch ((buildConfig.targetOS, pic)) { + switch ((buildConfig.codeConfig.targetOS, pic)) { case (OS.windows, _) || (_, null): expect(compilerInvocation, isNot(contains('-fPIC'))); expect(compilerInvocation, isNot(contains('-fPIE'))); @@ -218,23 +226,31 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: BuildMode.release, - // Ignored by executables. - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); - final flag = switch (buildConfig.targetOS) { + final flag = switch (buildConfig.codeConfig.targetOS) { OS.windows => '/DFOO=USER_FLAG', _ => '-DFOO=USER_FLAG', }; @@ -243,6 +259,7 @@ void main() { name: name, sources: [definesCUri.toFilePath()], flags: [flag], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -276,33 +293,44 @@ void main() { packageUri.resolve('test/cbuilder/testfiles/includes/src/includes.c'); const name = 'includes'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutputBuilder = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, includes: [includeDirectoryUri.toFilePath()], sources: [includesCUri.toFilePath()], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, - output: buildOutput, + output: buildOutputBuilder, logger: logger, ); + final buildOutput = BuildOutput(buildOutputBuilder.json); expect(buildOutput.dependencies, contains(includesHUri)); final dylibUri = tempUri.resolve(OS.current.dylibFileName(name)); @@ -321,22 +349,31 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); - final stdFlag = switch (buildConfig.targetOS) { + final stdFlag = switch (buildConfig.codeConfig.targetOS) { OS.windows => '/std:$std', _ => '-std=$std', }; @@ -346,6 +383,7 @@ void main() { name: name, assetName: name, std: std, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -379,23 +417,31 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], - buildMode: BuildMode.release, + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - // Ignored by executables. - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); - final defaultStdLibLinkFlag = switch (buildConfig.targetOS) { + final defaultStdLibLinkFlag = switch (buildConfig.codeConfig.targetOS) { OS.windows => null, OS.linux => '-l stdc++', OS.macOS => '-l c++', @@ -406,6 +452,7 @@ void main() { name: name, sources: [helloWorldCppUri.toFilePath()], language: Language.cpp, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -443,29 +490,39 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], - buildMode: BuildMode.release, + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - // Ignored by executables. - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); + final cbuilder = CBuilder.executable( name: name, sources: [helloWorldCppUri.toFilePath()], language: Language.cpp, cppLinkStdLib: 'stdc++', + buildMode: BuildMode.release, ); - if (buildConfig.targetOS == OS.windows) { + if (buildConfig.codeConfig.targetOS == OS.windows) { await expectLater( () => cbuilder.run( config: buildConfig, @@ -497,6 +554,110 @@ void main() { expect(compilerInvocation, contains('-l stdc++')); } }); + + test('CBuilder libraries and libraryDirectories', () async { + final tempUri = await tempDirForTest(); + final tempUri2 = await tempDirForTest(); + + final dynamicallyLinkedSrcUri = + packageUri.resolve('test/cbuilder/testfiles/dynamically_linked/src/'); + final dynamicallyLinkedCUri = + dynamicallyLinkedSrcUri.resolve('dynamically_linked.c'); + final debugCUri = dynamicallyLinkedSrcUri.resolve('debug.c'); + final mathCUri = dynamicallyLinkedSrcUri.resolve('math.c'); + + if (!await File.fromUri(dynamicallyLinkedCUri).exists()) { + throw Exception('Run the test from the root directory.'); + } + const name = 'dynamically_linked'; + + final logMessages = []; + final logger = createCapturingLogger(logMessages); + + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( + outputDirectory: tempUri, + outputDirectoryShared: tempUri2, + ); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); + + final debugBuilder = CBuilder.library( + name: 'debug', + assetName: 'debug', + includes: [dynamicallyLinkedSrcUri.toFilePath()], + sources: [debugCUri.toFilePath()], + buildMode: BuildMode.release, + ); + + await debugBuilder.run( + config: buildConfig, + output: buildOutput, + logger: logger, + ); + + final debugLibraryFile = + File.fromUri(tempUri.resolve(OS.current.dylibFileName('debug'))); + final nestedDebugLibraryFile = File.fromUri( + tempUri.resolve('debug/').resolve(OS.current.dylibFileName('debug')), + ); + await nestedDebugLibraryFile.parent.create(recursive: true); + await debugLibraryFile.rename(nestedDebugLibraryFile.path); + + final mathBuilder = CBuilder.library( + name: 'math', + assetName: 'math', + includes: [dynamicallyLinkedSrcUri.toFilePath()], + sources: [mathCUri.toFilePath()], + libraries: ['debug'], + libraryDirectories: ['debug'], + ); + + await mathBuilder.run( + config: buildConfig, + output: buildOutput, + logger: logger, + ); + + await nestedDebugLibraryFile.rename(debugLibraryFile.path); + + final executableBuilder = CBuilder.executable( + name: name, + includes: [dynamicallyLinkedSrcUri.toFilePath()], + sources: [dynamicallyLinkedCUri.toFilePath()], + libraries: ['math'], + ); + + await executableBuilder.run( + config: buildConfig, + output: buildOutput, + logger: logger, + ); + + final executableUri = tempUri.resolve(OS.current.executableFileName(name)); + expect(await File.fromUri(executableUri).exists(), true); + final result = await runProcess( + executable: executableUri, + logger: logger, + ); + expect(result.exitCode, 0); + }); } Future testDefines({ @@ -514,21 +675,30 @@ Future testDefines({ } const name = 'defines'; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + // Ignored by executables. + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: buildMode, - // Ignored by executables. - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); + final cbuilder = CBuilder.executable( name: name, sources: [definesCUri.toFilePath()], @@ -538,6 +708,7 @@ Future testDefines({ }, buildModeDefine: buildModeDefine, ndebugDefine: ndebugDefine, + buildMode: buildMode, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart index 4f1b58e98..8578f2893 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart @@ -9,7 +9,6 @@ library; import 'package:collection/collection.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/src/cbuilder/compiler_resolver.dart'; import 'package:native_toolchain_c/src/native_toolchain/apple_clang.dart'; import 'package:native_toolchain_c/src/native_toolchain/clang.dart'; @@ -41,48 +40,69 @@ void main() { final envScript = [ ...await msvc.vcvars64.defaultResolver!.resolve(logger: logger) ].firstOrNull?.uri; - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: 'dummy', + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: CCompilerConfig( + archiver: ar, + compiler: cc, + linker: ld, + envScript: envScript, + ), + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: 'dummy', - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - cCompiler: CCompilerConfig( - archiver: ar, - compiler: cc, - linker: ld, - envScript: envScript, - ), - linkingEnabled: false, ); - final resolver = CompilerResolver(hookConfig: buildConfig, logger: logger); + final buildConfig = BuildConfig(buildConfigBuilder.json); + final resolver = + CompilerResolver(codeConfig: buildConfig.codeConfig, logger: logger); final compiler = await resolver.resolveCompiler(); final archiver = await resolver.resolveArchiver(); - expect(compiler.uri, buildConfig.cCompiler.compiler); - expect(archiver.uri, buildConfig.cCompiler.archiver); + expect(compiler.uri, buildConfig.codeConfig.cCompiler?.compiler); + expect(archiver.uri, buildConfig.codeConfig.cCompiler?.archiver); }); test('No compiler found', () async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: tempUri, + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: 'dummy', + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.windows, + targetArchitecture: Architecture.arm64, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectoryShared: tempUri2, - packageName: 'dummy', - packageRoot: tempUri, - targetArchitecture: Architecture.arm64, - targetOS: OS.windows, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - linkingEnabled: false, + outputDirectory: tempUri, ); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final resolver = CompilerResolver( - hookConfig: buildConfig, + codeConfig: buildConfig.codeConfig, logger: logger, hostOS: OS.android, // This is never a host. hostArchitecture: Architecture.arm64, // This is never a host. diff --git a/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart b/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart index 4d76aaf14..e251080a2 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart @@ -11,7 +11,6 @@ library; import 'dart:ffi'; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:test/test.dart'; @@ -36,26 +35,36 @@ void main() { final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], - buildMode: BuildMode.release, + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: OS.current, + targetArchitecture: Architecture.current, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: Architecture.current, - targetOS: OS.current, - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutput = BuildOutputBuilder(); final cbuilder = CBuilder.library( name: name, assetName: name, sources: [addMUri.toFilePath()], language: Language.objectiveC, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/debug.c b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/debug.c new file mode 100644 index 000000000..b840d62a5 --- /dev/null +++ b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/debug.c @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#include "debug.h" + +#ifdef DEBUG +#include +#include +#endif + +int debug_printf(const char* format, ...) { +#ifdef DEBUG + va_list args; + va_start(args, format); + int ret = vprintf(format, args); + va_end(args); + return ret; +#else + return 0; +#endif +} diff --git a/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/debug.h b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/debug.h new file mode 100644 index 000000000..557cba0d1 --- /dev/null +++ b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/debug.h @@ -0,0 +1,11 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#if _WIN32 +#define MYLIB_EXPORT __declspec(dllexport) +#else +#define MYLIB_EXPORT +#endif + +MYLIB_EXPORT int debug_printf(const char * format, ...); diff --git a/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/dynamically_linked.c b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/dynamically_linked.c new file mode 100644 index 000000000..c8cc6d94b --- /dev/null +++ b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/dynamically_linked.c @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#include "math.h" + +int main() { + return math_add(1, 2) == 3 ? 0 : 1; +} diff --git a/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/math.c b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/math.c new file mode 100644 index 000000000..08313a5bb --- /dev/null +++ b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/math.c @@ -0,0 +1,11 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#include "debug.h" +#include "math.h" + +int32_t math_add(int32_t a, int32_t b) { + debug_printf("Adding %i and %i.\n", a, b); + return a + b; +} diff --git a/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/math.h b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/math.h new file mode 100644 index 000000000..7d22a65c8 --- /dev/null +++ b/pkgs/native_toolchain_c/test/cbuilder/testfiles/dynamically_linked/src/math.h @@ -0,0 +1,13 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#include + +#if _WIN32 +#define MYLIB_EXPORT __declspec(dllexport) +#else +#define MYLIB_EXPORT +#endif + +MYLIB_EXPORT int32_t math_add(int32_t a, int32_t b); diff --git a/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart b/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart index 57f37bbda..2dbc32946 100644 --- a/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart +++ b/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart @@ -4,7 +4,6 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import '../helpers.dart'; @@ -26,31 +25,43 @@ Future buildTestArchive( final logMessages = []; final logger = createCapturingLogger(logMessages); - final buildConfig = BuildConfig.build( - supportedAssetTypes: [CodeAsset.type], + final buildConfigBuilder = BuildConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: name, + packageRoot: tempUri, + ) + ..setupBuildConfig( + linkingEnabled: false, + dryRun: false, + ) + ..setupCodeConfig( + targetOS: os, + targetArchitecture: architecture, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + buildConfigBuilder.setupBuildRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: name, - packageRoot: tempUri, - targetArchitecture: architecture, - targetOS: os, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - cCompiler: cCompiler, - linkingEnabled: false, ); - final buildOutput = BuildOutput(); + + final buildConfig = BuildConfig(buildConfigBuilder.json); + final buildOutputBuilder = BuildOutputBuilder(); + final cbuilder = CBuilder.library( name: name, assetName: '', sources: [test1Uri.toFilePath(), test2Uri.toFilePath()], linkModePreference: LinkModePreference.static, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, - output: buildOutput, + output: buildOutputBuilder, logger: logger, ); - return buildOutput.codeAssets.all.first.file!; + final buildOutput = BuildOutput(buildOutputBuilder.json); + return buildOutput.codeAssets.first.file!; } diff --git a/pkgs/native_toolchain_c/test/clinker/objects_test.dart b/pkgs/native_toolchain_c/test/clinker/objects_test.dart index 1f9654732..0797b194c 100644 --- a/pkgs/native_toolchain_c/test/clinker/objects_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/objects_test.dart @@ -9,7 +9,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:test/test.dart'; @@ -27,25 +26,35 @@ Future main() async { const name = 'mylibname'; test('link two objects', () async { - final linkOutput = LinkOutput(); final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); final uri = await buildTestArchive(tempUri, tempUri2, os, architecture); - final linkConfig = LinkConfig.build( - supportedAssetTypes: [CodeAsset.type], + + final linkConfigBuilder = LinkConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: 'testpackage', + packageRoot: tempUri, + ) + ..setupLinkConfig( + assets: [], + ) + ..setupCodeConfig( + targetOS: os, + targetArchitecture: architecture, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + linkConfigBuilder.setupLinkRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: 'testpackage', - packageRoot: tempUri, - targetArchitecture: architecture, - targetOS: os, - buildMode: BuildMode.debug, - linkModePreference: LinkModePreference.dynamic, - assets: [], - cCompiler: cCompiler, + recordedUsesFile: null, ); - printOnFailure(linkConfig.cCompiler.toString()); + final linkConfig = LinkConfig(linkConfigBuilder.json); + final linkOutput = LinkOutputBuilder(); + + printOnFailure(linkConfig.codeConfig.cCompiler.toString()); printOnFailure(Platform.environment.keys.toList().toString()); await CLinker.library( name: name, @@ -58,8 +67,9 @@ Future main() async { logger: logger, ); - expect(linkOutput.codeAssets.all, hasLength(1)); - final asset = linkOutput.codeAssets.all.first; + final codeAssets = LinkOutput(linkOutput.json).codeAssets; + expect(codeAssets, hasLength(1)); + final asset = codeAssets.first; expect(asset, isA()); await expectSymbols( asset: asset, diff --git a/pkgs/native_toolchain_c/test/clinker/throws_test.dart b/pkgs/native_toolchain_c/test/clinker/throws_test.dart index 48e5838aa..9a1c2a633 100644 --- a/pkgs/native_toolchain_c/test/clinker/throws_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/throws_test.dart @@ -4,7 +4,6 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:test/test.dart'; @@ -23,25 +22,36 @@ Future main() async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); + final linkConfigBuilder = LinkConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: 'testpackage', + packageRoot: tempUri, + ) + ..setupLinkConfig( + assets: [], + ) + ..setupCodeConfig( + targetOS: os, + targetArchitecture: Architecture.x64, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + linkConfigBuilder.setupLinkRunConfig( + outputDirectoryShared: tempUri2, + outputDirectory: tempUri, + recordedUsesFile: null, + ); + final linkHookConfig = LinkConfig(linkConfigBuilder.json); + final cLinker = CLinker.library( name: 'mylibname', linkerOptions: LinkerOptions.manual(), ); await expectLater( () => cLinker.run( - config: LinkConfig.build( - supportedAssetTypes: [CodeAsset.type], - outputDirectory: tempUri, - outputDirectoryShared: tempUri2, - packageName: 'testpackage', - packageRoot: tempUri, - targetArchitecture: Architecture.x64, - targetOS: os, - buildMode: BuildMode.debug, - linkModePreference: LinkModePreference.dynamic, - assets: [], - ), - output: LinkOutput(), + config: linkHookConfig, + output: LinkOutputBuilder(), logger: logger, ), throwsUnsupportedError, diff --git a/pkgs/native_toolchain_c/test/clinker/treeshake_cross_test.dart b/pkgs/native_toolchain_c/test/clinker/treeshake_cross_test.dart index 9ca276f64..b3672ea47 100644 --- a/pkgs/native_toolchain_c/test/clinker/treeshake_cross_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/treeshake_cross_test.dart @@ -9,7 +9,7 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:test/test.dart'; import 'treeshake_helper.dart'; diff --git a/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart b/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart index 6bf1b5d71..d8d55c88b 100644 --- a/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart +++ b/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart @@ -9,7 +9,6 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:test/test.dart'; @@ -62,30 +61,39 @@ Future runTests(List architectures) async { architecture, ); - final linkOutput = LinkOutput(); - - final config = LinkConfig.build( - supportedAssetTypes: [CodeAsset.type], + final linkConfigBuilder = LinkConfigBuilder() + ..setupHookConfig( + buildAssetTypes: [CodeAsset.type], + packageName: 'testpackage', + packageRoot: tempUri, + ) + ..setupLinkConfig( + assets: [], + ) + ..setupCodeConfig( + targetOS: os, + targetArchitecture: architecture, + linkModePreference: LinkModePreference.dynamic, + cCompilerConfig: cCompiler, + ); + linkConfigBuilder.setupLinkRunConfig( outputDirectory: tempUri, outputDirectoryShared: tempUri2, - packageName: 'testpackage', - packageRoot: tempUri, - targetArchitecture: architecture, - targetOS: os, - buildMode: BuildMode.release, - linkModePreference: LinkModePreference.dynamic, - assets: [], - cCompiler: cCompiler, + recordedUsesFile: null, ); - printOnFailure(config.cCompiler.toString()); + final linkConfig = LinkConfig(linkConfigBuilder.json); + final linkOutputBuilder = LinkOutputBuilder(); + + printOnFailure(linkConfig.codeConfig.cCompiler.toString()); printOnFailure(Platform.environment.keys.toList().toString()); await clinker.linker([testArchive.toFilePath()]).run( - config: config, - output: linkOutput, + config: linkConfig, + output: linkOutputBuilder, logger: logger, ); - final asset = linkOutput.codeAssets.all.first; + final linkOutput = LinkOutput(linkOutputBuilder.json); + final asset = linkOutput.codeAssets.first; final filePath = asset.file!.toFilePath(); final machine = await readelfMachine(filePath); diff --git a/pkgs/native_toolchain_c/test/clinker/treeshake_test.dart b/pkgs/native_toolchain_c/test/clinker/treeshake_test.dart index e67136319..9ac7a3957 100644 --- a/pkgs/native_toolchain_c/test/clinker/treeshake_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/treeshake_test.dart @@ -9,7 +9,7 @@ library; import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets.dart'; import 'package:test/test.dart'; import 'treeshake_helper.dart'; diff --git a/pkgs/native_toolchain_c/test/helpers.dart b/pkgs/native_toolchain_c/test/helpers.dart index c1575920a..b2c647259 100644 --- a/pkgs/native_toolchain_c/test/helpers.dart +++ b/pkgs/native_toolchain_c/test/helpers.dart @@ -7,11 +7,13 @@ import 'dart:ffi'; import 'dart:io'; import 'package:logging/logging.dart'; -import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:native_toolchain_c/src/native_toolchain/apple_clang.dart'; import 'package:native_toolchain_c/src/utils/run_process.dart'; import 'package:test/test.dart'; +export 'package:native_assets_cli/code_assets_builder.dart'; + /// Returns a suffix for a test that is parameterized. /// /// [tags] represent the current configuration of the test. Each element @@ -153,13 +155,15 @@ final List? _envScriptArgs = Platform /// Configuration for the native toolchain. /// /// Provided on Dart CI. -final cCompiler = CCompilerConfig( - compiler: _cc, - archiver: _ar, - linker: _ld, - envScript: _envScript, - envScriptArgs: _envScriptArgs, -); +final cCompiler = (_cc == null || _ar == null || _ld == null) + ? null + : CCompilerConfig( + compiler: _cc!, + archiver: _ar!, + linker: _ld!, + envScript: _envScript, + envScriptArgs: _envScriptArgs, + ); extension on String { Uri asFileUri() => Uri.file(this); @@ -253,3 +257,48 @@ Future expectSymbols({ throw UnimplementedError(); } } + +Future textSectionAddress(Uri dylib) async { + if (Platform.isMacOS) { + // Find the line in the objdump output that looks like: + // 11 .text 00000046 00000000000045a0 TEXT + final result = await runProcess( + executable: Uri.file('objdump'), + arguments: ['--headers', dylib.toFilePath()], + logger: logger, + ); + expect(result.exitCode, 0); + final textSection = + result.stdout.split('\n').firstWhere((e) => e.contains('.text')); + final parsed = textSection.split(' ').where((e) => e.isNotEmpty).toList(); + expect(parsed[1], '.text'); + expect(parsed[4], 'TEXT'); + final vma = int.parse(parsed[3], radix: 16); + return vma; + } + if (Platform.isLinux) { + // Find the line in the readelf output that looks like: + // [11] .text PROGBITS 00004328 000328 000064 00 AX 0 0 4 + final result = await readelf(dylib.toFilePath(), 'S'); + final textSection = + result.split('\n').firstWhere((e) => e.contains('.text')); + final parsed = textSection.split(' ').where((e) => e.isNotEmpty).toList(); + expect(parsed[1], '.text'); + expect(parsed[2], 'PROGBITS'); + final addr = int.parse(parsed[3], radix: 16); + return addr; + } + throw UnimplementedError(); +} + +Future expectPageSize( + Uri dylib, + int pageSize, +) async { + if (Platform.isMacOS || Platform.isLinux) { + // If page size is 16kb, the `.text` section address should be + // above 0x4000. With smaller page sizes it's above 0x1000. + final vma = await textSectionAddress(dylib); + expect(vma, greaterThanOrEqualTo(pageSize)); + } +} diff --git a/pkgs/native_toolchain_c/test/tool/tool_resolver_test.dart b/pkgs/native_toolchain_c/test/tool/tool_resolver_test.dart index 85abb1996..1bf295aec 100644 --- a/pkgs/native_toolchain_c/test/tool/tool_resolver_test.dart +++ b/pkgs/native_toolchain_c/test/tool/tool_resolver_test.dart @@ -4,7 +4,6 @@ import 'dart:io'; -import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/src/native_toolchain/apple_clang.dart'; import 'package:native_toolchain_c/src/native_toolchain/clang.dart'; import 'package:native_toolchain_c/src/native_toolchain/msvc.dart'; diff --git a/pkgs/objective_c/CHANGELOG.md b/pkgs/objective_c/CHANGELOG.md index 87e417748..e3b4b3899 100644 --- a/pkgs/objective_c/CHANGELOG.md +++ b/pkgs/objective_c/CHANGELOG.md @@ -1,6 +1,33 @@ -## 3.1.0-wip +## 4.0.1-wip -- Use ffigen 15.1.0 +- Reduces the chances of duplicate symbols by adding a `DOBJC_` prefix. +- Ensure that required symbols are available to FFI even when the final binary + is linked with `-dead_strip`. + +## 4.0.0 + +- Use ffigen 16.0.0 +- Add `NSOrderedCollectionDifference` to the package. +- __Breaking change__: As part of ffigen 16.0.0, the way ObjC categories are + generated has changed. Instead of inserting their methods into the interface, + categories now generate Dart extension methods. For ordinary methods this + makes no difference, but static methods now need to be invoked on the + extension instead of on the class. `MyInterface.staticMethod` must change to + `MyCategory.staticMethod` +- __Breaking change__`: Another effect of the category overhaul is that we don't + automatically included all categories any more. This reduces the ammount of + bindings generated by omitting methods from obscure categories that most users + don't need. If you notice that a method you were using is now missing, there + are two options: + 1. Look up which category it came from in the Apple documentation, and + generate bindings for that category yourself in your own package. + 2. If the category is common/important enough that it should be included + in package:objective_c, file a bug and we'll consider adding it back in. +- Fixed [a bug](https://github.com/dart-lang/native/issues/1702) where missing + methods could cause runtime errors, even if they weren't being implemented. +- Throw more useful errors in all internal failure cases. +- Added `ObjCProtocolMethod.isAvailable` getter, to make it easier to implement + fallback logic if a method is missing at runtime. ## 3.0.0 diff --git a/pkgs/objective_c/ffigen_c.yaml b/pkgs/objective_c/ffigen_c.yaml index a3e39a576..a499dc5b2 100644 --- a/pkgs/objective_c/ffigen_c.yaml +++ b/pkgs/objective_c/ffigen_c.yaml @@ -19,24 +19,25 @@ functions: - 'sel_registerName' - 'sel_getName' - 'protocol_getMethodDescription' - - 'disposeObjCBlockWithClosure' - - 'isValidBlock' - - 'isValidObject' + - 'protocol_getName' - 'Dart_InitializeApiDL' - 'newFinalizableHandle' - - 'newBlockFinalizableHandle' - - 'deleteFinalizableHandle' - - 'newFinalizableBool' + - 'DOBJC_.*' leaf: include: - '.*' exclude: - 'objc_msgSend.*' - - 'disposeObjCBlockWithClosure' - - 'newFinalizableHandle' - - 'deleteFinalizableHandle' - - 'newFinalizableBool' + - 'DOBJC_deleteFinalizableHandle' + - 'DOBJC_disposeObjCBlockWithClosure' + - 'DOBJC_newFinalizableBool' + - 'DOBJC_newFinalizableHandle' rename: + 'DOBJC_disposeObjCBlockWithClosure': 'disposeObjCBlockWithClosure' + 'DOBJC_isValidBlock': 'isValidBlock' + 'DOBJC_newFinalizableHandle': 'newFinalizableHandle' + 'DOBJC_deleteFinalizableHandle': 'deleteFinalizableHandle' + 'DOBJC_newFinalizableBool': 'newFinalizableBool' 'sel_registerName': 'registerName' 'sel_getName': 'getName' 'objc_getClass': 'getClass' @@ -51,6 +52,7 @@ functions: 'objc_copyClassList': 'copyClassList' 'objc_getProtocol': 'getProtocol' 'protocol_getMethodDescription': 'getMethodDescription' + 'protocol_getName': 'getProtocolName' globals: include: - '_NSConcrete.*Block' diff --git a/pkgs/objective_c/ffigen_objc.yaml b/pkgs/objective_c/ffigen_objc.yaml index 1b1f7ebe9..b7a691287 100644 --- a/pkgs/objective_c/ffigen_objc.yaml +++ b/pkgs/objective_c/ffigen_objc.yaml @@ -12,6 +12,7 @@ headers: - 'src/proxy.h' ffi-native: exclude-all-by-default: true +include-transitive-objc-categories: false generate-for-package-objective-c: true sort: true external-versions: @@ -23,9 +24,9 @@ external-versions: objc-interfaces: # Keep in sync with ffigen's ObjCBuiltInFunctions.builtInInterfaces. include: - - DartInputStreamAdapter - - DartProxy - - DartProxyBuilder + - DOBJCDartInputStreamAdapter + - DOBJCDartProxy + - DOBJCDartProxyBuilder - NSArray - NSCharacterSet - NSCoder @@ -51,6 +52,7 @@ objc-interfaces: - NSNumber - NSObject - NSOutputStream + - NSOrderedCollectionDifference - NSOrderedSet - NSProxy - NSRunLoop @@ -61,9 +63,19 @@ objc-interfaces: - NSURLHandle - NSValue - Protocol + rename: + 'DOBJCDartInputStreamAdapter': 'DartInputStreamAdapter' + 'DOBJCDartProxy': 'DartProxy' + 'DOBJCDartProxyBuilder': 'DartProxyBuilder' objc-protocols: include: - NSStreamDelegate +objc-categories: + include: + - NSDataCreation + - NSExtendedMutableData + - NSNumberCreation + - NSStringExtensionMethods structs: include: - _NSRange diff --git a/pkgs/objective_c/lib/objective_c.dart b/pkgs/objective_c/lib/objective_c.dart index b4a63bb53..6970a92f9 100644 --- a/pkgs/objective_c/lib/objective_c.dart +++ b/pkgs/objective_c/lib/objective_c.dart @@ -36,6 +36,7 @@ export 'src/objective_c_bindings_generated.dart' NSDataBase64DecodingOptions, NSDataBase64EncodingOptions, NSDataCompressionAlgorithm, + NSDataCreation, NSDataReadingOptions, NSDataSearchOptions, NSDataWritingOptions, @@ -44,6 +45,7 @@ export 'src/objective_c_bindings_generated.dart' NSEnumerationOptions, NSEnumerator, NSError, + NSExtendedMutableData, NSFastEnumerationState, NSIndexSet, NSInputStream, @@ -65,7 +67,9 @@ export 'src/objective_c_bindings_generated.dart' NSMutableString, NSNotification, NSNumber, + NSNumberCreation, NSObject, + NSOrderedCollectionDifference, NSOrderedCollectionDifferenceCalculationOptions, NSOrderedSet, NSOutputStream, @@ -82,6 +86,7 @@ export 'src/objective_c_bindings_generated.dart' NSStringCompareOptions, NSStringEncodingConversionOptions, NSStringEnumerationOptions, + NSStringExtensionMethods, NSURL, NSURLBookmarkCreationOptions, NSURLBookmarkResolutionOptions, diff --git a/pkgs/objective_c/lib/src/c_bindings_generated.dart b/pkgs/objective_c/lib/src/c_bindings_generated.dart index 22e25ae8d..a2fc5f973 100644 --- a/pkgs/objective_c/lib/src/c_bindings_generated.dart +++ b/pkgs/objective_c/lib/src/c_bindings_generated.dart @@ -20,6 +20,16 @@ library; import 'dart:ffi' as ffi; +@ffi.Native< + ffi.Void Function( + ffi.Pointer< + ffi.NativeFunction)>>, + ffi.Pointer)>(isLeaf: true) +external void DOBJC_runOnMainThread( + ffi.Pointer)>> fn, + ffi.Pointer arg, +); + /// \mainpage Dynamically Linked Dart API /// /// This exposes a subset of symbols from dart_api.h and dart_native_api.h @@ -72,13 +82,15 @@ external ffi.Pointer> copyClassList( ffi.Pointer count, ); -@ffi.Native() +@ffi.Native( + symbol: "DOBJC_deleteFinalizableHandle") external void deleteFinalizableHandle( Dart_FinalizableHandle handle, Object owner, ); -@ffi.Native)>() +@ffi.Native)>( + symbol: "DOBJC_disposeObjCBlockWithClosure") external void disposeObjCBlockWithClosure( ffi.Pointer block, ); @@ -120,7 +132,14 @@ external ffi.Pointer getProtocol( ffi.Pointer name, ); -@ffi.Native)>(isLeaf: true) +@ffi.Native Function(ffi.Pointer)>( + symbol: "protocol_getName", isLeaf: true) +external ffi.Pointer getProtocolName( + ffi.Pointer proto, +); + +@ffi.Native)>( + symbol: "DOBJC_isValidBlock", isLeaf: true) external bool isValidBlock( ffi.Pointer block, ); @@ -134,13 +153,15 @@ external void msgSendFpret(); @ffi.Native(symbol: "objc_msgSend_stret") external void msgSendStret(); -@ffi.Native Function(ffi.Handle)>() +@ffi.Native Function(ffi.Handle)>( + symbol: "DOBJC_newFinalizableBool") external ffi.Pointer newFinalizableBool( Object owner, ); @ffi.Native< - Dart_FinalizableHandle Function(ffi.Handle, ffi.Pointer)>() + Dart_FinalizableHandle Function(ffi.Handle, ffi.Pointer)>( + symbol: "DOBJC_newFinalizableHandle") external Dart_FinalizableHandle newFinalizableHandle( Object owner, ffi.Pointer object, @@ -180,8 +201,6 @@ typedef ObjCSelector = _ObjCSelector; final class _Dart_FinalizableHandle extends ffi.Opaque {} -final class _Dart_Handle extends ffi.Opaque {} - final class _ObjCBlockDesc extends ffi.Struct { @ffi.UnsignedLong() external int reserved; diff --git a/pkgs/objective_c/lib/src/internal.dart b/pkgs/objective_c/lib/src/internal.dart index 5a9b7054d..b65b58b95 100644 --- a/pkgs/objective_c/lib/src/internal.dart +++ b/pkgs/objective_c/lib/src/internal.dart @@ -9,6 +9,7 @@ import 'package:ffi/ffi.dart'; import 'c_bindings_generated.dart' as c; import 'objective_c_bindings_generated.dart' as objc; +import 'selector.dart'; final class UseAfterReleaseError extends StateError { UseAfterReleaseError() : super('Use after release error'); @@ -19,12 +20,64 @@ final class DoubleReleaseError extends StateError { } final class UnimplementedOptionalMethodException implements Exception { - String clazz; - String method; + final String clazz; + final String method; UnimplementedOptionalMethodException(this.clazz, this.method); @override - String toString() => 'Instance of $clazz does not implement $method'; + String toString() => + '$runtimeType: Instance of $clazz does not implement $method'; +} + +final class FailedToLoadClassException implements Exception { + final String clazz; + FailedToLoadClassException(this.clazz); + + @override + String toString() => '$runtimeType: Failed to load Objective-C class: $clazz'; +} + +final class FailedToLoadProtocolException implements Exception { + final String protocol; + FailedToLoadProtocolException(this.protocol); + + @override + String toString() => + '$runtimeType: Failed to load Objective-C protocol: $protocol'; +} + +/// Failed to load a method of a protocol. +/// +/// This means that a method that was seen in the protocol declaration at +/// compile time was missing from the protocol at runtime. This is usually +/// caused by a version mismatch between the compile time header and the runtime +/// framework (eg, running an app on an older iOS device). +/// +/// To fix this, check whether the method exists at runtime, using +/// `ObjCProtocolMethod.isAvailable`, and implement fallback logic if it's +/// missing. +final class FailedToLoadProtocolMethodException implements Exception { + final String protocol; + final String method; + FailedToLoadProtocolMethodException(this.protocol, this.method); + + @override + String toString() => + '$runtimeType: Failed to load Objective-C protocol method: ' + '$protocol.$method'; +} + +final class ObjCRuntimeError extends Error { + final String message; + ObjCRuntimeError(this.message); + + @override + String toString() => '$runtimeType: $message'; +} + +extension GetProtocolName on Pointer { + /// Returns the name of the protocol. + String get name => c.getProtocolName(this).cast().toDartString(); } /// Only for use by ffigen bindings. @@ -41,7 +94,7 @@ Pointer getClass(String name) { final clazz = c.getClass(cstr.cast()); calloc.free(cstr); if (clazz == nullptr) { - throw Exception('Failed to load Objective-C class: $name'); + throw FailedToLoadClassException(name); } return clazz; } @@ -52,13 +105,13 @@ Pointer getProtocol(String name) { final clazz = c.getProtocol(cstr.cast()); calloc.free(cstr); if (clazz == nullptr) { - throw Exception('Failed to load Objective-C protocol: $name'); + throw FailedToLoadProtocolException(name); } return clazz; } /// Only for use by ffigen bindings. -objc.NSMethodSignature getProtocolMethodSignature( +objc.NSMethodSignature? getProtocolMethodSignature( Pointer protocol, Pointer sel, { required bool isRequired, @@ -67,12 +120,13 @@ objc.NSMethodSignature getProtocolMethodSignature( final sig = c.getMethodDescription(protocol, sel, isRequired, isInstanceMethod).types; if (sig == nullptr) { - throw Exception('Failed to load method of Objective-C protocol'); + return null; } final sigObj = objc.NSMethodSignature.signatureWithObjCTypes_(sig); if (sigObj == null) { - throw Exception( - 'Failed to construct signature for Objective-C protocol method'); + throw ObjCRuntimeError( + 'Failed to construct signature for Objective-C protocol method: ' + '${protocol.name}.${sel.toDartString()}'); } return sigObj; } diff --git a/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart b/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart index 084f22e2b..e36f5d26e 100644 --- a/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart +++ b/pkgs/objective_c/lib/src/objective_c_bindings_generated.dart @@ -40,7 +40,7 @@ set NSLocalizedDescriptionKey(NSString value) { ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) external ffi.Pointer - _ObjectiveCBindings_wrapListenerBlock_hepzs( + _ObjectiveCBindings_wrapListenerBlock_18d6mda( ffi.Pointer block, ); @@ -48,7 +48,7 @@ external ffi.Pointer ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) external ffi.Pointer - _ObjectiveCBindings_wrapListenerBlock_m1viep( + _ObjectiveCBindings_wrapListenerBlock_1j2nt86( ffi.Pointer block, ); @@ -56,7 +56,23 @@ external ffi.Pointer ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) external ffi.Pointer - _ObjectiveCBindings_wrapListenerBlock_sjfpmz( + _ObjectiveCBindings_wrapListenerBlock_ovsamd( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _ObjectiveCBindings_wrapListenerBlock_wjovn7( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _ObjectiveCBindings_wrapListenerBlock_wjvic9( ffi.Pointer block, ); @@ -77,75 +93,13 @@ class DartInputStreamAdapter extends NSInputStream { /// Returns whether [obj] is an instance of [DartInputStreamAdapter]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_DartInputStreamAdapter); - } - - /// addData: - int addData_(NSData data) { - return _objc_msgSend_eymsul( - this.ref.pointer, _sel_addData_, data.ref.pointer); - } - - /// getBoundStreamsWithBufferSize:inputStream:outputStream: - static void getBoundStreamsWithBufferSize_inputStream_outputStream_( - int bufferSize, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_5r8xlx( - _class_DartInputStreamAdapter, - _sel_getBoundStreamsWithBufferSize_inputStream_outputStream_, - bufferSize, - inputStream, - outputStream); - } - - /// getStreamsToHostWithName:port:inputStream:outputStream: - static void getStreamsToHostWithName_port_inputStream_outputStream_( - NSString hostname, - int port, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_imc4v7( - _class_DartInputStreamAdapter, - _sel_getStreamsToHostWithName_port_inputStream_outputStream_, - hostname.ref.pointer, - port, - inputStream, - outputStream); - } - - /// initWithData: - DartInputStreamAdapter initWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithData_, data.ref.pointer); - return DartInputStreamAdapter.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithFileAtPath: - DartInputStreamAdapter? initWithFileAtPath_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithFileAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : DartInputStreamAdapter.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithURL: - DartInputStreamAdapter? initWithURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( - this.ref.retainAndReturnPointer(), _sel_initWithURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : DartInputStreamAdapter.castFromPointer(_ret, - retain: false, release: true); + return _objc_msgSend_69e0x1(obj.ref.pointer, _sel_isKindOfClass_, + _class_DOBJCDartInputStreamAdapter); } /// inputStreamWithData: static DartInputStreamAdapter? inputStreamWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7(_class_DartInputStreamAdapter, + final _ret = _objc_msgSend_62nh5j(_class_DOBJCDartInputStreamAdapter, _sel_inputStreamWithData_, data.ref.pointer); return _ret.address == 0 ? null @@ -155,7 +109,7 @@ class DartInputStreamAdapter extends NSInputStream { /// inputStreamWithFileAtPath: static DartInputStreamAdapter? inputStreamWithFileAtPath_(NSString path) { - final _ret = _objc_msgSend_juohf7(_class_DartInputStreamAdapter, + final _ret = _objc_msgSend_62nh5j(_class_DOBJCDartInputStreamAdapter, _sel_inputStreamWithFileAtPath_, path.ref.pointer); return _ret.address == 0 ? null @@ -168,15 +122,15 @@ class DartInputStreamAdapter extends NSInputStream { /// -1 => The `NSInputStream` has been closed and the port can be closed. /// _ => The number of types being required in a `read:maxLength` call. static DartInputStreamAdapter inputStreamWithPort_(int sendPort) { - final _ret = _objc_msgSend_n9eq1n( - _class_DartInputStreamAdapter, _sel_inputStreamWithPort_, sendPort); + final _ret = _objc_msgSend_r25hnf(_class_DOBJCDartInputStreamAdapter, + _sel_inputStreamWithPort_, sendPort); return DartInputStreamAdapter.castFromPointer(_ret, retain: true, release: true); } /// inputStreamWithURL: static DartInputStreamAdapter? inputStreamWithURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(_class_DartInputStreamAdapter, + final _ret = _objc_msgSend_62nh5j(_class_DOBJCDartInputStreamAdapter, _sel_inputStreamWithURL_, url.ref.pointer); return _ret.address == 0 ? null @@ -184,28 +138,62 @@ class DartInputStreamAdapter extends NSInputStream { retain: true, release: true); } + /// addData: + int addData_(NSData data) { + return _objc_msgSend_1p4b7x4( + this.ref.pointer, _sel_addData_, data.ref.pointer); + } + + /// initWithData: + DartInputStreamAdapter initWithData_(NSData data) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithData_, data.ref.pointer); + return DartInputStreamAdapter.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithFileAtPath: + DartInputStreamAdapter? initWithFileAtPath_(NSString path) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithFileAtPath_, path.ref.pointer); + return _ret.address == 0 + ? null + : DartInputStreamAdapter.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithURL: + DartInputStreamAdapter? initWithURL_(NSURL url) { + final _ret = _objc_msgSend_62nh5j( + this.ref.retainAndReturnPointer(), _sel_initWithURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : DartInputStreamAdapter.castFromPointer(_ret, + retain: false, release: true); + } + /// setDone void setDone() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_setDone); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_setDone); } /// setError: void setError_(NSError error) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setError_, error.ref.pointer); + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setError_, error.ref.pointer); } /// stream:handleEvent: void stream_handleEvent_(NSStream aStream, NSStreamEvent eventCode) { - if (!objc.respondsToSelector(ref.pointer, _sel_stream_handleEvent_)) { + if (!objc.respondsToSelector(this.ref.pointer, _sel_stream_handleEvent_)) { throw objc.UnimplementedOptionalMethodException( - 'DartInputStreamAdapter', 'stream:handleEvent:'); + 'DOBJCDartInputStreamAdapter', 'stream:handleEvent:'); } - _objc_msgSend_7zmbk4(this.ref.pointer, _sel_stream_handleEvent_, + _objc_msgSend_hglvhy(this.ref.pointer, _sel_stream_handleEvent_, aStream.ref.pointer, eventCode.value); } } -/// DartProxy +/// DOBJCDartProxy class DartProxy extends NSProxy { DartProxy._(ffi.Pointer pointer, {bool retain = false, bool release = false}) @@ -222,31 +210,38 @@ class DartProxy extends NSProxy { /// Returns whether [obj] is an instance of [DartProxy]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_DartProxy); + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_DOBJCDartProxy); } /// alloc static objc.ObjCObjectBase alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_DartProxy, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_DOBJCDartProxy, _sel_alloc); return objc.ObjCObjectBase(_ret, retain: false, release: true); } + /// newFromBuilder: + static DartProxy newFromBuilder_(DartProxyBuilder builder) { + final _ret = _objc_msgSend_62nh5j( + _class_DOBJCDartProxy, _sel_newFromBuilder_, builder.ref.pointer); + return DartProxy.castFromPointer(_ret, retain: false, release: true); + } + /// autorelease DartProxy autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return DartProxy.castFromPointer(_ret, retain: true, release: true); } /// forwardInvocation: void forwardInvocation_(NSInvocation invocation) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_forwardInvocation_, invocation.ref.pointer); } /// initFromBuilder: DartProxy initFromBuilder_(DartProxyBuilder builder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initFromBuilder_, builder.ref.pointer); return DartProxy.castFromPointer(_ret, retain: false, release: true); } @@ -254,38 +249,31 @@ class DartProxy extends NSProxy { /// methodSignatureForSelector: NSMethodSignature methodSignatureForSelector_( ffi.Pointer sel) { - final _ret = _objc_msgSend_12790oz( + final _ret = _objc_msgSend_19hbqky( this.ref.pointer, _sel_methodSignatureForSelector_, sel); return NSMethodSignature.castFromPointer(_ret, retain: true, release: true); } - /// newFromBuilder: - static DartProxy newFromBuilder_(DartProxyBuilder builder) { - final _ret = _objc_msgSend_juohf7( - _class_DartProxy, _sel_newFromBuilder_, builder.ref.pointer); - return DartProxy.castFromPointer(_ret, retain: false, release: true); - } - /// respondsToSelector: bool respondsToSelector_(ffi.Pointer sel) { - return _objc_msgSend_8d7dvc( + return _objc_msgSend_1srf6wk( this.ref.pointer, _sel_respondsToSelector_, sel); } /// retain DartProxy retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return DartProxy.castFromPointer(_ret, retain: true, release: true); } /// self DartProxy self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return DartProxy.castFromPointer(_ret, retain: true, release: true); } } -/// DartProxyBuilder +/// DOBJCDartProxyBuilder class DartProxyBuilder extends NSObject { DartProxyBuilder._(ffi.Pointer pointer, {bool retain = false, bool release = false}) @@ -302,32 +290,33 @@ class DartProxyBuilder extends NSObject { /// Returns whether [obj] is an instance of [DartProxyBuilder]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_DartProxyBuilder); + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_DOBJCDartProxyBuilder); } /// alloc static DartProxyBuilder alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_DartProxyBuilder, _sel_alloc); + final _ret = + _objc_msgSend_1x359cv(_class_DOBJCDartProxyBuilder, _sel_alloc); return DartProxyBuilder.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static DartProxyBuilder allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_DartProxyBuilder, _sel_allocWithZone_, zone); + final _ret = _objc_msgSend_hzlb60( + _class_DOBJCDartProxyBuilder, _sel_allocWithZone_, zone); return DartProxyBuilder.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_DartProxyBuilder, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static DartProxyBuilder new1() { + final _ret = _objc_msgSend_1x359cv(_class_DOBJCDartProxyBuilder, _sel_new); + return DartProxyBuilder.castFromPointer(_ret, retain: false, release: true); } /// autorelease DartProxyBuilder autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return DartProxyBuilder.castFromPointer(_ret, retain: true, release: true); } @@ -336,7 +325,7 @@ class DartProxyBuilder extends NSObject { ffi.Pointer sel, NSMethodSignature signature, ffi.Pointer block) { - _objc_msgSend_1ev9yls( + _objc_msgSend_kq0sbq( this.ref.pointer, _sel_implementMethod_withSignature_andBlock_, sel, @@ -347,32 +336,19 @@ class DartProxyBuilder extends NSObject { /// init DartProxyBuilder init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return DartProxyBuilder.castFromPointer(_ret, retain: false, release: true); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_DartProxyBuilder, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static DartProxyBuilder new1() { - final _ret = _objc_msgSend_1unuoxw(_class_DartProxyBuilder, _sel_new); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return DartProxyBuilder.castFromPointer(_ret, retain: false, release: true); } /// retain DartProxyBuilder retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return DartProxyBuilder.castFromPointer(_ret, retain: true, release: true); } /// self DartProxyBuilder self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return DartProxyBuilder.castFromPointer(_ret, retain: true, release: true); } } @@ -394,129 +370,46 @@ class NSArray extends NSObject { /// Returns whether [obj] is an instance of [NSArray]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSArray); } - /// addObserver:forKeyPath:options:context: - void addObserver_forKeyPath_options_context_( - NSObject observer, - NSString keyPath, - NSKeyValueObservingOptions options, - ffi.Pointer context) { - _objc_msgSend_l8a843( - this.ref.pointer, - _sel_addObserver_forKeyPath_options_context_, - observer.ref.pointer, - keyPath.ref.pointer, - options.value, - context); - } - - /// addObserver:toObjectsAtIndexes:forKeyPath:options:context: - void addObserver_toObjectsAtIndexes_forKeyPath_options_context_( - NSObject observer, - NSIndexSet indexes, - NSString keyPath, - NSKeyValueObservingOptions options, - ffi.Pointer context) { - _objc_msgSend_91w5mk( - this.ref.pointer, - _sel_addObserver_toObjectsAtIndexes_forKeyPath_options_context_, - observer.ref.pointer, - indexes.ref.pointer, - keyPath.ref.pointer, - options.value, - context); - } - /// alloc static NSArray alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSArray, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSArray, _sel_alloc); return NSArray.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSArray allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSArray, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSArray, _sel_allocWithZone_, zone); return NSArray.castFromPointer(_ret, retain: false, release: true); } /// array static NSArray array() { - final _ret = _objc_msgSend_1unuoxw(_class_NSArray, _sel_array); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// arrayByAddingObject: - NSArray arrayByAddingObject_(objc.ObjCObjectBase anObject) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_arrayByAddingObject_, anObject.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// arrayByAddingObjectsFromArray: - NSArray arrayByAddingObjectsFromArray_(NSArray otherArray) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_arrayByAddingObjectsFromArray_, otherArray.ref.pointer); + final _ret = _objc_msgSend_1x359cv(_class_NSArray, _sel_array); return NSArray.castFromPointer(_ret, retain: true, release: true); } - /// arrayByApplyingDifference: - NSArray? arrayByApplyingDifference_(objc.ObjCObjectBase difference) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_arrayByApplyingDifference_, difference.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// arrayWithArray: static NSArray arrayWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSArray, _sel_arrayWithArray_, array.ref.pointer); return NSArray.castFromPointer(_ret, retain: true, release: true); } - /// arrayWithContentsOfFile: - static NSArray? arrayWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7( - _class_NSArray, _sel_arrayWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// arrayWithContentsOfURL: - static NSArray? arrayWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( - _class_NSArray, _sel_arrayWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// arrayWithContentsOfURL:error: - static NSArray? arrayWithContentsOfURL_error_( - NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSArray, - _sel_arrayWithContentsOfURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// arrayWithObject: static NSArray arrayWithObject_(objc.ObjCObjectBase anObject) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSArray, _sel_arrayWithObject_, anObject.ref.pointer); return NSArray.castFromPointer(_ret, retain: true, release: true); } /// arrayWithObjects: static NSArray arrayWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSArray, _sel_arrayWithObjects_, firstObj.ref.pointer); return NSArray.castFromPointer(_ret, retain: true, release: true); } @@ -524,33 +417,25 @@ class NSArray extends NSObject { /// arrayWithObjects:count: static NSArray arrayWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es( + final _ret = _objc_msgSend_1lqqdvl( _class_NSArray, _sel_arrayWithObjects_count_, objects, cnt); return NSArray.castFromPointer(_ret, retain: true, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSArray, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// componentsJoinedByString: - NSString componentsJoinedByString_(NSString separator) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_componentsJoinedByString_, separator.ref.pointer); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// new + static NSArray new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSArray, _sel_new); + return NSArray.castFromPointer(_ret, retain: false, release: true); } - /// containsObject: - bool containsObject_(objc.ObjCObjectBase anObject) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_containsObject_, anObject.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSArray, _sel_supportsSecureCoding); } /// count int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_count); } /// countByEnumeratingWithState:objects:count: @@ -558,168 +443,49 @@ class NSArray extends NSObject { ffi.Pointer state, ffi.Pointer> buffer, int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, + return _objc_msgSend_1b5ysjl(this.ref.pointer, _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); } - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionWithLocale: - NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionWithLocale:indent: - NSString descriptionWithLocale_indent_( - objc.ObjCObjectBase? locale, int level) { - final _ret = _objc_msgSend_183c8xv( - this.ref.pointer, - _sel_descriptionWithLocale_indent_, - locale?.ref.pointer ?? ffi.nullptr, - level); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// differenceFromArray: - objc.ObjCObjectBase differenceFromArray_(NSArray other) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_differenceFromArray_, other.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// differenceFromArray:withOptions: - objc.ObjCObjectBase differenceFromArray_withOptions_( - NSArray other, NSOrderedCollectionDifferenceCalculationOptions options) { - final _ret = _objc_msgSend_17fkh4i( - this.ref.pointer, - _sel_differenceFromArray_withOptions_, - other.ref.pointer, - options.value); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } - /// firstObject - objc.ObjCObjectBase? get firstObject { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_firstObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// firstObjectCommonWithArray: - objc.ObjCObjectBase? firstObjectCommonWithArray_(NSArray otherArray) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_firstObjectCommonWithArray_, otherArray.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// getObjects:range: - void getObjects_range_( - ffi.Pointer> objects, NSRange range) { - _objc_msgSend_1j6yja6( - this.ref.pointer, _sel_getObjects_range_, objects, range); - } - - /// indexOfObject: - int indexOfObject_(objc.ObjCObjectBase anObject) { - return _objc_msgSend_eymsul( - this.ref.pointer, _sel_indexOfObject_, anObject.ref.pointer); - } - - /// indexOfObject:inRange: - int indexOfObject_inRange_(objc.ObjCObjectBase anObject, NSRange range) { - return _objc_msgSend_xwn22y(this.ref.pointer, _sel_indexOfObject_inRange_, - anObject.ref.pointer, range); - } - - /// indexOfObjectIdenticalTo: - int indexOfObjectIdenticalTo_(objc.ObjCObjectBase anObject) { - return _objc_msgSend_eymsul( - this.ref.pointer, _sel_indexOfObjectIdenticalTo_, anObject.ref.pointer); - } - - /// indexOfObjectIdenticalTo:inRange: - int indexOfObjectIdenticalTo_inRange_( - objc.ObjCObjectBase anObject, NSRange range) { - return _objc_msgSend_xwn22y(this.ref.pointer, - _sel_indexOfObjectIdenticalTo_inRange_, anObject.ref.pointer, range); - } - /// init NSArray init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSArray.castFromPointer(_ret, retain: false, release: true); } /// initWithArray: NSArray initWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithArray_, array.ref.pointer); return NSArray.castFromPointer(_ret, retain: false, release: true); } /// initWithArray:copyItems: NSArray initWithArray_copyItems_(NSArray array, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithArray_copyItems_, array.ref.pointer, flag); return NSArray.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSArray? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null : NSArray.castFromPointer(_ret, retain: false, release: true); } - /// initWithContentsOfFile: - NSArray? initWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL: - NSArray? initWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL:error: - NSArray? initWithContentsOfURL_error_( - NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: false, release: true); - } - /// initWithObjects: NSArray initWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjects_, firstObj.ref.pointer); return NSArray.castFromPointer(_ret, retain: false, release: true); } @@ -727,229 +493,41 @@ class NSArray extends NSObject { /// initWithObjects:count: NSArray initWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1lqqdvl(this.ref.retainAndReturnPointer(), _sel_initWithObjects_count_, objects, cnt); return NSArray.castFromPointer(_ret, retain: false, release: true); } - /// isEqualToArray: - bool isEqualToArray_(NSArray otherArray) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToArray_, otherArray.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSArray, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// lastObject - objc.ObjCObjectBase? get lastObject { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_lastObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// makeObjectsPerformSelector: - void makeObjectsPerformSelector_(ffi.Pointer aSelector) { - _objc_msgSend_5ns8s6( - this.ref.pointer, _sel_makeObjectsPerformSelector_, aSelector); - } - - /// makeObjectsPerformSelector:withObject: - void makeObjectsPerformSelector_withObject_( - ffi.Pointer aSelector, objc.ObjCObjectBase? argument) { - _objc_msgSend_1x7hfdx( - this.ref.pointer, - _sel_makeObjectsPerformSelector_withObject_, - aSelector, - argument?.ref.pointer ?? ffi.nullptr); - } - - /// new - static NSArray new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSArray, _sel_new); - return NSArray.castFromPointer(_ret, retain: false, release: true); - } - /// objectAtIndex: objc.ObjCObjectBase objectAtIndex_(int index) { final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_objectAtIndex_, index); + _objc_msgSend_1qrcblu(this.ref.pointer, _sel_objectAtIndex_, index); return objc.ObjCObjectBase(_ret, retain: true, release: true); } +} - /// objectAtIndexedSubscript: - objc.ObjCObjectBase objectAtIndexedSubscript_(int idx) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_objectAtIndexedSubscript_, idx); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } +enum NSBinarySearchingOptions { + NSBinarySearchingFirstEqual(256), + NSBinarySearchingLastEqual(512), + NSBinarySearchingInsertionIndex(1024); - /// objectEnumerator - NSEnumerator objectEnumerator() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectEnumerator); - return NSEnumerator.castFromPointer(_ret, retain: true, release: true); - } + final int value; + const NSBinarySearchingOptions(this.value); - /// objectsAtIndexes: - NSArray objectsAtIndexes_(NSIndexSet indexes) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_objectsAtIndexes_, indexes.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } + static NSBinarySearchingOptions fromValue(int value) => switch (value) { + 256 => NSBinarySearchingFirstEqual, + 512 => NSBinarySearchingLastEqual, + 1024 => NSBinarySearchingInsertionIndex, + _ => throw ArgumentError( + "Unknown value for NSBinarySearchingOptions: $value"), + }; +} - /// removeObserver:forKeyPath: - void removeObserver_forKeyPath_(NSObject observer, NSString keyPath) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeObserver_forKeyPath_, - observer.ref.pointer, keyPath.ref.pointer); - } - - /// removeObserver:forKeyPath:context: - void removeObserver_forKeyPath_context_( - NSObject observer, NSString keyPath, ffi.Pointer context) { - _objc_msgSend_sk5ilc( - this.ref.pointer, - _sel_removeObserver_forKeyPath_context_, - observer.ref.pointer, - keyPath.ref.pointer, - context); - } - - /// removeObserver:fromObjectsAtIndexes:forKeyPath: - void removeObserver_fromObjectsAtIndexes_forKeyPath_( - NSObject observer, NSIndexSet indexes, NSString keyPath) { - _objc_msgSend_tenbla( - this.ref.pointer, - _sel_removeObserver_fromObjectsAtIndexes_forKeyPath_, - observer.ref.pointer, - indexes.ref.pointer, - keyPath.ref.pointer); - } - - /// removeObserver:fromObjectsAtIndexes:forKeyPath:context: - void removeObserver_fromObjectsAtIndexes_forKeyPath_context_( - NSObject observer, - NSIndexSet indexes, - NSString keyPath, - ffi.Pointer context) { - _objc_msgSend_laogel( - this.ref.pointer, - _sel_removeObserver_fromObjectsAtIndexes_forKeyPath_context_, - observer.ref.pointer, - indexes.ref.pointer, - keyPath.ref.pointer, - context); - } - - /// reverseObjectEnumerator - NSEnumerator reverseObjectEnumerator() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reverseObjectEnumerator); - return NSEnumerator.castFromPointer(_ret, retain: true, release: true); - } - - /// sortedArrayHint - NSData get sortedArrayHint { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_sortedArrayHint); - return NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// sortedArrayUsingFunction:context: - NSArray sortedArrayUsingFunction_context_( - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>> - comparator, - ffi.Pointer context) { - final _ret = _objc_msgSend_16nmq1c(this.ref.pointer, - _sel_sortedArrayUsingFunction_context_, comparator, context); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// sortedArrayUsingFunction:context:hint: - NSArray sortedArrayUsingFunction_context_hint_( - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>> - comparator, - ffi.Pointer context, - NSData? hint) { - final _ret = _objc_msgSend_2x4dib( - this.ref.pointer, - _sel_sortedArrayUsingFunction_context_hint_, - comparator, - context, - hint?.ref.pointer ?? ffi.nullptr); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// sortedArrayUsingSelector: - NSArray sortedArrayUsingSelector_(ffi.Pointer comparator) { - final _ret = _objc_msgSend_12790oz( - this.ref.pointer, _sel_sortedArrayUsingSelector_, comparator); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// subarrayWithRange: - NSArray subarrayWithRange_(NSRange range) { - final _ret = - _objc_msgSend_176f8tz(this.ref.pointer, _sel_subarrayWithRange_, range); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSArray, _sel_supportsSecureCoding); - } - - /// writeToFile:atomically: - bool writeToFile_atomically_(NSString path, bool useAuxiliaryFile) { - return _objc_msgSend_17gxu27(this.ref.pointer, _sel_writeToFile_atomically_, - path.ref.pointer, useAuxiliaryFile); - } - - /// writeToURL:atomically: - bool writeToURL_atomically_(NSURL url, bool atomically) { - return _objc_msgSend_17gxu27(this.ref.pointer, _sel_writeToURL_atomically_, - url.ref.pointer, atomically); - } - - /// writeToURL:error: - bool writeToURL_error_( - NSURL url, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_writeToURL_error_, url.ref.pointer, error); - } -} - -enum NSBinarySearchingOptions { - NSBinarySearchingFirstEqual(256), - NSBinarySearchingLastEqual(512), - NSBinarySearchingInsertionIndex(1024); - - final int value; - const NSBinarySearchingOptions(this.value); - - static NSBinarySearchingOptions fromValue(int value) => switch (value) { - 256 => NSBinarySearchingFirstEqual, - 512 => NSBinarySearchingLastEqual, - 1024 => NSBinarySearchingInsertionIndex, - _ => throw ArgumentError( - "Unknown value for NSBinarySearchingOptions: $value"), - }; -} - -/// NSCharacterSet -class NSCharacterSet extends NSObject { - NSCharacterSet._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); +/// NSCharacterSet +class NSCharacterSet extends NSObject { + NSCharacterSet._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); /// Constructs a [NSCharacterSet] that points to the same underlying object as [other]. NSCharacterSet.castFrom(objc.ObjCObjectBase other) @@ -962,115 +540,54 @@ class NSCharacterSet extends NSObject { /// Returns whether [obj] is an instance of [NSCharacterSet]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSCharacterSet); } - /// URLFragmentAllowedCharacterSet - static NSCharacterSet getURLFragmentAllowedCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCharacterSet, _sel_URLFragmentAllowedCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - - /// URLHostAllowedCharacterSet - static NSCharacterSet getURLHostAllowedCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCharacterSet, _sel_URLHostAllowedCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - - /// URLPasswordAllowedCharacterSet - static NSCharacterSet getURLPasswordAllowedCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCharacterSet, _sel_URLPasswordAllowedCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - - /// URLPathAllowedCharacterSet - static NSCharacterSet getURLPathAllowedCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCharacterSet, _sel_URLPathAllowedCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - - /// URLQueryAllowedCharacterSet - static NSCharacterSet getURLQueryAllowedCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCharacterSet, _sel_URLQueryAllowedCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - - /// URLUserAllowedCharacterSet - static NSCharacterSet getURLUserAllowedCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSCharacterSet, _sel_URLUserAllowedCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - /// alloc static NSCharacterSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_alloc); return NSCharacterSet.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSCharacterSet allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSCharacterSet, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSCharacterSet, _sel_allocWithZone_, zone); return NSCharacterSet.castFromPointer(_ret, retain: false, release: true); } /// alphanumericCharacterSet static NSCharacterSet getAlphanumericCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_alphanumericCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSCharacterSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// bitmapRepresentation - NSData get bitmapRepresentation { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_bitmapRepresentation); - return NSData.castFromPointer(_ret, retain: true, release: true); - } - /// capitalizedLetterCharacterSet static NSCharacterSet getCapitalizedLetterCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_capitalizedLetterCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } - /// characterIsMember: - bool characterIsMember_(int aCharacter) { - return _objc_msgSend_nr96mn( - this.ref.pointer, _sel_characterIsMember_, aCharacter); - } - /// characterSetWithBitmapRepresentation: static NSCharacterSet characterSetWithBitmapRepresentation_(NSData data) { - final _ret = _objc_msgSend_juohf7(_class_NSCharacterSet, + final _ret = _objc_msgSend_62nh5j(_class_NSCharacterSet, _sel_characterSetWithBitmapRepresentation_, data.ref.pointer); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// characterSetWithCharactersInString: static NSCharacterSet characterSetWithCharactersInString_(NSString aString) { - final _ret = _objc_msgSend_juohf7(_class_NSCharacterSet, + final _ret = _objc_msgSend_62nh5j(_class_NSCharacterSet, _sel_characterSetWithCharactersInString_, aString.ref.pointer); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// characterSetWithContentsOfFile: static NSCharacterSet? characterSetWithContentsOfFile_(NSString fName) { - final _ret = _objc_msgSend_juohf7(_class_NSCharacterSet, + final _ret = _objc_msgSend_62nh5j(_class_NSCharacterSet, _sel_characterSetWithContentsOfFile_, fName.ref.pointer); return _ret.address == 0 ? null @@ -1079,7 +596,7 @@ class NSCharacterSet extends NSObject { /// characterSetWithRange: static NSCharacterSet characterSetWithRange_(NSRange aRange) { - final _ret = _objc_msgSend_176f8tz( + final _ret = _objc_msgSend_83z673( _class_NSCharacterSet, _sel_characterSetWithRange_, aRange); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } @@ -1087,158 +604,182 @@ class NSCharacterSet extends NSObject { /// controlCharacterSet static NSCharacterSet getControlCharacterSet() { final _ret = - _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_controlCharacterSet); + _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_controlCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// decimalDigitCharacterSet static NSCharacterSet getDecimalDigitCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_decimalDigitCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// decomposableCharacterSet static NSCharacterSet getDecomposableCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_decomposableCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } - /// encodeWithCoder: - void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// hasMemberInPlane: - bool hasMemberInPlane_(int thePlane) { - return _objc_msgSend_1crn9hn( - this.ref.pointer, _sel_hasMemberInPlane_, thePlane); - } - /// illegalCharacterSet static NSCharacterSet getIllegalCharacterSet() { final _ret = - _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_illegalCharacterSet); - return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); - } - - /// init - NSCharacterSet init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSCharacterSet.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCoder: - NSCharacterSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSCharacterSet.castFromPointer(_ret, retain: false, release: true); - } - - /// invertedSet - NSCharacterSet get invertedSet { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_invertedSet); + _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_illegalCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } - /// isSupersetOfSet: - bool isSupersetOfSet_(NSCharacterSet theOtherSet) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isSupersetOfSet_, theOtherSet.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSCharacterSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// letterCharacterSet static NSCharacterSet getLetterCharacterSet() { final _ret = - _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_letterCharacterSet); + _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_letterCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } - /// longCharacterIsMember: - bool longCharacterIsMember_(int theLongChar) { - return _objc_msgSend_1n8vqu1( - this.ref.pointer, _sel_longCharacterIsMember_, theLongChar); - } - /// lowercaseLetterCharacterSet static NSCharacterSet getLowercaseLetterCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_lowercaseLetterCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// new static NSCharacterSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_new); + final _ret = _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_new); return NSCharacterSet.castFromPointer(_ret, retain: false, release: true); } /// newlineCharacterSet static NSCharacterSet getNewlineCharacterSet() { final _ret = - _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_newlineCharacterSet); + _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_newlineCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// nonBaseCharacterSet static NSCharacterSet getNonBaseCharacterSet() { final _ret = - _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_nonBaseCharacterSet); + _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_nonBaseCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// punctuationCharacterSet static NSCharacterSet getPunctuationCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_punctuationCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( _class_NSCharacterSet, _sel_supportsSecureCoding); } /// symbolCharacterSet static NSCharacterSet getSymbolCharacterSet() { final _ret = - _objc_msgSend_1unuoxw(_class_NSCharacterSet, _sel_symbolCharacterSet); + _objc_msgSend_1x359cv(_class_NSCharacterSet, _sel_symbolCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// uppercaseLetterCharacterSet static NSCharacterSet getUppercaseLetterCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_uppercaseLetterCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// whitespaceAndNewlineCharacterSet static NSCharacterSet getWhitespaceAndNewlineCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_whitespaceAndNewlineCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } /// whitespaceCharacterSet static NSCharacterSet getWhitespaceCharacterSet() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( _class_NSCharacterSet, _sel_whitespaceCharacterSet); return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); } + + /// autorelease + NSCharacterSet autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); + } + + /// bitmapRepresentation + NSData get bitmapRepresentation { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_bitmapRepresentation); + return NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// characterIsMember: + bool characterIsMember_(int aCharacter) { + return _objc_msgSend_1co9mn4( + this.ref.pointer, _sel_characterIsMember_, aCharacter); + } + + /// encodeWithCoder: + void encodeWithCoder_(NSCoder coder) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); + } + + /// hasMemberInPlane: + bool hasMemberInPlane_(int thePlane) { + return _objc_msgSend_gerswc( + this.ref.pointer, _sel_hasMemberInPlane_, thePlane); + } + + /// init + NSCharacterSet init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSCharacterSet.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithCoder: + NSCharacterSet? initWithCoder_(NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : NSCharacterSet.castFromPointer(_ret, retain: false, release: true); + } + + /// invertedSet + NSCharacterSet get invertedSet { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_invertedSet); + return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); + } + + /// isSupersetOfSet: + bool isSupersetOfSet_(NSCharacterSet theOtherSet) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_isSupersetOfSet_, theOtherSet.ref.pointer); + } + + /// longCharacterIsMember: + bool longCharacterIsMember_(int theLongChar) { + return _objc_msgSend_jsclrq( + this.ref.pointer, _sel_longCharacterIsMember_, theLongChar); + } + + /// retain + NSCharacterSet retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); + } + + /// self + NSCharacterSet self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSCharacterSet.castFromPointer(_ret, retain: true, release: true); + } } /// NSCoder @@ -1258,7 +799,7 @@ class NSCoder extends objc.ObjCObjectBase { /// Returns whether [obj] is an instance of [NSCoder]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSCoder); } } @@ -1297,69 +838,31 @@ class NSData extends NSObject { /// Returns whether [obj] is an instance of [NSData]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSData); } /// alloc static NSData alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSData, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSData, _sel_alloc); return NSData.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSData allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSData, _sel_allocWithZone_, zone); + final _ret = _objc_msgSend_hzlb60(_class_NSData, _sel_allocWithZone_, zone); return NSData.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSData, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// base64EncodedDataWithOptions: - NSData base64EncodedDataWithOptions_(NSDataBase64EncodingOptions options) { - final _ret = _objc_msgSend_x1r7wm( - this.ref.pointer, _sel_base64EncodedDataWithOptions_, options.value); - return NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// base64EncodedStringWithOptions: - NSString base64EncodedStringWithOptions_( - NSDataBase64EncodingOptions options) { - final _ret = _objc_msgSend_x1r7wm( - this.ref.pointer, _sel_base64EncodedStringWithOptions_, options.value); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// bytes - ffi.Pointer get bytes { - return _objc_msgSend_1578rxt(this.ref.pointer, _sel_bytes); - } - - /// compressedDataUsingAlgorithm:error: - NSData? compressedDataUsingAlgorithm_error_( - NSDataCompressionAlgorithm algorithm, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1d0rqol(this.ref.pointer, - _sel_compressedDataUsingAlgorithm_error_, algorithm.value, error); - return _ret.address == 0 - ? null - : NSData.castFromPointer(_ret, retain: true, release: true); - } - /// data static NSData data() { - final _ret = _objc_msgSend_1unuoxw(_class_NSData, _sel_data); + final _ret = _objc_msgSend_1x359cv(_class_NSData, _sel_data); return NSData.castFromPointer(_ret, retain: true, release: true); } /// dataWithBytes:length: static NSData dataWithBytes_length_(ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz( + final _ret = _objc_msgSend_19qmeje( _class_NSData, _sel_dataWithBytes_length_, bytes, length); return NSData.castFromPointer(_ret, retain: true, release: true); } @@ -1367,7 +870,7 @@ class NSData extends NSObject { /// dataWithBytesNoCopy:length: static NSData dataWithBytesNoCopy_length_( ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz( + final _ret = _objc_msgSend_19qmeje( _class_NSData, _sel_dataWithBytesNoCopy_length_, bytes, length); return NSData.castFromPointer(_ret, retain: true, release: true); } @@ -1375,14 +878,14 @@ class NSData extends NSObject { /// dataWithBytesNoCopy:length:freeWhenDone: static NSData dataWithBytesNoCopy_length_freeWhenDone_( ffi.Pointer bytes, int length, bool b) { - final _ret = _objc_msgSend_1pk67jm(_class_NSData, + final _ret = _objc_msgSend_1je1k7e(_class_NSData, _sel_dataWithBytesNoCopy_length_freeWhenDone_, bytes, length, b); return NSData.castFromPointer(_ret, retain: true, release: true); } /// dataWithContentsOfFile: static NSData? dataWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSData, _sel_dataWithContentsOfFile_, path.ref.pointer); return _ret.address == 0 ? null @@ -1394,7 +897,7 @@ class NSData extends NSObject { NSString path, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( _class_NSData, _sel_dataWithContentsOfFile_options_error_, path.ref.pointer, @@ -1407,7 +910,7 @@ class NSData extends NSObject { /// dataWithContentsOfURL: static NSData? dataWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSData, _sel_dataWithContentsOfURL_, url.ref.pointer); return _ret.address == 0 ? null @@ -1419,7 +922,7 @@ class NSData extends NSObject { NSURL url, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( _class_NSData, _sel_dataWithContentsOfURL_options_error_, url.ref.pointer, @@ -1432,57 +935,66 @@ class NSData extends NSObject { /// dataWithData: static NSData dataWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSData, _sel_dataWithData_, data.ref.pointer); return NSData.castFromPointer(_ret, retain: true, release: true); } + /// new + static NSData new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSData, _sel_new); + return NSData.castFromPointer(_ret, retain: false, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSData, _sel_supportsSecureCoding); + } + + /// bytes + ffi.Pointer get bytes { + return _objc_msgSend_6ex6p5(this.ref.pointer, _sel_bytes); + } + + /// compressedDataUsingAlgorithm:error: + NSData? compressedDataUsingAlgorithm_error_( + NSDataCompressionAlgorithm algorithm, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1okds6o(this.ref.pointer, + _sel_compressedDataUsingAlgorithm_error_, algorithm.value, error); + return _ret.address == 0 + ? null + : NSData.castFromPointer(_ret, retain: true, release: true); + } + /// decompressedDataUsingAlgorithm:error: NSData? decompressedDataUsingAlgorithm_error_( NSDataCompressionAlgorithm algorithm, ffi.Pointer> error) { - final _ret = _objc_msgSend_1d0rqol(this.ref.pointer, + final _ret = _objc_msgSend_1okds6o(this.ref.pointer, _sel_decompressedDataUsingAlgorithm_error_, algorithm.value, error); return _ret.address == 0 ? null : NSData.castFromPointer(_ret, retain: true, release: true); } - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } - /// getBytes:length: - void getBytes_length_(ffi.Pointer buffer, int length) { - _objc_msgSend_vzqe8w( - this.ref.pointer, _sel_getBytes_length_, buffer, length); - } - - /// getBytes:range: - void getBytes_range_(ffi.Pointer buffer, NSRange range) { - _objc_msgSend_1ov25i7( - this.ref.pointer, _sel_getBytes_range_, buffer, range); - } - /// init NSData init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSData.castFromPointer(_ret, retain: false, release: true); } /// initWithBase64EncodedData:options: NSData? initWithBase64EncodedData_options_( NSData base64Data, NSDataBase64DecodingOptions options) { - final _ret = _objc_msgSend_1dostih( + final _ret = _objc_msgSend_dnlotu( this.ref.retainAndReturnPointer(), _sel_initWithBase64EncodedData_options_, base64Data.ref.pointer, @@ -1495,7 +1007,7 @@ class NSData extends NSObject { /// initWithBase64EncodedString:options: NSData? initWithBase64EncodedString_options_( NSString base64String, NSDataBase64DecodingOptions options) { - final _ret = _objc_msgSend_1dostih( + final _ret = _objc_msgSend_dnlotu( this.ref.retainAndReturnPointer(), _sel_initWithBase64EncodedString_options_, base64String.ref.pointer, @@ -1507,14 +1019,14 @@ class NSData extends NSObject { /// initWithBytes:length: NSData initWithBytes_length_(ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_19qmeje(this.ref.retainAndReturnPointer(), _sel_initWithBytes_length_, bytes, length); return NSData.castFromPointer(_ret, retain: false, release: true); } /// initWithBytesNoCopy:length: NSData initWithBytesNoCopy_length_(ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_19qmeje(this.ref.retainAndReturnPointer(), _sel_initWithBytesNoCopy_length_, bytes, length); return NSData.castFromPointer(_ret, retain: false, release: true); } @@ -1522,14 +1034,14 @@ class NSData extends NSObject { /// initWithBytesNoCopy:length:freeWhenDone: NSData initWithBytesNoCopy_length_freeWhenDone_( ffi.Pointer bytes, int length, bool b) { - final _ret = _objc_msgSend_1pk67jm(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1je1k7e(this.ref.retainAndReturnPointer(), _sel_initWithBytesNoCopy_length_freeWhenDone_, bytes, length, b); return NSData.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSData? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -1538,7 +1050,7 @@ class NSData extends NSObject { /// initWithContentsOfFile: NSData? initWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_, path.ref.pointer); return _ret.address == 0 ? null @@ -1550,7 +1062,7 @@ class NSData extends NSObject { NSString path, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_options_error_, path.ref.pointer, @@ -1563,7 +1075,7 @@ class NSData extends NSObject { /// initWithContentsOfURL: NSData? initWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_, url.ref.pointer); return _ret.address == 0 ? null @@ -1575,7 +1087,7 @@ class NSData extends NSObject { NSURL url, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_options_error_, url.ref.pointer, @@ -1588,109 +1100,16 @@ class NSData extends NSObject { /// initWithData: NSData initWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithData_, data.ref.pointer); return NSData.castFromPointer(_ret, retain: false, release: true); } - /// isEqualToData: - bool isEqualToData_(NSData other) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToData_, other.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSData, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// length int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_length); } - - /// new - static NSData new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSData, _sel_new); - return NSData.castFromPointer(_ret, retain: false, release: true); - } - - /// rangeOfData:options:range: - NSRange rangeOfData_options_range_( - NSData dataToFind, NSDataSearchOptions mask, NSRange searchRange) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1wjxqnxStret( - _ptr, - this.ref.pointer, - _sel_rangeOfData_options_range_, - dataToFind.ref.pointer, - mask.value, - searchRange) - : _ptr.ref = _objc_msgSend_1wjxqnx( - this.ref.pointer, - _sel_rangeOfData_options_range_, - dataToFind.ref.pointer, - mask.value, - searchRange); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// subdataWithRange: - NSData subdataWithRange_(NSRange range) { - final _ret = - _objc_msgSend_176f8tz(this.ref.pointer, _sel_subdataWithRange_, range); - return NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSData, _sel_supportsSecureCoding); - } - - /// writeToFile:atomically: - bool writeToFile_atomically_(NSString path, bool useAuxiliaryFile) { - return _objc_msgSend_17gxu27(this.ref.pointer, _sel_writeToFile_atomically_, - path.ref.pointer, useAuxiliaryFile); - } - - /// writeToFile:options:error: - bool writeToFile_options_error_( - NSString path, - NSDataWritingOptions writeOptionsMask, - ffi.Pointer> errorPtr) { - return _objc_msgSend_svexbq( - this.ref.pointer, - _sel_writeToFile_options_error_, - path.ref.pointer, - writeOptionsMask.value, - errorPtr); - } - - /// writeToURL:atomically: - bool writeToURL_atomically_(NSURL url, bool atomically) { - return _objc_msgSend_17gxu27(this.ref.pointer, _sel_writeToURL_atomically_, - url.ref.pointer, atomically); - } - - /// writeToURL:options:error: - bool writeToURL_options_error_( - NSURL url, - NSDataWritingOptions writeOptionsMask, - ffi.Pointer> errorPtr) { - return _objc_msgSend_svexbq( - this.ref.pointer, - _sel_writeToURL_options_error_, - url.ref.pointer, - writeOptionsMask.value, - errorPtr); - } -} +} enum NSDataBase64DecodingOptions { NSDataBase64DecodingIgnoreUnknownCharacters(1); @@ -1743,6 +1162,9 @@ enum NSDataCompressionAlgorithm { }; } +/// NSDataCreation +extension NSDataCreation on NSData {} + enum NSDataReadingOptions { NSDataReadingMappedIfSafe(1), NSDataReadingUncached(2), @@ -1842,132 +1264,97 @@ class NSDate extends NSObject { /// Returns whether [obj] is an instance of [NSDate]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSDate); } /// alloc static NSDate alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDate, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_alloc); return NSDate.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSDate allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSDate, _sel_allocWithZone_, zone); + final _ret = _objc_msgSend_hzlb60(_class_NSDate, _sel_allocWithZone_, zone); return NSDate.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSDate, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// autorelease - NSDate autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// compare: - NSComparisonResult compare_(NSDate other) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_compare_, other.ref.pointer); - return NSComparisonResult.fromValue(_ret); - } - /// date static NSDate date() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDate, _sel_date); - return NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// dateByAddingTimeInterval: - NSDate dateByAddingTimeInterval_(double ti) { - final _ret = _objc_msgSend_m7jc8y( - this.ref.pointer, _sel_dateByAddingTimeInterval_, ti); + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_date); return NSDate.castFromPointer(_ret, retain: true, release: true); } /// dateWithTimeInterval:sinceDate: static NSDate dateWithTimeInterval_sinceDate_( double secsToBeAdded, NSDate date) { - final _ret = _objc_msgSend_m6z6pt(_class_NSDate, + final _ret = _objc_msgSend_xh7c7e(_class_NSDate, _sel_dateWithTimeInterval_sinceDate_, secsToBeAdded, date.ref.pointer); return NSDate.castFromPointer(_ret, retain: true, release: true); } /// dateWithTimeIntervalSince1970: static NSDate dateWithTimeIntervalSince1970_(double secs) { - final _ret = _objc_msgSend_m7jc8y( + final _ret = _objc_msgSend_1x911p2( _class_NSDate, _sel_dateWithTimeIntervalSince1970_, secs); return NSDate.castFromPointer(_ret, retain: true, release: true); } /// dateWithTimeIntervalSinceNow: static NSDate dateWithTimeIntervalSinceNow_(double secs) { - final _ret = _objc_msgSend_m7jc8y( + final _ret = _objc_msgSend_1x911p2( _class_NSDate, _sel_dateWithTimeIntervalSinceNow_, secs); return NSDate.castFromPointer(_ret, retain: true, release: true); } /// dateWithTimeIntervalSinceReferenceDate: static NSDate dateWithTimeIntervalSinceReferenceDate_(double ti) { - final _ret = _objc_msgSend_m7jc8y( + final _ret = _objc_msgSend_1x911p2( _class_NSDate, _sel_dateWithTimeIntervalSinceReferenceDate_, ti); return NSDate.castFromPointer(_ret, retain: true, release: true); } - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionWithLocale: - NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// new + static NSDate new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_new); + return NSDate.castFromPointer(_ret, retain: false, release: true); } - /// distantFuture - static NSDate getDistantFuture() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDate, _sel_distantFuture); - return NSDate.castFromPointer(_ret, retain: true, release: true); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSDate, _sel_supportsSecureCoding); } - /// distantPast - static NSDate getDistantPast() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDate, _sel_distantPast); + /// autorelease + NSDate autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return NSDate.castFromPointer(_ret, retain: true, release: true); } - /// earlierDate: - NSDate earlierDate_(NSDate anotherDate) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_earlierDate_, anotherDate.ref.pointer); + /// dateByAddingTimeInterval: + NSDate dateByAddingTimeInterval_(double ti) { + final _ret = _objc_msgSend_1x911p2( + this.ref.pointer, _sel_dateByAddingTimeInterval_, ti); return NSDate.castFromPointer(_ret, retain: true, release: true); } /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } /// init NSDate init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSDate.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSDate? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -1976,113 +1363,51 @@ class NSDate extends NSObject { /// initWithTimeInterval:sinceDate: NSDate initWithTimeInterval_sinceDate_(double secsToBeAdded, NSDate date) { - final _ret = _objc_msgSend_m6z6pt(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_xh7c7e(this.ref.retainAndReturnPointer(), _sel_initWithTimeInterval_sinceDate_, secsToBeAdded, date.ref.pointer); return NSDate.castFromPointer(_ret, retain: false, release: true); } /// initWithTimeIntervalSince1970: NSDate initWithTimeIntervalSince1970_(double secs) { - final _ret = _objc_msgSend_m7jc8y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1x911p2(this.ref.retainAndReturnPointer(), _sel_initWithTimeIntervalSince1970_, secs); return NSDate.castFromPointer(_ret, retain: false, release: true); } /// initWithTimeIntervalSinceNow: NSDate initWithTimeIntervalSinceNow_(double secs) { - final _ret = _objc_msgSend_m7jc8y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1x911p2(this.ref.retainAndReturnPointer(), _sel_initWithTimeIntervalSinceNow_, secs); return NSDate.castFromPointer(_ret, retain: false, release: true); } /// initWithTimeIntervalSinceReferenceDate: NSDate initWithTimeIntervalSinceReferenceDate_(double ti) { - final _ret = _objc_msgSend_m7jc8y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1x911p2(this.ref.retainAndReturnPointer(), _sel_initWithTimeIntervalSinceReferenceDate_, ti); return NSDate.castFromPointer(_ret, retain: false, release: true); } - /// isEqualToDate: - bool isEqualToDate_(NSDate otherDate) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToDate_, otherDate.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDate, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// laterDate: - NSDate laterDate_(NSDate anotherDate) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_laterDate_, anotherDate.ref.pointer); - return NSDate.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSDate new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDate, _sel_new); - return NSDate.castFromPointer(_ret, retain: false, release: true); - } - - /// now - static NSDate getNow() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDate, _sel_now); - return NSDate.castFromPointer(_ret, retain: true, release: true); - } - /// retain NSDate retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSDate.castFromPointer(_ret, retain: true, release: true); } /// self NSDate self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSDate.castFromPointer(_ret, retain: true, release: true); } - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSDate, _sel_supportsSecureCoding); - } - - /// timeIntervalSince1970 - double get timeIntervalSince1970 { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_timeIntervalSince1970) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeIntervalSince1970); - } - - /// timeIntervalSinceDate: - double timeIntervalSinceDate_(NSDate anotherDate) { - return objc.useMsgSendVariants - ? _objc_msgSend_om71r5Fpret(this.ref.pointer, - _sel_timeIntervalSinceDate_, anotherDate.ref.pointer) - : _objc_msgSend_om71r5(this.ref.pointer, _sel_timeIntervalSinceDate_, - anotherDate.ref.pointer); - } - - /// timeIntervalSinceNow - double get timeIntervalSinceNow { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - this.ref.pointer, _sel_timeIntervalSinceNow) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_timeIntervalSinceNow); - } - /// timeIntervalSinceReferenceDate - static double getTimeIntervalSinceReferenceDate() { + double get timeIntervalSinceReferenceDate { return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret( - _class_NSDate, _sel_timeIntervalSinceReferenceDate) - : _objc_msgSend_10noklm( - _class_NSDate, _sel_timeIntervalSinceReferenceDate); + ? _objc_msgSend_1ukqyt8Fpret( + this.ref.pointer, _sel_timeIntervalSinceReferenceDate) + : _objc_msgSend_1ukqyt8( + this.ref.pointer, _sel_timeIntervalSinceReferenceDate); } } @@ -2103,130 +1428,32 @@ class NSDictionary extends NSObject { /// Returns whether [obj] is an instance of [NSDictionary]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSDictionary); } - /// allKeys - NSArray get allKeys { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allKeys); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allKeysForObject: - NSArray allKeysForObject_(objc.ObjCObjectBase anObject) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_allKeysForObject_, anObject.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// allValues - NSArray get allValues { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allValues); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// alloc static NSDictionary alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDictionary, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSDictionary, _sel_alloc); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSDictionary allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSDictionary, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSDictionary, _sel_allocWithZone_, zone); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSDictionary, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// count - int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); - } - - /// countByEnumeratingWithState:objects:count: - int countByEnumeratingWithState_objects_count_( - ffi.Pointer state, - ffi.Pointer> buffer, - int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, - _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); - } - - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionInStringsFileFormat - NSString get descriptionInStringsFileFormat { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_descriptionInStringsFileFormat); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionWithLocale: - NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionWithLocale:indent: - NSString descriptionWithLocale_indent_( - objc.ObjCObjectBase? locale, int level) { - final _ret = _objc_msgSend_183c8xv( - this.ref.pointer, - _sel_descriptionWithLocale_indent_, - locale?.ref.pointer ?? ffi.nullptr, - level); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - /// dictionary static NSDictionary dictionary() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDictionary, _sel_dictionary); + final _ret = _objc_msgSend_1x359cv(_class_NSDictionary, _sel_dictionary); return NSDictionary.castFromPointer(_ret, retain: true, release: true); } - /// dictionaryWithContentsOfFile: - static NSDictionary? dictionaryWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSDictionary, - _sel_dictionaryWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// dictionaryWithContentsOfURL: - static NSDictionary? dictionaryWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(_class_NSDictionary, - _sel_dictionaryWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// dictionaryWithContentsOfURL:error: - static NSDictionary? dictionaryWithContentsOfURL_error_( - NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSDictionary, - _sel_dictionaryWithContentsOfURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - /// dictionaryWithDictionary: static NSDictionary dictionaryWithDictionary_(NSDictionary dict) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSDictionary, _sel_dictionaryWithDictionary_, dict.ref.pointer); return NSDictionary.castFromPointer(_ret, retain: true, release: true); } @@ -2234,7 +1461,7 @@ class NSDictionary extends NSObject { /// dictionaryWithObject:forKey: static NSDictionary dictionaryWithObject_forKey_( objc.ObjCObjectBase object, objc.ObjCObjectBase key) { - final _ret = _objc_msgSend_iq11qg(_class_NSDictionary, + final _ret = _objc_msgSend_rsfdlh(_class_NSDictionary, _sel_dictionaryWithObject_forKey_, object.ref.pointer, key.ref.pointer); return NSDictionary.castFromPointer(_ret, retain: true, release: true); } @@ -2242,7 +1469,7 @@ class NSDictionary extends NSObject { /// dictionaryWithObjects:forKeys: static NSDictionary dictionaryWithObjects_forKeys_( NSArray objects, NSArray keys) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( _class_NSDictionary, _sel_dictionaryWithObjects_forKeys_, objects.ref.pointer, @@ -2255,7 +1482,7 @@ class NSDictionary extends NSObject { ffi.Pointer> objects, ffi.Pointer> keys, int cnt) { - final _ret = _objc_msgSend_9ijr00(_class_NSDictionary, + final _ret = _objc_msgSend_cfqbni(_class_NSDictionary, _sel_dictionaryWithObjects_forKeys_count_, objects, keys, cnt); return NSDictionary.castFromPointer(_ret, retain: true, release: true); } @@ -2263,73 +1490,61 @@ class NSDictionary extends NSObject { /// dictionaryWithObjectsAndKeys: static NSDictionary dictionaryWithObjectsAndKeys_( objc.ObjCObjectBase firstObject) { - final _ret = _objc_msgSend_juohf7(_class_NSDictionary, + final _ret = _objc_msgSend_62nh5j(_class_NSDictionary, _sel_dictionaryWithObjectsAndKeys_, firstObject.ref.pointer); return NSDictionary.castFromPointer(_ret, retain: true, release: true); } + /// new + static NSDictionary new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSDictionary, _sel_new); + return NSDictionary.castFromPointer(_ret, retain: false, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSDictionary, _sel_supportsSecureCoding); + } + + /// count + int get count { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_count); + } + + /// countByEnumeratingWithState:objects:count: + int countByEnumeratingWithState_objects_count_( + ffi.Pointer state, + ffi.Pointer> buffer, + int len) { + return _objc_msgSend_1b5ysjl(this.ref.pointer, + _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); + } + /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } - /// getObjects:andKeys:count: - void getObjects_andKeys_count_( - ffi.Pointer> objects, - ffi.Pointer> keys, - int count) { - _objc_msgSend_6ka9sp( - this.ref.pointer, _sel_getObjects_andKeys_count_, objects, keys, count); - } - /// init NSDictionary init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSDictionary? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null : NSDictionary.castFromPointer(_ret, retain: false, release: true); } - /// initWithContentsOfFile: - NSDictionary? initWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL: - NSDictionary? initWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL:error: - NSDictionary? initWithContentsOfURL_error_( - NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: false, release: true); - } - /// initWithDictionary: NSDictionary initWithDictionary_(NSDictionary otherDictionary) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithDictionary_, otherDictionary.ref.pointer); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } @@ -2337,14 +1552,14 @@ class NSDictionary extends NSObject { /// initWithDictionary:copyItems: NSDictionary initWithDictionary_copyItems_( NSDictionary otherDictionary, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithDictionary_copyItems_, otherDictionary.ref.pointer, flag); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } /// initWithObjects:forKeys: NSDictionary initWithObjects_forKeys_(NSArray objects, NSArray keys) { - final _ret = _objc_msgSend_iq11qg(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_rsfdlh(this.ref.retainAndReturnPointer(), _sel_initWithObjects_forKeys_, objects.ref.pointer, keys.ref.pointer); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } @@ -2354,116 +1569,32 @@ class NSDictionary extends NSObject { ffi.Pointer> objects, ffi.Pointer> keys, int cnt) { - final _ret = _objc_msgSend_9ijr00(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_cfqbni(this.ref.retainAndReturnPointer(), _sel_initWithObjects_forKeys_count_, objects, keys, cnt); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } /// initWithObjectsAndKeys: NSDictionary initWithObjectsAndKeys_(objc.ObjCObjectBase firstObject) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjectsAndKeys_, firstObject.ref.pointer); return NSDictionary.castFromPointer(_ret, retain: false, release: true); } - /// isEqualToDictionary: - bool isEqualToDictionary_(NSDictionary otherDictionary) { - return _objc_msgSend_l8lotg(this.ref.pointer, _sel_isEqualToDictionary_, - otherDictionary.ref.pointer); - } - /// keyEnumerator NSEnumerator keyEnumerator() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_keyEnumerator); - return NSEnumerator.castFromPointer(_ret, retain: true, release: true); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSDictionary, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// keysSortedByValueUsingSelector: - NSArray keysSortedByValueUsingSelector_( - ffi.Pointer comparator) { - final _ret = _objc_msgSend_12790oz( - this.ref.pointer, _sel_keysSortedByValueUsingSelector_, comparator); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSDictionary new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSDictionary, _sel_new); - return NSDictionary.castFromPointer(_ret, retain: false, release: true); - } - - /// objectEnumerator - NSEnumerator objectEnumerator() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectEnumerator); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_keyEnumerator); return NSEnumerator.castFromPointer(_ret, retain: true, release: true); } /// objectForKey: objc.ObjCObjectBase? objectForKey_(objc.ObjCObjectBase aKey) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.pointer, _sel_objectForKey_, aKey.ref.pointer); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); } - - /// objectForKeyedSubscript: - objc.ObjCObjectBase? objectForKeyedSubscript_(objc.ObjCObjectBase key) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_objectForKeyedSubscript_, key.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectsForKeys:notFoundMarker: - NSArray objectsForKeys_notFoundMarker_( - NSArray keys, objc.ObjCObjectBase marker) { - final _ret = _objc_msgSend_iq11qg( - this.ref.pointer, - _sel_objectsForKeys_notFoundMarker_, - keys.ref.pointer, - marker.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// sharedKeySetForKeys: - static objc.ObjCObjectBase sharedKeySetForKeys_(NSArray keys) { - final _ret = _objc_msgSend_juohf7( - _class_NSDictionary, _sel_sharedKeySetForKeys_, keys.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSDictionary, _sel_supportsSecureCoding); - } - - /// writeToFile:atomically: - bool writeToFile_atomically_(NSString path, bool useAuxiliaryFile) { - return _objc_msgSend_17gxu27(this.ref.pointer, _sel_writeToFile_atomically_, - path.ref.pointer, useAuxiliaryFile); - } - - /// writeToURL:atomically: - bool writeToURL_atomically_(NSURL url, bool atomically) { - return _objc_msgSend_17gxu27(this.ref.pointer, _sel_writeToURL_atomically_, - url.ref.pointer, atomically); - } - - /// writeToURL:error: - bool writeToURL_error_( - NSURL url, ffi.Pointer> error) { - return _objc_msgSend_p02k6o( - this.ref.pointer, _sel_writeToURL_error_, url.ref.pointer, error); - } } enum NSEnumerationOptions { @@ -2498,33 +1629,27 @@ class NSEnumerator extends NSObject { /// Returns whether [obj] is an instance of [NSEnumerator]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSEnumerator); } - /// allObjects - objc.ObjCObjectBase get allObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allObjects); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - /// alloc static NSEnumerator alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSEnumerator, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSEnumerator, _sel_alloc); return NSEnumerator.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSEnumerator allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSEnumerator, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSEnumerator, _sel_allocWithZone_, zone); return NSEnumerator.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSEnumerator, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static NSEnumerator new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSEnumerator, _sel_new); + return NSEnumerator.castFromPointer(_ret, retain: false, release: true); } /// countByEnumeratingWithState:objects:count: @@ -2532,33 +1657,20 @@ class NSEnumerator extends NSObject { ffi.Pointer state, ffi.Pointer> buffer, int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, + return _objc_msgSend_1b5ysjl(this.ref.pointer, _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); } /// init NSEnumerator init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSEnumerator.castFromPointer(_ret, retain: false, release: true); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSEnumerator, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSEnumerator new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSEnumerator, _sel_new); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSEnumerator.castFromPointer(_ret, retain: false, release: true); } /// nextObject objc.ObjCObjectBase? nextObject() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nextObject); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_nextObject); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); @@ -2582,61 +1694,66 @@ class NSError extends NSObject { /// Returns whether [obj] is an instance of [NSError]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSError); } /// alloc static NSError alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSError, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSError, _sel_alloc); return NSError.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSError allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSError, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSError, _sel_allocWithZone_, zone); + return NSError.castFromPointer(_ret, retain: false, release: true); + } + + /// errorWithDomain:code:userInfo: + static NSError errorWithDomain_code_userInfo_( + NSString domain, int code, objc.ObjCObjectBase? dict) { + final _ret = _objc_msgSend_17xjpl7( + _class_NSError, + _sel_errorWithDomain_code_userInfo_, + domain.ref.pointer, + code, + dict?.ref.pointer ?? ffi.nullptr); + return NSError.castFromPointer(_ret, retain: true, release: true); + } + + /// new + static NSError new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSError, _sel_new); return NSError.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSError, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSError, _sel_supportsSecureCoding); } /// code int get code { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_code); + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_code); } /// domain NSString get domain { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_domain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_domain); return NSString.castFromPointer(_ret, retain: true, release: true); } /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } - /// errorWithDomain:code:userInfo: - static NSError errorWithDomain_code_userInfo_( - NSString domain, int code, objc.ObjCObjectBase? dict) { - final _ret = _objc_msgSend_1qfg2kn( - _class_NSError, - _sel_errorWithDomain_code_userInfo_, - domain.ref.pointer, - code, - dict?.ref.pointer ?? ffi.nullptr); - return NSError.castFromPointer(_ret, retain: true, release: true); - } - /// helpAnchor NSString? get helpAnchor { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_helpAnchor); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_helpAnchor); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -2645,13 +1762,13 @@ class NSError extends NSObject { /// init NSError init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSError.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSError? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -2661,7 +1778,7 @@ class NSError extends NSObject { /// initWithDomain:code:userInfo: NSError initWithDomain_code_userInfo_( NSString domain, int code, objc.ObjCObjectBase? dict) { - final _ret = _objc_msgSend_1qfg2kn( + final _ret = _objc_msgSend_17xjpl7( this.ref.retainAndReturnPointer(), _sel_initWithDomain_code_userInfo_, domain.ref.pointer, @@ -2670,24 +1787,17 @@ class NSError extends NSObject { return NSError.castFromPointer(_ret, retain: false, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSError, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// localizedDescription NSString get localizedDescription { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedDescription); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedDescription); return NSString.castFromPointer(_ret, retain: true, release: true); } /// localizedFailureReason NSString? get localizedFailureReason { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedFailureReason); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedFailureReason); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -2696,7 +1806,7 @@ class NSError extends NSObject { /// localizedRecoveryOptions NSArray? get localizedRecoveryOptions { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedRecoveryOptions); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedRecoveryOptions); return _ret.address == 0 ? null : NSArray.castFromPointer(_ret, retain: true, release: true); @@ -2704,46 +1814,84 @@ class NSError extends NSObject { /// localizedRecoverySuggestion NSString? get localizedRecoverySuggestion { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( this.ref.pointer, _sel_localizedRecoverySuggestion); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); } - /// new - static NSError new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSError, _sel_new); - return NSError.castFromPointer(_ret, retain: false, release: true); - } - /// recoveryAttempter objc.ObjCObjectBase? get recoveryAttempter { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_recoveryAttempter); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_recoveryAttempter); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); } - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSError, _sel_supportsSecureCoding); - } - /// underlyingErrors NSArray get underlyingErrors { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_underlyingErrors); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_underlyingErrors); return NSArray.castFromPointer(_ret, retain: true, release: true); } /// userInfo objc.ObjCObjectBase get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_userInfo); return objc.ObjCObjectBase(_ret, retain: true, release: true); } } +/// NSExtendedMutableData +extension NSExtendedMutableData on NSMutableData { + /// appendBytes:length: + void appendBytes_length_(ffi.Pointer bytes, int length) { + _objc_msgSend_zuf90e( + this.ref.pointer, _sel_appendBytes_length_, bytes, length); + } + + /// appendData: + void appendData_(NSData other) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_appendData_, other.ref.pointer); + } + + /// increaseLengthBy: + void increaseLengthBy_(int extraLength) { + _objc_msgSend_1i9r4xy( + this.ref.pointer, _sel_increaseLengthBy_, extraLength); + } + + /// replaceBytesInRange:withBytes: + void replaceBytesInRange_withBytes_( + NSRange range, ffi.Pointer bytes) { + _objc_msgSend_eh32gn( + this.ref.pointer, _sel_replaceBytesInRange_withBytes_, range, bytes); + } + + /// replaceBytesInRange:withBytes:length: + void replaceBytesInRange_withBytes_length_(NSRange range, + ffi.Pointer replacementBytes, int replacementLength) { + _objc_msgSend_c0vg4w( + this.ref.pointer, + _sel_replaceBytesInRange_withBytes_length_, + range, + replacementBytes, + replacementLength); + } + + /// resetBytesInRange: + void resetBytesInRange_(NSRange range) { + _objc_msgSend_1e3pm0z(this.ref.pointer, _sel_resetBytesInRange_, range); + } + + /// setData: + void setData_(NSData data) { + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setData_, data.ref.pointer); + } +} + final class NSFastEnumerationState extends ffi.Struct { @ffi.UnsignedLong() external int state; @@ -2773,66 +1921,91 @@ class NSIndexSet extends NSObject { /// Returns whether [obj] is an instance of [NSIndexSet]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSIndexSet); } /// alloc static NSIndexSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexSet, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSIndexSet, _sel_alloc); return NSIndexSet.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSIndexSet allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSIndexSet, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSIndexSet, _sel_allocWithZone_, zone); + return NSIndexSet.castFromPointer(_ret, retain: false, release: true); + } + + /// indexSet + static NSIndexSet indexSet() { + final _ret = _objc_msgSend_1x359cv(_class_NSIndexSet, _sel_indexSet); + return NSIndexSet.castFromPointer(_ret, retain: true, release: true); + } + + /// indexSetWithIndex: + static NSIndexSet indexSetWithIndex_(int value) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSIndexSet, _sel_indexSetWithIndex_, value); + return NSIndexSet.castFromPointer(_ret, retain: true, release: true); + } + + /// indexSetWithIndexesInRange: + static NSIndexSet indexSetWithIndexesInRange_(NSRange range) { + final _ret = _objc_msgSend_83z673( + _class_NSIndexSet, _sel_indexSetWithIndexesInRange_, range); + return NSIndexSet.castFromPointer(_ret, retain: true, release: true); + } + + /// new + static NSIndexSet new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSIndexSet, _sel_new); return NSIndexSet.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSIndexSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSIndexSet, _sel_supportsSecureCoding); } /// containsIndex: bool containsIndex_(int value) { - return _objc_msgSend_91rfyn(this.ref.pointer, _sel_containsIndex_, value); + return _objc_msgSend_6peh6o(this.ref.pointer, _sel_containsIndex_, value); } /// containsIndexes: bool containsIndexes_(NSIndexSet indexSet) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_containsIndexes_, indexSet.ref.pointer); } /// containsIndexesInRange: bool containsIndexesInRange_(NSRange range) { - return _objc_msgSend_m2il7s( + return _objc_msgSend_p4nurx( this.ref.pointer, _sel_containsIndexesInRange_, range); } /// count int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_count); } /// countOfIndexesInRange: int countOfIndexesInRange_(NSRange range) { - return _objc_msgSend_1hfngdd( + return _objc_msgSend_qm9f5w( this.ref.pointer, _sel_countOfIndexesInRange_, range); } /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } /// firstIndex int get firstIndex { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_firstIndex); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_firstIndex); } /// getIndexes:maxCount:inIndexRange: @@ -2840,64 +2013,44 @@ class NSIndexSet extends NSObject { ffi.Pointer indexBuffer, int bufferSize, ffi.Pointer range) { - return _objc_msgSend_14is8x5(this.ref.pointer, + return _objc_msgSend_89xgla(this.ref.pointer, _sel_getIndexes_maxCount_inIndexRange_, indexBuffer, bufferSize, range); } /// indexGreaterThanIndex: int indexGreaterThanIndex_(int value) { - return _objc_msgSend_1eigyr6( + return _objc_msgSend_12py2ux( this.ref.pointer, _sel_indexGreaterThanIndex_, value); } /// indexGreaterThanOrEqualToIndex: int indexGreaterThanOrEqualToIndex_(int value) { - return _objc_msgSend_1eigyr6( + return _objc_msgSend_12py2ux( this.ref.pointer, _sel_indexGreaterThanOrEqualToIndex_, value); } /// indexLessThanIndex: int indexLessThanIndex_(int value) { - return _objc_msgSend_1eigyr6( + return _objc_msgSend_12py2ux( this.ref.pointer, _sel_indexLessThanIndex_, value); } /// indexLessThanOrEqualToIndex: int indexLessThanOrEqualToIndex_(int value) { - return _objc_msgSend_1eigyr6( + return _objc_msgSend_12py2ux( this.ref.pointer, _sel_indexLessThanOrEqualToIndex_, value); } - /// indexSet - static NSIndexSet indexSet() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexSet, _sel_indexSet); - return NSIndexSet.castFromPointer(_ret, retain: true, release: true); - } - - /// indexSetWithIndex: - static NSIndexSet indexSetWithIndex_(int value) { - final _ret = - _objc_msgSend_ehxl2g(_class_NSIndexSet, _sel_indexSetWithIndex_, value); - return NSIndexSet.castFromPointer(_ret, retain: true, release: true); - } - - /// indexSetWithIndexesInRange: - static NSIndexSet indexSetWithIndexesInRange_(NSRange range) { - final _ret = _objc_msgSend_176f8tz( - _class_NSIndexSet, _sel_indexSetWithIndexesInRange_, range); - return NSIndexSet.castFromPointer(_ret, retain: true, release: true); - } - /// init NSIndexSet init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSIndexSet.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSIndexSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -2906,58 +2059,40 @@ class NSIndexSet extends NSObject { /// initWithIndex: NSIndexSet initWithIndex_(int value) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithIndex_, value); return NSIndexSet.castFromPointer(_ret, retain: false, release: true); } /// initWithIndexSet: NSIndexSet initWithIndexSet_(NSIndexSet indexSet) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithIndexSet_, indexSet.ref.pointer); return NSIndexSet.castFromPointer(_ret, retain: false, release: true); } /// initWithIndexesInRange: NSIndexSet initWithIndexesInRange_(NSRange range) { - final _ret = _objc_msgSend_176f8tz( + final _ret = _objc_msgSend_83z673( this.ref.retainAndReturnPointer(), _sel_initWithIndexesInRange_, range); return NSIndexSet.castFromPointer(_ret, retain: false, release: true); } /// intersectsIndexesInRange: bool intersectsIndexesInRange_(NSRange range) { - return _objc_msgSend_m2il7s( + return _objc_msgSend_p4nurx( this.ref.pointer, _sel_intersectsIndexesInRange_, range); } /// isEqualToIndexSet: bool isEqualToIndexSet_(NSIndexSet indexSet) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isEqualToIndexSet_, indexSet.ref.pointer); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSIndexSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// lastIndex int get lastIndex { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_lastIndex); - } - - /// new - static NSIndexSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSIndexSet, _sel_new); - return NSIndexSet.castFromPointer(_ret, retain: false, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSIndexSet, _sel_supportsSecureCoding); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_lastIndex); } } @@ -2978,60 +2113,59 @@ class NSInputStream extends NSStream { /// Returns whether [obj] is an instance of [NSInputStream]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSInputStream); } - /// getBoundStreamsWithBufferSize:inputStream:outputStream: - static void getBoundStreamsWithBufferSize_inputStream_outputStream_( - int bufferSize, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_5r8xlx( - _class_NSInputStream, - _sel_getBoundStreamsWithBufferSize_inputStream_outputStream_, - bufferSize, - inputStream, - outputStream); + /// inputStreamWithData: + static NSInputStream? inputStreamWithData_(NSData data) { + final _ret = _objc_msgSend_62nh5j( + _class_NSInputStream, _sel_inputStreamWithData_, data.ref.pointer); + return _ret.address == 0 + ? null + : NSInputStream.castFromPointer(_ret, retain: true, release: true); + } + + /// inputStreamWithFileAtPath: + static NSInputStream? inputStreamWithFileAtPath_(NSString path) { + final _ret = _objc_msgSend_62nh5j(_class_NSInputStream, + _sel_inputStreamWithFileAtPath_, path.ref.pointer); + return _ret.address == 0 + ? null + : NSInputStream.castFromPointer(_ret, retain: true, release: true); + } + + /// inputStreamWithURL: + static NSInputStream? inputStreamWithURL_(NSURL url) { + final _ret = _objc_msgSend_62nh5j( + _class_NSInputStream, _sel_inputStreamWithURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : NSInputStream.castFromPointer(_ret, retain: true, release: true); } /// getBuffer:length: bool getBuffer_length_(ffi.Pointer> buffer, ffi.Pointer len) { - return _objc_msgSend_1vnalux( + return _objc_msgSend_19lrthf( this.ref.pointer, _sel_getBuffer_length_, buffer, len); } - /// getStreamsToHostWithName:port:inputStream:outputStream: - static void getStreamsToHostWithName_port_inputStream_outputStream_( - NSString hostname, - int port, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_imc4v7( - _class_NSInputStream, - _sel_getStreamsToHostWithName_port_inputStream_outputStream_, - hostname.ref.pointer, - port, - inputStream, - outputStream); - } - /// hasBytesAvailable bool get hasBytesAvailable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasBytesAvailable); + return _objc_msgSend_91o635(this.ref.pointer, _sel_hasBytesAvailable); } /// initWithData: NSInputStream initWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithData_, data.ref.pointer); return NSInputStream.castFromPointer(_ret, retain: false, release: true); } /// initWithFileAtPath: NSInputStream? initWithFileAtPath_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithFileAtPath_, path.ref.pointer); return _ret.address == 0 ? null @@ -3040,43 +2174,16 @@ class NSInputStream extends NSStream { /// initWithURL: NSInputStream? initWithURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.retainAndReturnPointer(), _sel_initWithURL_, url.ref.pointer); return _ret.address == 0 ? null : NSInputStream.castFromPointer(_ret, retain: false, release: true); } - /// inputStreamWithData: - static NSInputStream? inputStreamWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7( - _class_NSInputStream, _sel_inputStreamWithData_, data.ref.pointer); - return _ret.address == 0 - ? null - : NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// inputStreamWithFileAtPath: - static NSInputStream? inputStreamWithFileAtPath_(NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSInputStream, - _sel_inputStreamWithFileAtPath_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// inputStreamWithURL: - static NSInputStream? inputStreamWithURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( - _class_NSInputStream, _sel_inputStreamWithURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSInputStream.castFromPointer(_ret, retain: true, release: true); - } - /// read:maxLength: int read_maxLength_(ffi.Pointer buffer, int len) { - return _objc_msgSend_1wopcqf( + return _objc_msgSend_11e9f5x( this.ref.pointer, _sel_read_maxLength_, buffer, len); } } @@ -3098,7 +2205,7 @@ class NSInvocation extends objc.ObjCObjectBase { /// Returns whether [obj] is an instance of [NSInvocation]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSInvocation); } } @@ -3120,51 +2227,51 @@ class NSItemProvider extends NSObject { /// Returns whether [obj] is an instance of [NSItemProvider]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSItemProvider); } /// alloc static NSItemProvider alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSItemProvider, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSItemProvider, _sel_alloc); return NSItemProvider.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSItemProvider allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSItemProvider, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSItemProvider, _sel_allocWithZone_, zone); return NSItemProvider.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSItemProvider, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static NSItemProvider new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSItemProvider, _sel_new); + return NSItemProvider.castFromPointer(_ret, retain: false, release: true); } /// autorelease NSItemProvider autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return NSItemProvider.castFromPointer(_ret, retain: true, release: true); } /// canLoadObjectOfClass: bool canLoadObjectOfClass_(objc.ObjCObjectBase aClass) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_canLoadObjectOfClass_, aClass.ref.pointer); } /// hasItemConformingToTypeIdentifier: bool hasItemConformingToTypeIdentifier_(NSString typeIdentifier) { - return _objc_msgSend_l8lotg(this.ref.pointer, + return _objc_msgSend_69e0x1(this.ref.pointer, _sel_hasItemConformingToTypeIdentifier_, typeIdentifier.ref.pointer); } /// hasRepresentationConformingToTypeIdentifier:fileOptions: bool hasRepresentationConformingToTypeIdentifier_fileOptions_( NSString typeIdentifier, NSItemProviderFileOptions fileOptions) { - return _objc_msgSend_17v6vbw( + return _objc_msgSend_5ty9km( this.ref.pointer, _sel_hasRepresentationConformingToTypeIdentifier_fileOptions_, typeIdentifier.ref.pointer, @@ -3174,13 +2281,13 @@ class NSItemProvider extends NSObject { /// init NSItemProvider init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSItemProvider.castFromPointer(_ret, retain: false, release: true); } /// initWithContentsOfURL: NSItemProvider? initWithContentsOfURL_(NSURL fileURL) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_, fileURL.ref.pointer); return _ret.address == 0 ? null @@ -3190,7 +2297,7 @@ class NSItemProvider extends NSObject { /// initWithItem:typeIdentifier: NSItemProvider initWithItem_typeIdentifier_( objc.ObjCObjectBase? item, NSString? typeIdentifier) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initWithItem_typeIdentifier_, item?.ref.pointer ?? ffi.nullptr, @@ -3200,67 +2307,68 @@ class NSItemProvider extends NSObject { /// initWithObject: NSItemProvider initWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObject_, object.ref.pointer); return NSItemProvider.castFromPointer(_ret, retain: false, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSItemProvider, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSItemProvider new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSItemProvider, _sel_new); - return NSItemProvider.castFromPointer(_ret, retain: false, release: true); + /// loadItemForTypeIdentifier:options:completionHandler: + void loadItemForTypeIdentifier_options_completionHandler_( + NSString typeIdentifier, + NSDictionary? options, + objc.ObjCBlock?, NSError)>? + completionHandler) { + _objc_msgSend_91c9gi( + this.ref.pointer, + _sel_loadItemForTypeIdentifier_options_completionHandler_, + typeIdentifier.ref.pointer, + options?.ref.pointer ?? ffi.nullptr, + completionHandler?.ref.pointer ?? ffi.nullptr); } /// registerObject:visibility: void registerObject_visibility_(objc.ObjCObjectBase object, NSItemProviderRepresentationVisibility visibility) { - _objc_msgSend_k79o95(this.ref.pointer, _sel_registerObject_visibility_, + _objc_msgSend_pww1yj(this.ref.pointer, _sel_registerObject_visibility_, object.ref.pointer, visibility.value); } /// registeredTypeIdentifiers NSArray get registeredTypeIdentifiers { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_registeredTypeIdentifiers); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_registeredTypeIdentifiers); return NSArray.castFromPointer(_ret, retain: true, release: true); } /// registeredTypeIdentifiersWithFileOptions: NSArray registeredTypeIdentifiersWithFileOptions_( NSItemProviderFileOptions fileOptions) { - final _ret = _objc_msgSend_1yh9gk0(this.ref.pointer, + final _ret = _objc_msgSend_1ih2cte(this.ref.pointer, _sel_registeredTypeIdentifiersWithFileOptions_, fileOptions.value); return NSArray.castFromPointer(_ret, retain: true, release: true); } /// retain NSItemProvider retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSItemProvider.castFromPointer(_ret, retain: true, release: true); } /// self NSItemProvider self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSItemProvider.castFromPointer(_ret, retain: true, release: true); } /// setSuggestedName: set suggestedName(NSString? value) { - return _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setSuggestedName_, + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setSuggestedName_, value?.ref.pointer ?? ffi.nullptr); } /// suggestedName NSString? get suggestedName { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_suggestedName); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_suggestedName); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -3373,7 +2481,7 @@ class NSLocale extends objc.ObjCObjectBase { /// Returns whether [obj] is an instance of [NSLocale]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSLocale); } } @@ -3395,92 +2503,79 @@ class NSMethodSignature extends NSObject { /// Returns whether [obj] is an instance of [NSMethodSignature]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMethodSignature); } /// alloc static NSMethodSignature alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMethodSignature, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMethodSignature, _sel_alloc); return NSMethodSignature.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMethodSignature allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( + final _ret = _objc_msgSend_hzlb60( _class_NSMethodSignature, _sel_allocWithZone_, zone); return NSMethodSignature.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMethodSignature, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static NSMethodSignature new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMethodSignature, _sel_new); + return NSMethodSignature.castFromPointer(_ret, + retain: false, release: true); + } + + /// signatureWithObjCTypes: + static NSMethodSignature? signatureWithObjCTypes_( + ffi.Pointer types) { + final _ret = _objc_msgSend_rqwdif( + _class_NSMethodSignature, _sel_signatureWithObjCTypes_, types); + return _ret.address == 0 + ? null + : NSMethodSignature.castFromPointer(_ret, retain: true, release: true); } /// frameLength int get frameLength { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_frameLength); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_frameLength); } /// getArgumentTypeAtIndex: ffi.Pointer getArgumentTypeAtIndex_(int idx) { - return _objc_msgSend_1o478a1( + return _objc_msgSend_1jtxufi( this.ref.pointer, _sel_getArgumentTypeAtIndex_, idx); } /// init NSMethodSignature init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMethodSignature.castFromPointer(_ret, retain: false, release: true); } /// isOneway bool isOneway() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isOneway); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMethodSignature, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isOneway); } /// methodReturnLength int get methodReturnLength { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_methodReturnLength); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_methodReturnLength); } /// methodReturnType ffi.Pointer get methodReturnType { - return _objc_msgSend_1ypnhm3(this.ref.pointer, _sel_methodReturnType); - } - - /// new - static NSMethodSignature new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMethodSignature, _sel_new); - return NSMethodSignature.castFromPointer(_ret, - retain: false, release: true); + return _objc_msgSend_1fuqfwb(this.ref.pointer, _sel_methodReturnType); } /// numberOfArguments int get numberOfArguments { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_numberOfArguments); - } - - /// signatureWithObjCTypes: - static NSMethodSignature? signatureWithObjCTypes_( - ffi.Pointer types) { - final _ret = _objc_msgSend_1og3t2d( - _class_NSMethodSignature, _sel_signatureWithObjCTypes_, types); - return _ret.address == 0 - ? null - : NSMethodSignature.castFromPointer(_ret, retain: true, release: true); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_numberOfArguments); } } @@ -3501,99 +2596,53 @@ class NSMutableArray extends NSArray { /// Returns whether [obj] is an instance of [NSMutableArray]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableArray); } - /// addObject: - void addObject_(objc.ObjCObjectBase anObject) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addObject_, anObject.ref.pointer); - } - - /// addObjectsFromArray: - void addObjectsFromArray_(NSArray otherArray) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addObjectsFromArray_, otherArray.ref.pointer); - } - /// alloc static NSMutableArray alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableArray, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableArray, _sel_alloc); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMutableArray allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSMutableArray, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSMutableArray, _sel_allocWithZone_, zone); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } - /// applyDifference: - void applyDifference_(objc.ObjCObjectBase difference) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_applyDifference_, difference.ref.pointer); - } - /// array static NSMutableArray array() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableArray, _sel_array); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableArray, _sel_array); return NSMutableArray.castFromPointer(_ret, retain: true, release: true); } /// arrayWithArray: static NSMutableArray arrayWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSMutableArray, _sel_arrayWithArray_, array.ref.pointer); return NSMutableArray.castFromPointer(_ret, retain: true, release: true); } /// arrayWithCapacity: static NSMutableArray arrayWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSMutableArray, _sel_arrayWithCapacity_, numItems); return NSMutableArray.castFromPointer(_ret, retain: true, release: true); } - /// arrayWithContentsOfFile: - static NSArray? arrayWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableArray, _sel_arrayWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// arrayWithContentsOfURL: - static NSArray? arrayWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableArray, _sel_arrayWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// arrayWithContentsOfURL:error: - static NSArray? arrayWithContentsOfURL_error_( - NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSMutableArray, - _sel_arrayWithContentsOfURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// arrayWithObject: static NSMutableArray arrayWithObject_(objc.ObjCObjectBase anObject) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSMutableArray, _sel_arrayWithObject_, anObject.ref.pointer); return NSMutableArray.castFromPointer(_ret, retain: true, release: true); } /// arrayWithObjects: static NSMutableArray arrayWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSMutableArray, _sel_arrayWithObjects_, firstObj.ref.pointer); return NSMutableArray.castFromPointer(_ret, retain: true, release: true); } @@ -3601,81 +2650,69 @@ class NSMutableArray extends NSArray { /// arrayWithObjects:count: static NSMutableArray arrayWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es( + final _ret = _objc_msgSend_1lqqdvl( _class_NSMutableArray, _sel_arrayWithObjects_count_, objects, cnt); return NSMutableArray.castFromPointer(_ret, retain: true, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableArray, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static NSMutableArray new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableArray, _sel_new); + return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } - /// exchangeObjectAtIndex:withObjectAtIndex: - void exchangeObjectAtIndex_withObjectAtIndex_(int idx1, int idx2) { - _objc_msgSend_1o3mqxx(this.ref.pointer, - _sel_exchangeObjectAtIndex_withObjectAtIndex_, idx1, idx2); - } + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableArray, _sel_supportsSecureCoding); + } + + /// addObject: + void addObject_(objc.ObjCObjectBase anObject) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_addObject_, anObject.ref.pointer); + } /// init NSMutableArray init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } /// initWithArray: NSMutableArray initWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithArray_, array.ref.pointer); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } /// initWithArray:copyItems: NSMutableArray initWithArray_copyItems_(NSArray array, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithArray_copyItems_, array.ref.pointer, flag); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } /// initWithCapacity: NSMutableArray initWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, numItems); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSMutableArray? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null : NSMutableArray.castFromPointer(_ret, retain: false, release: true); } - /// initWithContentsOfFile: - NSMutableArray? initWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableArray.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithContentsOfURL: - NSMutableArray? initWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableArray.castFromPointer(_ret, retain: false, release: true); - } - /// initWithObjects: NSMutableArray initWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjects_, firstObj.ref.pointer); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } @@ -3683,165 +2720,33 @@ class NSMutableArray extends NSArray { /// initWithObjects:count: NSMutableArray initWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1lqqdvl(this.ref.retainAndReturnPointer(), _sel_initWithObjects_count_, objects, cnt); return NSMutableArray.castFromPointer(_ret, retain: false, release: true); } /// insertObject:atIndex: void insertObject_atIndex_(objc.ObjCObjectBase anObject, int index) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_insertObject_atIndex_, + _objc_msgSend_10i1axw(this.ref.pointer, _sel_insertObject_atIndex_, anObject.ref.pointer, index); } - /// insertObjects:atIndexes: - void insertObjects_atIndexes_(NSArray objects, NSIndexSet indexes) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_insertObjects_atIndexes_, - objects.ref.pointer, indexes.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableArray, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSMutableArray new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableArray, _sel_new); - return NSMutableArray.castFromPointer(_ret, retain: false, release: true); - } - - /// removeAllObjects - void removeAllObjects() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllObjects); - } - /// removeLastObject void removeLastObject() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeLastObject); - } - - /// removeObject: - void removeObject_(objc.ObjCObjectBase anObject) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObject_, anObject.ref.pointer); - } - - /// removeObject:inRange: - void removeObject_inRange_(objc.ObjCObjectBase anObject, NSRange range) { - _objc_msgSend_lusc9(this.ref.pointer, _sel_removeObject_inRange_, - anObject.ref.pointer, range); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_removeLastObject); } /// removeObjectAtIndex: void removeObjectAtIndex_(int index) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeObjectAtIndex_, index); - } - - /// removeObjectIdenticalTo: - void removeObjectIdenticalTo_(objc.ObjCObjectBase anObject) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObjectIdenticalTo_, anObject.ref.pointer); - } - - /// removeObjectIdenticalTo:inRange: - void removeObjectIdenticalTo_inRange_( - objc.ObjCObjectBase anObject, NSRange range) { - _objc_msgSend_lusc9(this.ref.pointer, _sel_removeObjectIdenticalTo_inRange_, - anObject.ref.pointer, range); - } - - /// removeObjectsAtIndexes: - void removeObjectsAtIndexes_(NSIndexSet indexes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObjectsAtIndexes_, indexes.ref.pointer); - } - - /// removeObjectsInArray: - void removeObjectsInArray_(NSArray otherArray) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObjectsInArray_, otherArray.ref.pointer); - } - - /// removeObjectsInRange: - void removeObjectsInRange_(NSRange range) { - _objc_msgSend_9xf7uy(this.ref.pointer, _sel_removeObjectsInRange_, range); + _objc_msgSend_1i9r4xy(this.ref.pointer, _sel_removeObjectAtIndex_, index); } /// replaceObjectAtIndex:withObject: void replaceObjectAtIndex_withObject_( int index, objc.ObjCObjectBase anObject) { - _objc_msgSend_1a4j45m(this.ref.pointer, + _objc_msgSend_1c7f48q(this.ref.pointer, _sel_replaceObjectAtIndex_withObject_, index, anObject.ref.pointer); } - - /// replaceObjectsAtIndexes:withObjects: - void replaceObjectsAtIndexes_withObjects_( - NSIndexSet indexes, NSArray objects) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_replaceObjectsAtIndexes_withObjects_, - indexes.ref.pointer, - objects.ref.pointer); - } - - /// replaceObjectsInRange:withObjectsFromArray: - void replaceObjectsInRange_withObjectsFromArray_( - NSRange range, NSArray otherArray) { - _objc_msgSend_85e5ih( - this.ref.pointer, - _sel_replaceObjectsInRange_withObjectsFromArray_, - range, - otherArray.ref.pointer); - } - - /// replaceObjectsInRange:withObjectsFromArray:range: - void replaceObjectsInRange_withObjectsFromArray_range_( - NSRange range, NSArray otherArray, NSRange otherRange) { - _objc_msgSend_11w1eba( - this.ref.pointer, - _sel_replaceObjectsInRange_withObjectsFromArray_range_, - range, - otherArray.ref.pointer, - otherRange); - } - - /// setArray: - void setArray_(NSArray otherArray) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setArray_, otherArray.ref.pointer); - } - - /// setObject:atIndexedSubscript: - void setObject_atIndexedSubscript_(objc.ObjCObjectBase obj, int idx) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_setObject_atIndexedSubscript_, - obj.ref.pointer, idx); - } - - /// sortUsingFunction:context: - void sortUsingFunction_context_( - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>> - compare, - ffi.Pointer context) { - _objc_msgSend_ma10gr( - this.ref.pointer, _sel_sortUsingFunction_context_, compare, context); - } - - /// sortUsingSelector: - void sortUsingSelector_(ffi.Pointer comparator) { - _objc_msgSend_5ns8s6(this.ref.pointer, _sel_sortUsingSelector_, comparator); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableArray, _sel_supportsSecureCoding); - } } /// NSMutableData @@ -3861,68 +2766,33 @@ class NSMutableData extends NSData { /// Returns whether [obj] is an instance of [NSMutableData]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableData); } /// alloc static NSMutableData alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableData, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableData, _sel_alloc); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMutableData allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSMutableData, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSMutableData, _sel_allocWithZone_, zone); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } - /// appendBytes:length: - void appendBytes_length_(ffi.Pointer bytes, int length) { - _objc_msgSend_vzqe8w( - this.ref.pointer, _sel_appendBytes_length_, bytes, length); - } - - /// appendData: - void appendData_(NSData other) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_appendData_, other.ref.pointer); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableData, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// compressUsingAlgorithm:error: - bool compressUsingAlgorithm_error_(NSDataCompressionAlgorithm algorithm, - ffi.Pointer> error) { - return _objc_msgSend_1ma83mm(this.ref.pointer, - _sel_compressUsingAlgorithm_error_, algorithm.value, error); - } - - /// compressedDataUsingAlgorithm:error: - NSMutableData? compressedDataUsingAlgorithm_error_( - NSDataCompressionAlgorithm algorithm, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1d0rqol(this.ref.pointer, - _sel_compressedDataUsingAlgorithm_error_, algorithm.value, error); - return _ret.address == 0 - ? null - : NSMutableData.castFromPointer(_ret, retain: true, release: true); - } - /// data static NSMutableData data() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableData, _sel_data); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableData, _sel_data); return NSMutableData.castFromPointer(_ret, retain: true, release: true); } /// dataWithBytes:length: static NSMutableData dataWithBytes_length_( ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz( + final _ret = _objc_msgSend_19qmeje( _class_NSMutableData, _sel_dataWithBytes_length_, bytes, length); return NSMutableData.castFromPointer(_ret, retain: true, release: true); } @@ -3930,7 +2800,7 @@ class NSMutableData extends NSData { /// dataWithBytesNoCopy:length: static NSMutableData dataWithBytesNoCopy_length_( ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz( + final _ret = _objc_msgSend_19qmeje( _class_NSMutableData, _sel_dataWithBytesNoCopy_length_, bytes, length); return NSMutableData.castFromPointer(_ret, retain: true, release: true); } @@ -3938,14 +2808,14 @@ class NSMutableData extends NSData { /// dataWithBytesNoCopy:length:freeWhenDone: static NSMutableData dataWithBytesNoCopy_length_freeWhenDone_( ffi.Pointer bytes, int length, bool b) { - final _ret = _objc_msgSend_1pk67jm(_class_NSMutableData, + final _ret = _objc_msgSend_1je1k7e(_class_NSMutableData, _sel_dataWithBytesNoCopy_length_freeWhenDone_, bytes, length, b); return NSMutableData.castFromPointer(_ret, retain: true, release: true); } /// dataWithCapacity: static NSMutableData? dataWithCapacity_(int aNumItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSMutableData, _sel_dataWithCapacity_, aNumItems); return _ret.address == 0 ? null @@ -3954,7 +2824,7 @@ class NSMutableData extends NSData { /// dataWithContentsOfFile: static NSMutableData? dataWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSMutableData, _sel_dataWithContentsOfFile_, path.ref.pointer); return _ret.address == 0 ? null @@ -3966,7 +2836,7 @@ class NSMutableData extends NSData { NSString path, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( _class_NSMutableData, _sel_dataWithContentsOfFile_options_error_, path.ref.pointer, @@ -3979,7 +2849,7 @@ class NSMutableData extends NSData { /// dataWithContentsOfURL: static NSMutableData? dataWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSMutableData, _sel_dataWithContentsOfURL_, url.ref.pointer); return _ret.address == 0 ? null @@ -3991,7 +2861,7 @@ class NSMutableData extends NSData { NSURL url, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( _class_NSMutableData, _sel_dataWithContentsOfURL_options_error_, url.ref.pointer, @@ -4004,55 +2874,65 @@ class NSMutableData extends NSData { /// dataWithData: static NSMutableData dataWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSMutableData, _sel_dataWithData_, data.ref.pointer); return NSMutableData.castFromPointer(_ret, retain: true, release: true); } /// dataWithLength: static NSMutableData? dataWithLength_(int length) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSMutableData, _sel_dataWithLength_, length); return _ret.address == 0 ? null : NSMutableData.castFromPointer(_ret, retain: true, release: true); } - /// decompressUsingAlgorithm:error: - bool decompressUsingAlgorithm_error_(NSDataCompressionAlgorithm algorithm, + /// new + static NSMutableData new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableData, _sel_new); + return NSMutableData.castFromPointer(_ret, retain: false, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableData, _sel_supportsSecureCoding); + } + + /// compressedDataUsingAlgorithm:error: + NSMutableData? compressedDataUsingAlgorithm_error_( + NSDataCompressionAlgorithm algorithm, ffi.Pointer> error) { - return _objc_msgSend_1ma83mm(this.ref.pointer, - _sel_decompressUsingAlgorithm_error_, algorithm.value, error); + final _ret = _objc_msgSend_1okds6o(this.ref.pointer, + _sel_compressedDataUsingAlgorithm_error_, algorithm.value, error); + return _ret.address == 0 + ? null + : NSMutableData.castFromPointer(_ret, retain: true, release: true); } /// decompressedDataUsingAlgorithm:error: NSMutableData? decompressedDataUsingAlgorithm_error_( NSDataCompressionAlgorithm algorithm, ffi.Pointer> error) { - final _ret = _objc_msgSend_1d0rqol(this.ref.pointer, + final _ret = _objc_msgSend_1okds6o(this.ref.pointer, _sel_decompressedDataUsingAlgorithm_error_, algorithm.value, error); return _ret.address == 0 ? null : NSMutableData.castFromPointer(_ret, retain: true, release: true); } - /// increaseLengthBy: - void increaseLengthBy_(int extraLength) { - _objc_msgSend_1k4zaz5( - this.ref.pointer, _sel_increaseLengthBy_, extraLength); - } - /// init NSMutableData init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } /// initWithBase64EncodedData:options: NSMutableData? initWithBase64EncodedData_options_( NSData base64Data, NSDataBase64DecodingOptions options) { - final _ret = _objc_msgSend_1dostih( + final _ret = _objc_msgSend_dnlotu( this.ref.retainAndReturnPointer(), _sel_initWithBase64EncodedData_options_, base64Data.ref.pointer, @@ -4065,7 +2945,7 @@ class NSMutableData extends NSData { /// initWithBase64EncodedString:options: NSMutableData? initWithBase64EncodedString_options_( NSString base64String, NSDataBase64DecodingOptions options) { - final _ret = _objc_msgSend_1dostih( + final _ret = _objc_msgSend_dnlotu( this.ref.retainAndReturnPointer(), _sel_initWithBase64EncodedString_options_, base64String.ref.pointer, @@ -4077,7 +2957,7 @@ class NSMutableData extends NSData { /// initWithBytes:length: NSMutableData initWithBytes_length_(ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_19qmeje(this.ref.retainAndReturnPointer(), _sel_initWithBytes_length_, bytes, length); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } @@ -4085,7 +2965,7 @@ class NSMutableData extends NSData { /// initWithBytesNoCopy:length: NSMutableData initWithBytesNoCopy_length_( ffi.Pointer bytes, int length) { - final _ret = _objc_msgSend_9trkjz(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_19qmeje(this.ref.retainAndReturnPointer(), _sel_initWithBytesNoCopy_length_, bytes, length); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } @@ -4093,14 +2973,14 @@ class NSMutableData extends NSData { /// initWithBytesNoCopy:length:freeWhenDone: NSMutableData initWithBytesNoCopy_length_freeWhenDone_( ffi.Pointer bytes, int length, bool b) { - final _ret = _objc_msgSend_1pk67jm(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1je1k7e(this.ref.retainAndReturnPointer(), _sel_initWithBytesNoCopy_length_freeWhenDone_, bytes, length, b); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } /// initWithCapacity: NSMutableData? initWithCapacity_(int capacity) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, capacity); return _ret.address == 0 ? null @@ -4109,7 +2989,7 @@ class NSMutableData extends NSData { /// initWithCoder: NSMutableData? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -4118,7 +2998,7 @@ class NSMutableData extends NSData { /// initWithContentsOfFile: NSMutableData? initWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_, path.ref.pointer); return _ret.address == 0 ? null @@ -4130,7 +3010,7 @@ class NSMutableData extends NSData { NSString path, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_options_error_, path.ref.pointer, @@ -4143,7 +3023,7 @@ class NSMutableData extends NSData { /// initWithContentsOfURL: NSMutableData? initWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_, url.ref.pointer); return _ret.address == 0 ? null @@ -4155,7 +3035,7 @@ class NSMutableData extends NSData { NSURL url, NSDataReadingOptions readOptionsMask, ffi.Pointer> errorPtr) { - final _ret = _objc_msgSend_1294bp9( + final _ret = _objc_msgSend_p8i56h( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_options_error_, url.ref.pointer, @@ -4168,80 +3048,33 @@ class NSMutableData extends NSData { /// initWithData: NSMutableData initWithData_(NSData data) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithData_, data.ref.pointer); return NSMutableData.castFromPointer(_ret, retain: false, release: true); } /// initWithLength: NSMutableData? initWithLength_(int length) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithLength_, length); return _ret.address == 0 ? null : NSMutableData.castFromPointer(_ret, retain: false, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableData, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// length int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_length); } /// mutableBytes ffi.Pointer get mutableBytes { - return _objc_msgSend_1578rxt(this.ref.pointer, _sel_mutableBytes); - } - - /// new - static NSMutableData new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableData, _sel_new); - return NSMutableData.castFromPointer(_ret, retain: false, release: true); - } - - /// replaceBytesInRange:withBytes: - void replaceBytesInRange_withBytes_( - NSRange range, ffi.Pointer bytes) { - _objc_msgSend_17tek7t( - this.ref.pointer, _sel_replaceBytesInRange_withBytes_, range, bytes); - } - - /// replaceBytesInRange:withBytes:length: - void replaceBytesInRange_withBytes_length_(NSRange range, - ffi.Pointer replacementBytes, int replacementLength) { - _objc_msgSend_uftsvh( - this.ref.pointer, - _sel_replaceBytesInRange_withBytes_length_, - range, - replacementBytes, - replacementLength); - } - - /// resetBytesInRange: - void resetBytesInRange_(NSRange range) { - _objc_msgSend_9xf7uy(this.ref.pointer, _sel_resetBytesInRange_, range); - } - - /// setData: - void setData_(NSData data) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setData_, data.ref.pointer); + return _objc_msgSend_6ex6p5(this.ref.pointer, _sel_mutableBytes); } /// setLength: set length(int value) { - return _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_setLength_, value); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableData, _sel_supportsSecureCoding); + _objc_msgSend_1i9r4xy(this.ref.pointer, _sel_setLength_, value); } } @@ -4262,84 +3095,44 @@ class NSMutableDictionary extends NSDictionary { /// Returns whether [obj] is an instance of [NSMutableDictionary]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableDictionary); } - /// addEntriesFromDictionary: - void addEntriesFromDictionary_(NSDictionary otherDictionary) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addEntriesFromDictionary_, - otherDictionary.ref.pointer); - } - /// alloc static NSMutableDictionary alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableDictionary, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableDictionary, _sel_alloc); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMutableDictionary allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( + final _ret = _objc_msgSend_hzlb60( _class_NSMutableDictionary, _sel_allocWithZone_, zone); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableDictionary, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - /// dictionary static NSMutableDictionary dictionary() { final _ret = - _objc_msgSend_1unuoxw(_class_NSMutableDictionary, _sel_dictionary); + _objc_msgSend_1x359cv(_class_NSMutableDictionary, _sel_dictionary); return NSMutableDictionary.castFromPointer(_ret, retain: true, release: true); } /// dictionaryWithCapacity: static NSMutableDictionary dictionaryWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSMutableDictionary, _sel_dictionaryWithCapacity_, numItems); return NSMutableDictionary.castFromPointer(_ret, retain: true, release: true); } - /// dictionaryWithContentsOfFile: - static NSDictionary? dictionaryWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, - _sel_dictionaryWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// dictionaryWithContentsOfURL: - static NSDictionary? dictionaryWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, - _sel_dictionaryWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - - /// dictionaryWithContentsOfURL:error: - static NSDictionary? dictionaryWithContentsOfURL_error_( - NSURL url, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(_class_NSMutableDictionary, - _sel_dictionaryWithContentsOfURL_error_, url.ref.pointer, error); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - /// dictionaryWithDictionary: static NSMutableDictionary dictionaryWithDictionary_(NSDictionary dict) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, + final _ret = _objc_msgSend_62nh5j(_class_NSMutableDictionary, _sel_dictionaryWithDictionary_, dict.ref.pointer); return NSMutableDictionary.castFromPointer(_ret, retain: true, release: true); @@ -4348,7 +3141,7 @@ class NSMutableDictionary extends NSDictionary { /// dictionaryWithObject:forKey: static NSMutableDictionary dictionaryWithObject_forKey_( objc.ObjCObjectBase object, objc.ObjCObjectBase key) { - final _ret = _objc_msgSend_iq11qg(_class_NSMutableDictionary, + final _ret = _objc_msgSend_rsfdlh(_class_NSMutableDictionary, _sel_dictionaryWithObject_forKey_, object.ref.pointer, key.ref.pointer); return NSMutableDictionary.castFromPointer(_ret, retain: true, release: true); @@ -4357,7 +3150,7 @@ class NSMutableDictionary extends NSDictionary { /// dictionaryWithObjects:forKeys: static NSMutableDictionary dictionaryWithObjects_forKeys_( NSArray objects, NSArray keys) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( _class_NSMutableDictionary, _sel_dictionaryWithObjects_forKeys_, objects.ref.pointer, @@ -4371,7 +3164,7 @@ class NSMutableDictionary extends NSDictionary { ffi.Pointer> objects, ffi.Pointer> keys, int cnt) { - final _ret = _objc_msgSend_9ijr00(_class_NSMutableDictionary, + final _ret = _objc_msgSend_cfqbni(_class_NSMutableDictionary, _sel_dictionaryWithObjects_forKeys_count_, objects, keys, cnt); return NSMutableDictionary.castFromPointer(_ret, retain: true, release: true); @@ -4380,32 +3173,36 @@ class NSMutableDictionary extends NSDictionary { /// dictionaryWithObjectsAndKeys: static NSMutableDictionary dictionaryWithObjectsAndKeys_( objc.ObjCObjectBase firstObject) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, + final _ret = _objc_msgSend_62nh5j(_class_NSMutableDictionary, _sel_dictionaryWithObjectsAndKeys_, firstObject.ref.pointer); return NSMutableDictionary.castFromPointer(_ret, retain: true, release: true); } - /// dictionaryWithSharedKeySet: - static NSMutableDictionary dictionaryWithSharedKeySet_( - objc.ObjCObjectBase keyset) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, - _sel_dictionaryWithSharedKeySet_, keyset.ref.pointer); + /// new + static NSMutableDictionary new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableDictionary, _sel_new); return NSMutableDictionary.castFromPointer(_ret, - retain: true, release: true); + retain: false, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableDictionary, _sel_supportsSecureCoding); } /// init NSMutableDictionary init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); } /// initWithCapacity: NSMutableDictionary initWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, numItems); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); @@ -4413,7 +3210,7 @@ class NSMutableDictionary extends NSDictionary { /// initWithCoder: NSMutableDictionary? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -4421,29 +3218,9 @@ class NSMutableDictionary extends NSDictionary { retain: false, release: true); } - /// initWithContentsOfFile: - NSMutableDictionary? initWithContentsOfFile_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfFile_, path.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableDictionary.castFromPointer(_ret, - retain: false, release: true); - } - - /// initWithContentsOfURL: - NSMutableDictionary? initWithContentsOfURL_(NSURL url) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithContentsOfURL_, url.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableDictionary.castFromPointer(_ret, - retain: false, release: true); - } - /// initWithDictionary: NSMutableDictionary initWithDictionary_(NSDictionary otherDictionary) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithDictionary_, otherDictionary.ref.pointer); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); @@ -4452,7 +3229,7 @@ class NSMutableDictionary extends NSDictionary { /// initWithDictionary:copyItems: NSMutableDictionary initWithDictionary_copyItems_( NSDictionary otherDictionary, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithDictionary_copyItems_, otherDictionary.ref.pointer, flag); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); @@ -4460,7 +3237,7 @@ class NSMutableDictionary extends NSDictionary { /// initWithObjects:forKeys: NSMutableDictionary initWithObjects_forKeys_(NSArray objects, NSArray keys) { - final _ret = _objc_msgSend_iq11qg(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_rsfdlh(this.ref.retainAndReturnPointer(), _sel_initWithObjects_forKeys_, objects.ref.pointer, keys.ref.pointer); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); @@ -4471,7 +3248,7 @@ class NSMutableDictionary extends NSDictionary { ffi.Pointer> objects, ffi.Pointer> keys, int cnt) { - final _ret = _objc_msgSend_9ijr00(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_cfqbni(this.ref.retainAndReturnPointer(), _sel_initWithObjects_forKeys_count_, objects, keys, cnt); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); @@ -4479,75 +3256,24 @@ class NSMutableDictionary extends NSDictionary { /// initWithObjectsAndKeys: NSMutableDictionary initWithObjectsAndKeys_(objc.ObjCObjectBase firstObject) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjectsAndKeys_, firstObject.ref.pointer); return NSMutableDictionary.castFromPointer(_ret, retain: false, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSMutableDictionary new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableDictionary, _sel_new); - return NSMutableDictionary.castFromPointer(_ret, - retain: false, release: true); - } - - /// removeAllObjects - void removeAllObjects() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllObjects); - } - /// removeObjectForKey: void removeObjectForKey_(objc.ObjCObjectBase aKey) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_removeObjectForKey_, aKey.ref.pointer); } - /// removeObjectsForKeys: - void removeObjectsForKeys_(NSArray keyArray) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObjectsForKeys_, keyArray.ref.pointer); - } - - /// setDictionary: - void setDictionary_(NSDictionary otherDictionary) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setDictionary_, otherDictionary.ref.pointer); - } - /// setObject:forKey: void setObject_forKey_( objc.ObjCObjectBase anObject, objc.ObjCObjectBase aKey) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_setObject_forKey_, + _objc_msgSend_wjvic9(this.ref.pointer, _sel_setObject_forKey_, anObject.ref.pointer, aKey.ref.pointer); } - - /// setObject:forKeyedSubscript: - void setObject_forKeyedSubscript_( - objc.ObjCObjectBase? obj, objc.ObjCObjectBase key) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_setObject_forKeyedSubscript_, - obj?.ref.pointer ?? ffi.nullptr, key.ref.pointer); - } - - /// sharedKeySetForKeys: - static objc.ObjCObjectBase sharedKeySetForKeys_(NSArray keys) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableDictionary, - _sel_sharedKeySetForKeys_, keys.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableDictionary, _sel_supportsSecureCoding); - } } /// NSMutableIndexSet @@ -4567,154 +3293,141 @@ class NSMutableIndexSet extends NSIndexSet { /// Returns whether [obj] is an instance of [NSMutableIndexSet]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableIndexSet); } - /// addIndex: - void addIndex_(int value) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_addIndex_, value); - } - - /// addIndexes: - void addIndexes_(NSIndexSet indexSet) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addIndexes_, indexSet.ref.pointer); - } - - /// addIndexesInRange: - void addIndexesInRange_(NSRange range) { - _objc_msgSend_9xf7uy(this.ref.pointer, _sel_addIndexesInRange_, range); - } - /// alloc static NSMutableIndexSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableIndexSet, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableIndexSet, _sel_alloc); return NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMutableIndexSet allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( + final _ret = _objc_msgSend_hzlb60( _class_NSMutableIndexSet, _sel_allocWithZone_, zone); return NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableIndexSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - /// indexSet static NSMutableIndexSet indexSet() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableIndexSet, _sel_indexSet); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableIndexSet, _sel_indexSet); return NSMutableIndexSet.castFromPointer(_ret, retain: true, release: true); } /// indexSetWithIndex: static NSMutableIndexSet indexSetWithIndex_(int value) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSMutableIndexSet, _sel_indexSetWithIndex_, value); return NSMutableIndexSet.castFromPointer(_ret, retain: true, release: true); } /// indexSetWithIndexesInRange: static NSMutableIndexSet indexSetWithIndexesInRange_(NSRange range) { - final _ret = _objc_msgSend_176f8tz( + final _ret = _objc_msgSend_83z673( _class_NSMutableIndexSet, _sel_indexSetWithIndexesInRange_, range); return NSMutableIndexSet.castFromPointer(_ret, retain: true, release: true); } - /// init - NSMutableIndexSet init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + /// new + static NSMutableIndexSet new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableIndexSet, _sel_new); return NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); } - /// initWithCoder: - NSMutableIndexSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableIndexSet, _sel_supportsSecureCoding); } - /// initWithIndex: - NSMutableIndexSet initWithIndex_(int value) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.retainAndReturnPointer(), _sel_initWithIndex_, value); - return NSMutableIndexSet.castFromPointer(_ret, - retain: false, release: true); + /// addIndex: + void addIndex_(int value) { + _objc_msgSend_1i9r4xy(this.ref.pointer, _sel_addIndex_, value); } - /// initWithIndexSet: - NSMutableIndexSet initWithIndexSet_(NSIndexSet indexSet) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_initWithIndexSet_, indexSet.ref.pointer); + /// addIndexes: + void addIndexes_(NSIndexSet indexSet) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_addIndexes_, indexSet.ref.pointer); + } + + /// addIndexesInRange: + void addIndexesInRange_(NSRange range) { + _objc_msgSend_1e3pm0z(this.ref.pointer, _sel_addIndexesInRange_, range); + } + + /// init + NSMutableIndexSet init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); } - /// initWithIndexesInRange: - NSMutableIndexSet initWithIndexesInRange_(NSRange range) { - final _ret = _objc_msgSend_176f8tz( - this.ref.retainAndReturnPointer(), _sel_initWithIndexesInRange_, range); + /// initWithCoder: + NSMutableIndexSet? initWithCoder_(NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithIndex: + NSMutableIndexSet initWithIndex_(int value) { + final _ret = _objc_msgSend_1qrcblu( + this.ref.retainAndReturnPointer(), _sel_initWithIndex_, value); return NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableIndexSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); + /// initWithIndexSet: + NSMutableIndexSet initWithIndexSet_(NSIndexSet indexSet) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithIndexSet_, indexSet.ref.pointer); + return NSMutableIndexSet.castFromPointer(_ret, + retain: false, release: true); } - /// new - static NSMutableIndexSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableIndexSet, _sel_new); + /// initWithIndexesInRange: + NSMutableIndexSet initWithIndexesInRange_(NSRange range) { + final _ret = _objc_msgSend_83z673( + this.ref.retainAndReturnPointer(), _sel_initWithIndexesInRange_, range); return NSMutableIndexSet.castFromPointer(_ret, retain: false, release: true); } /// removeAllIndexes void removeAllIndexes() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllIndexes); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_removeAllIndexes); } /// removeIndex: void removeIndex_(int value) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeIndex_, value); + _objc_msgSend_1i9r4xy(this.ref.pointer, _sel_removeIndex_, value); } /// removeIndexes: void removeIndexes_(NSIndexSet indexSet) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_removeIndexes_, indexSet.ref.pointer); } /// removeIndexesInRange: void removeIndexesInRange_(NSRange range) { - _objc_msgSend_9xf7uy(this.ref.pointer, _sel_removeIndexesInRange_, range); + _objc_msgSend_1e3pm0z(this.ref.pointer, _sel_removeIndexesInRange_, range); } /// shiftIndexesStartingAtIndex:by: void shiftIndexesStartingAtIndex_by_(int index, int delta) { - _objc_msgSend_ajjpfe( + _objc_msgSend_otx1t4( this.ref.pointer, _sel_shiftIndexesStartingAtIndex_by_, index, delta); } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableIndexSet, _sel_supportsSecureCoding); - } } /// NSMutableOrderedSet @@ -4734,79 +3447,157 @@ class NSMutableOrderedSet extends NSOrderedSet { /// Returns whether [obj] is an instance of [NSMutableOrderedSet]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableOrderedSet); } - /// addObject: - void addObject_(objc.ObjCObjectBase object) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addObject_, object.ref.pointer); - } - - /// addObjects:count: - void addObjects_count_( - ffi.Pointer> objects, int count) { - _objc_msgSend_11hffth( - this.ref.pointer, _sel_addObjects_count_, objects, count); - } - - /// addObjectsFromArray: - void addObjectsFromArray_(NSArray array) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addObjectsFromArray_, array.ref.pointer); - } - /// alloc static NSMutableOrderedSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableOrderedSet, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableOrderedSet, _sel_alloc); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMutableOrderedSet allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( + final _ret = _objc_msgSend_hzlb60( _class_NSMutableOrderedSet, _sel_allocWithZone_, zone); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); } - /// applyDifference: - void applyDifference_(objc.ObjCObjectBase difference) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_applyDifference_, difference.ref.pointer); + /// new + static NSMutableOrderedSet new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableOrderedSet, _sel_new); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableOrderedSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// orderedSet + static NSMutableOrderedSet orderedSet() { + final _ret = + _objc_msgSend_1x359cv(_class_NSMutableOrderedSet, _sel_orderedSet); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); } - /// autorelease - NSMutableOrderedSet autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + /// orderedSetWithArray: + static NSMutableOrderedSet orderedSetWithArray_(NSArray array) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableOrderedSet, + _sel_orderedSetWithArray_, array.ref.pointer); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithArray:range:copyItems: + static NSMutableOrderedSet orderedSetWithArray_range_copyItems_( + NSArray array, NSRange range, bool flag) { + final _ret = _objc_msgSend_1cqd8wl( + _class_NSMutableOrderedSet, + _sel_orderedSetWithArray_range_copyItems_, + array.ref.pointer, + range, + flag); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithCapacity: + static NSMutableOrderedSet orderedSetWithCapacity_(int numItems) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSMutableOrderedSet, _sel_orderedSetWithCapacity_, numItems); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithObject: + static NSMutableOrderedSet orderedSetWithObject_(objc.ObjCObjectBase object) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableOrderedSet, + _sel_orderedSetWithObject_, object.ref.pointer); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithObjects: + static NSMutableOrderedSet orderedSetWithObjects_( + objc.ObjCObjectBase firstObj) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableOrderedSet, + _sel_orderedSetWithObjects_, firstObj.ref.pointer); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithObjects:count: + static NSMutableOrderedSet orderedSetWithObjects_count_( + ffi.Pointer> objects, int cnt) { + final _ret = _objc_msgSend_1lqqdvl(_class_NSMutableOrderedSet, + _sel_orderedSetWithObjects_count_, objects, cnt); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithOrderedSet: + static NSMutableOrderedSet orderedSetWithOrderedSet_(NSOrderedSet set) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableOrderedSet, + _sel_orderedSetWithOrderedSet_, set.ref.pointer); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithOrderedSet:range:copyItems: + static NSMutableOrderedSet orderedSetWithOrderedSet_range_copyItems_( + NSOrderedSet set, NSRange range, bool flag) { + final _ret = _objc_msgSend_1cqd8wl( + _class_NSMutableOrderedSet, + _sel_orderedSetWithOrderedSet_range_copyItems_, + set.ref.pointer, + range, + flag); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithSet: + static NSMutableOrderedSet orderedSetWithSet_(objc.ObjCObjectBase set) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableOrderedSet, _sel_orderedSetWithSet_, set.ref.pointer); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// orderedSetWithSet:copyItems: + static NSMutableOrderedSet orderedSetWithSet_copyItems_( + objc.ObjCObjectBase set, bool flag) { + final _ret = _objc_msgSend_1bdmr5f(_class_NSMutableOrderedSet, + _sel_orderedSetWithSet_copyItems_, set.ref.pointer, flag); return NSMutableOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// exchangeObjectAtIndex:withObjectAtIndex: - void exchangeObjectAtIndex_withObjectAtIndex_(int idx1, int idx2) { - _objc_msgSend_1o3mqxx(this.ref.pointer, - _sel_exchangeObjectAtIndex_withObjectAtIndex_, idx1, idx2); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableOrderedSet, _sel_supportsSecureCoding); + } + + /// autorelease + NSMutableOrderedSet autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); } /// init NSMutableOrderedSet init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithArray: NSMutableOrderedSet initWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithArray_, array.ref.pointer); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4814,7 +3605,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithArray:copyItems: NSMutableOrderedSet initWithArray_copyItems_(NSArray set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithArray_copyItems_, set.ref.pointer, flag); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4823,7 +3614,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithArray:range:copyItems: NSMutableOrderedSet initWithArray_range_copyItems_( NSArray set, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1cqd8wl(this.ref.retainAndReturnPointer(), _sel_initWithArray_range_copyItems_, set.ref.pointer, range, flag); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4831,7 +3622,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithCapacity: NSMutableOrderedSet initWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, numItems); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4839,7 +3630,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithCoder: NSMutableOrderedSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -4849,7 +3640,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithObject: NSMutableOrderedSet initWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObject_, object.ref.pointer); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4857,7 +3648,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithObjects: NSMutableOrderedSet initWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjects_, firstObj.ref.pointer); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4866,7 +3657,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithObjects:count: NSMutableOrderedSet initWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1lqqdvl(this.ref.retainAndReturnPointer(), _sel_initWithObjects_count_, objects, cnt); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4874,7 +3665,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithOrderedSet: NSMutableOrderedSet initWithOrderedSet_(NSOrderedSet set) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithOrderedSet_, set.ref.pointer); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4883,7 +3674,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithOrderedSet:copyItems: NSMutableOrderedSet initWithOrderedSet_copyItems_( NSOrderedSet set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithOrderedSet_copyItems_, set.ref.pointer, flag); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4892,7 +3683,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithOrderedSet:range:copyItems: NSMutableOrderedSet initWithOrderedSet_range_copyItems_( NSOrderedSet set, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1cqd8wl(this.ref.retainAndReturnPointer(), _sel_initWithOrderedSet_range_copyItems_, set.ref.pointer, range, flag); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4900,7 +3691,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithSet: NSMutableOrderedSet initWithSet_(objc.ObjCObjectBase set) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.retainAndReturnPointer(), _sel_initWithSet_, set.ref.pointer); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4909,7 +3700,7 @@ class NSMutableOrderedSet extends NSOrderedSet { /// initWithSet:copyItems: NSMutableOrderedSet initWithSet_copyItems_( objc.ObjCObjectBase set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithSet_copyItems_, set.ref.pointer, flag); return NSMutableOrderedSet.castFromPointer(_ret, retain: false, release: true); @@ -4917,335 +3708,160 @@ class NSMutableOrderedSet extends NSOrderedSet { /// insertObject:atIndex: void insertObject_atIndex_(objc.ObjCObjectBase object, int idx) { - _objc_msgSend_cjm5ga( + _objc_msgSend_10i1axw( this.ref.pointer, _sel_insertObject_atIndex_, object.ref.pointer, idx); } - /// insertObjects:atIndexes: - void insertObjects_atIndexes_(NSArray objects, NSIndexSet indexes) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_insertObjects_atIndexes_, - objects.ref.pointer, indexes.ref.pointer); + /// removeObjectAtIndex: + void removeObjectAtIndex_(int idx) { + _objc_msgSend_1i9r4xy(this.ref.pointer, _sel_removeObjectAtIndex_, idx); } - /// intersectOrderedSet: - void intersectOrderedSet_(NSOrderedSet other) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_intersectOrderedSet_, other.ref.pointer); + /// replaceObjectAtIndex:withObject: + void replaceObjectAtIndex_withObject_(int idx, objc.ObjCObjectBase object) { + _objc_msgSend_1c7f48q(this.ref.pointer, + _sel_replaceObjectAtIndex_withObject_, idx, object.ref.pointer); } - /// intersectSet: - void intersectSet_(objc.ObjCObjectBase other) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_intersectSet_, other.ref.pointer); + /// retain + NSMutableOrderedSet retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableOrderedSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); + /// self + NSMutableOrderedSet self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSMutableOrderedSet.castFromPointer(_ret, + retain: true, release: true); } +} - /// minusOrderedSet: - void minusOrderedSet_(NSOrderedSet other) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_minusOrderedSet_, other.ref.pointer); - } +/// NSMutableSet +class NSMutableSet extends NSSet { + NSMutableSet._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); - /// minusSet: - void minusSet_(objc.ObjCObjectBase other) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_minusSet_, other.ref.pointer); - } + /// Constructs a [NSMutableSet] that points to the same underlying object as [other]. + NSMutableSet.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSMutableSet] that wraps the given raw object pointer. + NSMutableSet.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); - /// moveObjectsAtIndexes:toIndex: - void moveObjectsAtIndexes_toIndex_(NSIndexSet indexes, int idx) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_moveObjectsAtIndexes_toIndex_, - indexes.ref.pointer, idx); + /// Returns whether [obj] is an instance of [NSMutableSet]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableSet); } - /// new - static NSMutableOrderedSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableOrderedSet, _sel_new); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: false, release: true); + /// alloc + static NSMutableSet alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableSet, _sel_alloc); + return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } - /// orderedSet - static NSMutableOrderedSet orderedSet() { + /// allocWithZone: + static NSMutableSet allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1unuoxw(_class_NSMutableOrderedSet, _sel_orderedSet); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + _objc_msgSend_hzlb60(_class_NSMutableSet, _sel_allocWithZone_, zone); + return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } - /// orderedSetWithArray: - static NSMutableOrderedSet orderedSetWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableOrderedSet, - _sel_orderedSetWithArray_, array.ref.pointer); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + /// new + static NSMutableSet new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableSet, _sel_new); + return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } - /// orderedSetWithArray:range:copyItems: - static NSMutableOrderedSet orderedSetWithArray_range_copyItems_( - NSArray array, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3( - _class_NSMutableOrderedSet, - _sel_orderedSetWithArray_range_copyItems_, - array.ref.pointer, - range, - flag); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + /// set + static NSMutableSet set1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableSet, _sel_set); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } - /// orderedSetWithCapacity: - static NSMutableOrderedSet orderedSetWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSMutableOrderedSet, _sel_orderedSetWithCapacity_, numItems); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + /// setWithArray: + static NSMutableSet setWithArray_(NSArray array) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableSet, _sel_setWithArray_, array.ref.pointer); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } - /// orderedSetWithObject: - static NSMutableOrderedSet orderedSetWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableOrderedSet, - _sel_orderedSetWithObject_, object.ref.pointer); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + /// setWithCapacity: + static NSMutableSet setWithCapacity_(int numItems) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSMutableSet, _sel_setWithCapacity_, numItems); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } - /// orderedSetWithObjects: - static NSMutableOrderedSet orderedSetWithObjects_( - objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableOrderedSet, - _sel_orderedSetWithObjects_, firstObj.ref.pointer); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + /// setWithObject: + static NSMutableSet setWithObject_(objc.ObjCObjectBase object) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableSet, _sel_setWithObject_, object.ref.pointer); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } - /// orderedSetWithObjects:count: - static NSMutableOrderedSet orderedSetWithObjects_count_( - ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(_class_NSMutableOrderedSet, - _sel_orderedSetWithObjects_count_, objects, cnt); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); + /// setWithObjects: + static NSMutableSet setWithObjects_(objc.ObjCObjectBase firstObj) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableSet, _sel_setWithObjects_, firstObj.ref.pointer); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } - /// orderedSetWithOrderedSet: - static NSMutableOrderedSet orderedSetWithOrderedSet_(NSOrderedSet set) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableOrderedSet, - _sel_orderedSetWithOrderedSet_, set.ref.pointer); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// orderedSetWithOrderedSet:range:copyItems: - static NSMutableOrderedSet orderedSetWithOrderedSet_range_copyItems_( - NSOrderedSet set, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3( - _class_NSMutableOrderedSet, - _sel_orderedSetWithOrderedSet_range_copyItems_, - set.ref.pointer, - range, - flag); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// orderedSetWithSet: - static NSMutableOrderedSet orderedSetWithSet_(objc.ObjCObjectBase set) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableOrderedSet, _sel_orderedSetWithSet_, set.ref.pointer); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// orderedSetWithSet:copyItems: - static NSMutableOrderedSet orderedSetWithSet_copyItems_( - objc.ObjCObjectBase set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(_class_NSMutableOrderedSet, - _sel_orderedSetWithSet_copyItems_, set.ref.pointer, flag); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// removeAllObjects - void removeAllObjects() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllObjects); - } - - /// removeObject: - void removeObject_(objc.ObjCObjectBase object) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObject_, object.ref.pointer); - } - - /// removeObjectAtIndex: - void removeObjectAtIndex_(int idx) { - _objc_msgSend_1k4zaz5(this.ref.pointer, _sel_removeObjectAtIndex_, idx); - } - - /// removeObjectsAtIndexes: - void removeObjectsAtIndexes_(NSIndexSet indexes) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObjectsAtIndexes_, indexes.ref.pointer); - } - - /// removeObjectsInArray: - void removeObjectsInArray_(NSArray array) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_removeObjectsInArray_, array.ref.pointer); - } - - /// removeObjectsInRange: - void removeObjectsInRange_(NSRange range) { - _objc_msgSend_9xf7uy(this.ref.pointer, _sel_removeObjectsInRange_, range); - } - - /// replaceObjectAtIndex:withObject: - void replaceObjectAtIndex_withObject_(int idx, objc.ObjCObjectBase object) { - _objc_msgSend_1a4j45m(this.ref.pointer, - _sel_replaceObjectAtIndex_withObject_, idx, object.ref.pointer); - } - - /// replaceObjectsAtIndexes:withObjects: - void replaceObjectsAtIndexes_withObjects_( - NSIndexSet indexes, NSArray objects) { - _objc_msgSend_1tjlcwl( - this.ref.pointer, - _sel_replaceObjectsAtIndexes_withObjects_, - indexes.ref.pointer, - objects.ref.pointer); - } - - /// replaceObjectsInRange:withObjects:count: - void replaceObjectsInRange_withObjects_count_(NSRange range, - ffi.Pointer> objects, int count) { - _objc_msgSend_y4z43q(this.ref.pointer, - _sel_replaceObjectsInRange_withObjects_count_, range, objects, count); - } - - /// retain - NSMutableOrderedSet retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// self - NSMutableOrderedSet self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); - return NSMutableOrderedSet.castFromPointer(_ret, - retain: true, release: true); - } - - /// setObject:atIndex: - void setObject_atIndex_(objc.ObjCObjectBase obj, int idx) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_setObject_atIndex_, obj.ref.pointer, idx); + /// setWithObjects:count: + static NSMutableSet setWithObjects_count_( + ffi.Pointer> objects, int cnt) { + final _ret = _objc_msgSend_1lqqdvl( + _class_NSMutableSet, _sel_setWithObjects_count_, objects, cnt); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } - /// setObject:atIndexedSubscript: - void setObject_atIndexedSubscript_(objc.ObjCObjectBase obj, int idx) { - _objc_msgSend_cjm5ga(this.ref.pointer, _sel_setObject_atIndexedSubscript_, - obj.ref.pointer, idx); + /// setWithSet: + static NSMutableSet setWithSet_(NSSet set) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableSet, _sel_setWithSet_, set.ref.pointer); + return NSMutableSet.castFromPointer(_ret, retain: true, release: true); } /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableOrderedSet, _sel_supportsSecureCoding); - } - - /// unionOrderedSet: - void unionOrderedSet_(NSOrderedSet other) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_unionOrderedSet_, other.ref.pointer); - } - - /// unionSet: - void unionSet_(objc.ObjCObjectBase other) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_unionSet_, other.ref.pointer); - } -} - -/// NSMutableSet -class NSMutableSet extends NSSet { - NSMutableSet._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSMutableSet] that points to the same underlying object as [other]. - NSMutableSet.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSMutableSet] that wraps the given raw object pointer. - NSMutableSet.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSMutableSet]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableSet); + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSMutableSet, _sel_supportsSecureCoding); } /// addObject: void addObject_(objc.ObjCObjectBase object) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_addObject_, object.ref.pointer); - } - - /// addObjectsFromArray: - void addObjectsFromArray_(NSArray array) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_addObjectsFromArray_, array.ref.pointer); - } - - /// alloc - static NSMutableSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableSet, _sel_alloc); - return NSMutableSet.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSMutableSet allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSMutableSet, _sel_allocWithZone_, zone); - return NSMutableSet.castFromPointer(_ret, retain: false, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_addObject_, object.ref.pointer); } /// init NSMutableSet init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } /// initWithArray: NSMutableSet initWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithArray_, array.ref.pointer); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } /// initWithCapacity: NSMutableSet initWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, numItems); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSMutableSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -5254,7 +3870,7 @@ class NSMutableSet extends NSSet { /// initWithObjects: NSMutableSet initWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjects_, firstObj.ref.pointer); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } @@ -5262,125 +3878,30 @@ class NSMutableSet extends NSSet { /// initWithObjects:count: NSMutableSet initWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1lqqdvl(this.ref.retainAndReturnPointer(), _sel_initWithObjects_count_, objects, cnt); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } /// initWithSet: NSMutableSet initWithSet_(NSSet set) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.retainAndReturnPointer(), _sel_initWithSet_, set.ref.pointer); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } /// initWithSet:copyItems: NSMutableSet initWithSet_copyItems_(NSSet set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithSet_copyItems_, set.ref.pointer, flag); return NSMutableSet.castFromPointer(_ret, retain: false, release: true); } - /// intersectSet: - void intersectSet_(NSSet otherSet) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_intersectSet_, otherSet.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// minusSet: - void minusSet_(NSSet otherSet) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_minusSet_, otherSet.ref.pointer); - } - - /// new - static NSMutableSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableSet, _sel_new); - return NSMutableSet.castFromPointer(_ret, retain: false, release: true); - } - - /// removeAllObjects - void removeAllObjects() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllObjects); - } - /// removeObject: void removeObject_(objc.ObjCObjectBase object) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_removeObject_, object.ref.pointer); } - - /// set - static NSMutableSet set1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableSet, _sel_set); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setSet: - void setSet_(NSSet otherSet) { - _objc_msgSend_ukcdfq(this.ref.pointer, _sel_setSet_, otherSet.ref.pointer); - } - - /// setWithArray: - static NSMutableSet setWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableSet, _sel_setWithArray_, array.ref.pointer); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithCapacity: - static NSMutableSet setWithCapacity_(int numItems) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSMutableSet, _sel_setWithCapacity_, numItems); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithObject: - static NSMutableSet setWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableSet, _sel_setWithObject_, object.ref.pointer); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithObjects: - static NSMutableSet setWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableSet, _sel_setWithObjects_, firstObj.ref.pointer); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithObjects:count: - static NSMutableSet setWithObjects_count_( - ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es( - _class_NSMutableSet, _sel_setWithObjects_count_, objects, cnt); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithSet: - static NSMutableSet setWithSet_(NSSet set) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableSet, _sel_setWithSet_, set.ref.pointer); - return NSMutableSet.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSMutableSet, _sel_supportsSecureCoding); - } - - /// unionSet: - void unionSet_(NSSet otherSet) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_unionSet_, otherSet.ref.pointer); - } } /// NSMutableString @@ -5400,94 +3921,229 @@ class NSMutableString extends NSString { /// Returns whether [obj] is an instance of [NSMutableString]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableString); } /// alloc static NSMutableString alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableString, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSMutableString, _sel_alloc); return NSMutableString.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSMutableString allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0( - _class_NSMutableString, _sel_allocWithZone_, zone); + final _ret = + _objc_msgSend_hzlb60(_class_NSMutableString, _sel_allocWithZone_, zone); return NSMutableString.castFromPointer(_ret, retain: false, release: true); } - /// appendFormat: - void appendFormat_(NSString format) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_appendFormat_, format.ref.pointer); - } - - /// appendString: - void appendString_(NSString aString) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_appendString_, aString.ref.pointer); - } - - /// applyTransform:reverse:range:updatedRange: - bool applyTransform_reverse_range_updatedRange_(NSString transform, - bool reverse, NSRange range, ffi.Pointer resultingRange) { - return _objc_msgSend_1dw56bx( - this.ref.pointer, - _sel_applyTransform_reverse_range_updatedRange_, - transform.ref.pointer, - reverse, - range, - resultingRange); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSMutableString, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// localizedStringWithFormat: + static NSMutableString localizedStringWithFormat_(NSString format) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableString, + _sel_localizedStringWithFormat_, format.ref.pointer); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); } - /// availableStringEncodings - static ffi.Pointer getAvailableStringEncodings() { - return _objc_msgSend_gvd36k( - _class_NSMutableString, _sel_availableStringEncodings); + /// localizedStringWithValidatedFormat:validFormatSpecifiers:error: + static NSMutableString? + localizedStringWithValidatedFormat_validFormatSpecifiers_error_( + NSString format, + NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSMutableString, + _sel_localizedStringWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); } - /// defaultCStringEncoding - static int getDefaultCStringEncoding() { - return _objc_msgSend_eldhrq( - _class_NSMutableString, _sel_defaultCStringEncoding); + /// new + static NSMutableString new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableString, _sel_new); + return NSMutableString.castFromPointer(_ret, retain: false, release: true); } - /// deleteCharactersInRange: - void deleteCharactersInRange_(NSRange range) { - _objc_msgSend_9xf7uy( - this.ref.pointer, _sel_deleteCharactersInRange_, range); + /// objectWithItemProviderData:typeIdentifier:error: + static NSMutableString? objectWithItemProviderData_typeIdentifier_error_( + NSData data, + NSString typeIdentifier, + ffi.Pointer> outError) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSMutableString, + _sel_objectWithItemProviderData_typeIdentifier_error_, + data.ref.pointer, + typeIdentifier.ref.pointer, + outError); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); } - /// init - NSMutableString init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSMutableString.castFromPointer(_ret, retain: false, release: true); + /// string + static NSMutableString string() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableString, _sel_string); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); } - /// initWithBytes:length:encoding: - NSMutableString? initWithBytes_length_encoding_( - ffi.Pointer bytes, int len, int encoding) { - final _ret = _objc_msgSend_1ea4mhr(this.ref.retainAndReturnPointer(), - _sel_initWithBytes_length_encoding_, bytes, len, encoding); + /// stringWithCString:encoding: + static NSMutableString? stringWithCString_encoding_( + ffi.Pointer cString, int enc) { + final _ret = _objc_msgSend_a15xhc( + _class_NSMutableString, _sel_stringWithCString_encoding_, cString, enc); return _ret.address == 0 ? null - : NSMutableString.castFromPointer(_ret, retain: false, release: true); + : NSMutableString.castFromPointer(_ret, retain: true, release: true); } - /// initWithBytesNoCopy:length:encoding:freeWhenDone: - NSMutableString? initWithBytesNoCopy_length_encoding_freeWhenDone_( - ffi.Pointer bytes, int len, int encoding, bool freeBuffer) { - final _ret = _objc_msgSend_1idnlsy( - this.ref.retainAndReturnPointer(), - _sel_initWithBytesNoCopy_length_encoding_freeWhenDone_, + /// stringWithCharacters:length: + static NSMutableString stringWithCharacters_length_( + ffi.Pointer characters, int length) { + final _ret = _objc_msgSend_13z9dkp(_class_NSMutableString, + _sel_stringWithCharacters_length_, characters, length); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithContentsOfFile:encoding:error: + static NSMutableString? stringWithContentsOfFile_encoding_error_( + NSString path, int enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + _class_NSMutableString, + _sel_stringWithContentsOfFile_encoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithContentsOfFile:usedEncoding:error: + static NSMutableString? stringWithContentsOfFile_usedEncoding_error_( + NSString path, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + _class_NSMutableString, + _sel_stringWithContentsOfFile_usedEncoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithContentsOfURL:encoding:error: + static NSMutableString? stringWithContentsOfURL_encoding_error_( + NSURL url, int enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + _class_NSMutableString, + _sel_stringWithContentsOfURL_encoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithContentsOfURL:usedEncoding:error: + static NSMutableString? stringWithContentsOfURL_usedEncoding_error_( + NSURL url, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + _class_NSMutableString, + _sel_stringWithContentsOfURL_usedEncoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithFormat: + static NSMutableString stringWithFormat_(NSString format) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableString, _sel_stringWithFormat_, format.ref.pointer); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithString: + static NSMutableString stringWithString_(NSString string) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableString, _sel_stringWithString_, string.ref.pointer); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithUTF8String: + static NSMutableString? stringWithUTF8String_( + ffi.Pointer nullTerminatedCString) { + final _ret = _objc_msgSend_rqwdif(_class_NSMutableString, + _sel_stringWithUTF8String_, nullTerminatedCString); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithValidatedFormat:validFormatSpecifiers:error: + static NSMutableString? + stringWithValidatedFormat_validFormatSpecifiers_error_( + NSString format, + NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSMutableString, + _sel_stringWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableString, _sel_supportsSecureCoding); + } + + /// autorelease + NSMutableString autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); + } + + /// init + NSMutableString init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSMutableString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithBytes:length:encoding: + NSMutableString? initWithBytes_length_encoding_( + ffi.Pointer bytes, int len, int encoding) { + final _ret = _objc_msgSend_i38ton(this.ref.retainAndReturnPointer(), + _sel_initWithBytes_length_encoding_, bytes, len, encoding); + return _ret.address == 0 + ? null + : NSMutableString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithBytesNoCopy:length:encoding:freeWhenDone: + NSMutableString? initWithBytesNoCopy_length_encoding_freeWhenDone_( + ffi.Pointer bytes, int len, int encoding, bool freeBuffer) { + final _ret = _objc_msgSend_o2ktnn( + this.ref.retainAndReturnPointer(), + _sel_initWithBytesNoCopy_length_encoding_freeWhenDone_, bytes, len, encoding, @@ -5500,24 +4156,17 @@ class NSMutableString extends NSString { /// initWithCString:encoding: NSMutableString? initWithCString_encoding_( ffi.Pointer nullTerminatedCString, int encoding) { - final _ret = _objc_msgSend_1t5rcq1(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_a15xhc(this.ref.retainAndReturnPointer(), _sel_initWithCString_encoding_, nullTerminatedCString, encoding); return _ret.address == 0 ? null : NSMutableString.castFromPointer(_ret, retain: false, release: true); } - /// initWithCapacity: - NSMutableString initWithCapacity_(int capacity) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, capacity); - return NSMutableString.castFromPointer(_ret, retain: false, release: true); - } - /// initWithCharacters:length: NSMutableString initWithCharacters_length_( ffi.Pointer characters, int length) { - final _ret = _objc_msgSend_syhe4c(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_13z9dkp(this.ref.retainAndReturnPointer(), _sel_initWithCharacters_length_, characters, length); return NSMutableString.castFromPointer(_ret, retain: false, release: true); } @@ -5525,7 +4174,7 @@ class NSMutableString extends NSString { /// initWithCharactersNoCopy:length:freeWhenDone: NSMutableString initWithCharactersNoCopy_length_freeWhenDone_( ffi.Pointer characters, int length, bool freeBuffer) { - final _ret = _objc_msgSend_1rimh2f( + final _ret = _objc_msgSend_zsd8q9( this.ref.retainAndReturnPointer(), _sel_initWithCharactersNoCopy_length_freeWhenDone_, characters, @@ -5536,7 +4185,7 @@ class NSMutableString extends NSString { /// initWithCoder: NSMutableString? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -5546,7 +4195,7 @@ class NSMutableString extends NSString { /// initWithContentsOfFile:encoding:error: NSMutableString? initWithContentsOfFile_encoding_error_( NSString path, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( + final _ret = _objc_msgSend_94cet5( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_encoding_error_, path.ref.pointer, @@ -5562,7 +4211,7 @@ class NSMutableString extends NSString { NSString path, ffi.Pointer enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( + final _ret = _objc_msgSend_1gxo8gv( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_usedEncoding_error_, path.ref.pointer, @@ -5576,7 +4225,7 @@ class NSMutableString extends NSString { /// initWithContentsOfURL:encoding:error: NSMutableString? initWithContentsOfURL_encoding_error_( NSURL url, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( + final _ret = _objc_msgSend_94cet5( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_encoding_error_, url.ref.pointer, @@ -5592,7 +4241,7 @@ class NSMutableString extends NSString { NSURL url, ffi.Pointer enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( + final _ret = _objc_msgSend_1gxo8gv( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_usedEncoding_error_, url.ref.pointer, @@ -5605,7 +4254,7 @@ class NSMutableString extends NSString { /// initWithData:encoding: NSMutableString? initWithData_encoding_(NSData data, int encoding) { - final _ret = _objc_msgSend_183c8xv(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_dcd68g(this.ref.retainAndReturnPointer(), _sel_initWithData_encoding_, data.ref.pointer, encoding); return _ret.address == 0 ? null @@ -5614,7 +4263,7 @@ class NSMutableString extends NSString { /// initWithFormat: NSMutableString initWithFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithFormat_, format.ref.pointer); return NSMutableString.castFromPointer(_ret, retain: false, release: true); } @@ -5622,7 +4271,7 @@ class NSMutableString extends NSString { /// initWithFormat:locale: NSMutableString initWithFormat_locale_( NSString format, objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initWithFormat_locale_, format.ref.pointer, @@ -5632,7 +4281,7 @@ class NSMutableString extends NSString { /// initWithString: NSMutableString initWithString_(NSString aString) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithString_, aString.ref.pointer); return NSMutableString.castFromPointer(_ret, retain: false, release: true); } @@ -5640,7 +4289,7 @@ class NSMutableString extends NSString { /// initWithUTF8String: NSMutableString? initWithUTF8String_( ffi.Pointer nullTerminatedCString) { - final _ret = _objc_msgSend_1og3t2d(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_rqwdif(this.ref.retainAndReturnPointer(), _sel_initWithUTF8String_, nullTerminatedCString); return _ret.address == 0 ? null @@ -5652,7 +4301,7 @@ class NSMutableString extends NSString { NSString format, NSString validFormatSpecifiers, ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( + final _ret = _objc_msgSend_bo6ep4( this.ref.retainAndReturnPointer(), _sel_initWithValidatedFormat_validFormatSpecifiers_error_, format.ref.pointer, @@ -5669,7 +4318,7 @@ class NSMutableString extends NSString { NSString validFormatSpecifiers, objc.ObjCObjectBase? locale, ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( + final _ret = _objc_msgSend_2izev6( this.ref.retainAndReturnPointer(), _sel_initWithValidatedFormat_validFormatSpecifiers_locale_error_, format.ref.pointer, @@ -5681,323 +4330,110 @@ class NSMutableString extends NSString { : NSMutableString.castFromPointer(_ret, retain: false, release: true); } - /// insertString:atIndex: - void insertString_atIndex_(NSString aString, int loc) { - _objc_msgSend_cjm5ga( - this.ref.pointer, _sel_insertString_atIndex_, aString.ref.pointer, loc); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableString, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); + /// replaceCharactersInRange:withString: + void replaceCharactersInRange_withString_(NSRange range, NSString aString) { + _objc_msgSend_i4ny2p(this.ref.pointer, + _sel_replaceCharactersInRange_withString_, range, aString.ref.pointer); } - /// localizedNameOfStringEncoding: - static NSString localizedNameOfStringEncoding_(int encoding) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSMutableString, _sel_localizedNameOfStringEncoding_, encoding); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// retain + NSMutableString retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSMutableString.castFromPointer(_ret, retain: true, release: true); } - /// localizedStringWithFormat: - static NSMutableString localizedStringWithFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7(_class_NSMutableString, - _sel_localizedStringWithFormat_, format.ref.pointer); + /// self + NSMutableString self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSMutableString.castFromPointer(_ret, retain: true, release: true); } +} - /// localizedStringWithValidatedFormat:validFormatSpecifiers:error: - static NSMutableString? - localizedStringWithValidatedFormat_validFormatSpecifiers_error_( - NSString format, - NSString validFormatSpecifiers, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSMutableString, - _sel_localizedStringWithValidatedFormat_validFormatSpecifiers_error_, - format.ref.pointer, - validFormatSpecifiers.ref.pointer, - error); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } +/// NSNotification +class NSNotification extends NSObject { + NSNotification._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); - /// new - static NSMutableString new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableString, _sel_new); - return NSMutableString.castFromPointer(_ret, retain: false, release: true); - } + /// Constructs a [NSNotification] that points to the same underlying object as [other]. + NSNotification.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); - /// objectWithItemProviderData:typeIdentifier:error: - static NSMutableString? objectWithItemProviderData_typeIdentifier_error_( - NSData data, - NSString typeIdentifier, - ffi.Pointer> outError) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSMutableString, - _sel_objectWithItemProviderData_typeIdentifier_error_, - data.ref.pointer, - typeIdentifier.ref.pointer, - outError); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } + /// Constructs a [NSNotification] that wraps the given raw object pointer. + NSNotification.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); - /// readableTypeIdentifiersForItemProvider - static NSArray readableTypeIdentifiersForItemProvider() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSMutableString, _sel_readableTypeIdentifiersForItemProvider); - return NSArray.castFromPointer(_ret, retain: true, release: true); + /// Returns whether [obj] is an instance of [NSNotification]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSNotification); } - /// replaceCharactersInRange:withString: - void replaceCharactersInRange_withString_(NSRange range, NSString aString) { - _objc_msgSend_85e5ih(this.ref.pointer, - _sel_replaceCharactersInRange_withString_, range, aString.ref.pointer); + /// alloc + static NSNotification alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSNotification, _sel_alloc); + return NSNotification.castFromPointer(_ret, retain: false, release: true); } - /// replaceOccurrencesOfString:withString:options:range: - int replaceOccurrencesOfString_withString_options_range_( - NSString target, - NSString replacement, - NSStringCompareOptions options, - NSRange searchRange) { - return _objc_msgSend_n73nlr( - this.ref.pointer, - _sel_replaceOccurrencesOfString_withString_options_range_, - target.ref.pointer, - replacement.ref.pointer, - options.value, - searchRange); + /// allocWithZone: + static NSNotification allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSNotification, _sel_allocWithZone_, zone); + return NSNotification.castFromPointer(_ret, retain: false, release: true); } - /// setString: - void setString_(NSString aString) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_setString_, aString.ref.pointer); + /// new + static NSNotification new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSNotification, _sel_new); + return NSNotification.castFromPointer(_ret, retain: false, release: true); } - /// string - static NSMutableString string() { - final _ret = _objc_msgSend_1unuoxw(_class_NSMutableString, _sel_string); - return NSMutableString.castFromPointer(_ret, retain: true, release: true); + /// notificationWithName:object: + static NSNotification notificationWithName_object_( + NSString aName, objc.ObjCObjectBase? anObject) { + final _ret = _objc_msgSend_rsfdlh( + _class_NSNotification, + _sel_notificationWithName_object_, + aName.ref.pointer, + anObject?.ref.pointer ?? ffi.nullptr); + return NSNotification.castFromPointer(_ret, retain: true, release: true); } - /// stringEncodingForData:encodingOptions:convertedString:usedLossyConversion: - static int - stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_( - NSData data, - NSDictionary? opts, - ffi.Pointer> string, - ffi.Pointer usedLossyConversion) { - return _objc_msgSend_1el0by7( - _class_NSMutableString, - _sel_stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_, - data.ref.pointer, - opts?.ref.pointer ?? ffi.nullptr, - string, - usedLossyConversion); + /// notificationWithName:object:userInfo: + static NSNotification notificationWithName_object_userInfo_( + NSString aName, objc.ObjCObjectBase? anObject, NSDictionary? aUserInfo) { + final _ret = _objc_msgSend_582s3n( + _class_NSNotification, + _sel_notificationWithName_object_userInfo_, + aName.ref.pointer, + anObject?.ref.pointer ?? ffi.nullptr, + aUserInfo?.ref.pointer ?? ffi.nullptr); + return NSNotification.castFromPointer(_ret, retain: true, release: true); } - /// stringWithCString:encoding: - static NSMutableString? stringWithCString_encoding_( - ffi.Pointer cString, int enc) { - final _ret = _objc_msgSend_1t5rcq1( - _class_NSMutableString, _sel_stringWithCString_encoding_, cString, enc); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); + /// autorelease + NSNotification autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSNotification.castFromPointer(_ret, retain: true, release: true); } - /// stringWithCapacity: - static NSMutableString stringWithCapacity_(int capacity) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSMutableString, _sel_stringWithCapacity_, capacity); - return NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithCharacters:length: - static NSMutableString stringWithCharacters_length_( - ffi.Pointer characters, int length) { - final _ret = _objc_msgSend_syhe4c(_class_NSMutableString, - _sel_stringWithCharacters_length_, characters, length); - return NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfFile:encoding:error: - static NSMutableString? stringWithContentsOfFile_encoding_error_( - NSString path, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( - _class_NSMutableString, - _sel_stringWithContentsOfFile_encoding_error_, - path.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfFile:usedEncoding:error: - static NSMutableString? stringWithContentsOfFile_usedEncoding_error_( - NSString path, - ffi.Pointer enc, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( - _class_NSMutableString, - _sel_stringWithContentsOfFile_usedEncoding_error_, - path.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfURL:encoding:error: - static NSMutableString? stringWithContentsOfURL_encoding_error_( - NSURL url, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( - _class_NSMutableString, - _sel_stringWithContentsOfURL_encoding_error_, - url.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfURL:usedEncoding:error: - static NSMutableString? stringWithContentsOfURL_usedEncoding_error_( - NSURL url, - ffi.Pointer enc, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( - _class_NSMutableString, - _sel_stringWithContentsOfURL_usedEncoding_error_, - url.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithFormat: - static NSMutableString stringWithFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableString, _sel_stringWithFormat_, format.ref.pointer); - return NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithString: - static NSMutableString stringWithString_(NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSMutableString, _sel_stringWithString_, string.ref.pointer); - return NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithUTF8String: - static NSMutableString? stringWithUTF8String_( - ffi.Pointer nullTerminatedCString) { - final _ret = _objc_msgSend_1og3t2d(_class_NSMutableString, - _sel_stringWithUTF8String_, nullTerminatedCString); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithValidatedFormat:validFormatSpecifiers:error: - static NSMutableString? - stringWithValidatedFormat_validFormatSpecifiers_error_( - NSString format, - NSString validFormatSpecifiers, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSMutableString, - _sel_stringWithValidatedFormat_validFormatSpecifiers_error_, - format.ref.pointer, - validFormatSpecifiers.ref.pointer, - error); - return _ret.address == 0 - ? null - : NSMutableString.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1( - _class_NSMutableString, _sel_supportsSecureCoding); - } -} - -/// NSNotification -class NSNotification extends NSObject { - NSNotification._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super.castFromPointer(pointer, retain: retain, release: release); - - /// Constructs a [NSNotification] that points to the same underlying object as [other]. - NSNotification.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); - - /// Constructs a [NSNotification] that wraps the given raw object pointer. - NSNotification.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); - - /// Returns whether [obj] is an instance of [NSNotification]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSNotification); - } - - /// alloc - static NSNotification alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNotification, _sel_alloc); - return NSNotification.castFromPointer(_ret, retain: false, release: true); - } - - /// allocWithZone: - static NSNotification allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSNotification, _sel_allocWithZone_, zone); - return NSNotification.castFromPointer(_ret, retain: false, release: true); - } - - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSNotification, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// autorelease - NSNotification autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSNotification.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); + /// encodeWithCoder: + void encodeWithCoder_(NSCoder coder) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } /// init NSNotification init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSNotification.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSNotification? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -6007,7 +4443,7 @@ class NSNotification extends NSObject { /// initWithName:object:userInfo: NSNotification initWithName_object_userInfo_( NSString name, objc.ObjCObjectBase? object, NSDictionary? userInfo) { - final _ret = _objc_msgSend_aud7dn( + final _ret = _objc_msgSend_582s3n( this.ref.retainAndReturnPointer(), _sel_initWithName_object_userInfo_, name.ref.pointer, @@ -6016,51 +4452,15 @@ class NSNotification extends NSObject { return NSNotification.castFromPointer(_ret, retain: false, release: true); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSNotification, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// name NSString get name { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_name); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_name); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// new - static NSNotification new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNotification, _sel_new); - return NSNotification.castFromPointer(_ret, retain: false, release: true); - } - - /// notificationWithName:object: - static NSNotification notificationWithName_object_( - NSString aName, objc.ObjCObjectBase? anObject) { - final _ret = _objc_msgSend_iq11qg( - _class_NSNotification, - _sel_notificationWithName_object_, - aName.ref.pointer, - anObject?.ref.pointer ?? ffi.nullptr); - return NSNotification.castFromPointer(_ret, retain: true, release: true); - } - - /// notificationWithName:object:userInfo: - static NSNotification notificationWithName_object_userInfo_( - NSString aName, objc.ObjCObjectBase? anObject, NSDictionary? aUserInfo) { - final _ret = _objc_msgSend_aud7dn( - _class_NSNotification, - _sel_notificationWithName_object_userInfo_, - aName.ref.pointer, - anObject?.ref.pointer ?? ffi.nullptr, - aUserInfo?.ref.pointer ?? ffi.nullptr); - return NSNotification.castFromPointer(_ret, retain: true, release: true); - } - /// object objc.ObjCObjectBase? get object { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_object); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_object); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); @@ -6068,19 +4468,19 @@ class NSNotification extends NSObject { /// retain NSNotification retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSNotification.castFromPointer(_ret, retain: true, release: true); } /// self NSNotification self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSNotification.castFromPointer(_ret, retain: true, release: true); } /// userInfo NSDictionary? get userInfo { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_userInfo); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_userInfo); return _ret.address == 0 ? null : NSDictionary.castFromPointer(_ret, retain: true, release: true); @@ -6104,49 +4504,54 @@ class NSNumber extends NSValue { /// Returns whether [obj] is an instance of [NSNumber]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSNumber); } /// alloc static NSNumber alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNumber, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSNumber, _sel_alloc); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSNumber allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSNumber, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSNumber, _sel_allocWithZone_, zone); + return NSNumber.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSNumber new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSNumber, _sel_new); return NSNumber.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSNumber, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSNumber, _sel_supportsSecureCoding); } /// boolValue bool get boolValue { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_boolValue); + return _objc_msgSend_91o635(this.ref.pointer, _sel_boolValue); } /// charValue int get charValue { - return _objc_msgSend_171owuh(this.ref.pointer, _sel_charValue); + return _objc_msgSend_xmlz1t(this.ref.pointer, _sel_charValue); } /// compare: NSComparisonResult compare_(NSNumber otherNumber) { - final _ret = _objc_msgSend_1ile2ev( + final _ret = _objc_msgSend_1wpduvy( this.ref.pointer, _sel_compare_, otherNumber.ref.pointer); return NSComparisonResult.fromValue(_ret); } /// descriptionWithLocale: NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); return NSString.castFromPointer(_ret, retain: true, release: true); } @@ -6154,27 +4559,27 @@ class NSNumber extends NSValue { /// doubleValue double get doubleValue { return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_doubleValue) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_doubleValue); + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_doubleValue) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_doubleValue); } /// floatValue double get floatValue { return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_floatValue) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_floatValue); + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_floatValue) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_floatValue); } /// init NSNumber init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithBool: NSNumber initWithBool_(bool value) { - final _ret = _objc_msgSend_1upz917( + final _ret = _objc_msgSend_1l3kbc1( this.ref.retainAndReturnPointer(), _sel_initWithBool_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } @@ -6182,21 +4587,21 @@ class NSNumber extends NSValue { /// initWithBytes:objCType: NSNumber initWithBytes_objCType_( ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_qtxoq7(this.ref.retainAndReturnPointer(), _sel_initWithBytes_objCType_, value, type); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithChar: NSNumber initWithChar_(int value) { - final _ret = _objc_msgSend_1pfmxrb( + final _ret = _objc_msgSend_vx1f2d( this.ref.retainAndReturnPointer(), _sel_initWithChar_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSNumber? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -6205,666 +4610,535 @@ class NSNumber extends NSValue { /// initWithDouble: NSNumber initWithDouble_(double value) { - final _ret = _objc_msgSend_m7jc8y( + final _ret = _objc_msgSend_1x911p2( this.ref.retainAndReturnPointer(), _sel_initWithDouble_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithFloat: NSNumber initWithFloat_(double value) { - final _ret = _objc_msgSend_1pmj399( + final _ret = _objc_msgSend_1f4qa0h( this.ref.retainAndReturnPointer(), _sel_initWithFloat_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithInt: NSNumber initWithInt_(int value) { - final _ret = _objc_msgSend_105o5we( + final _ret = _objc_msgSend_1a0iyvk( this.ref.retainAndReturnPointer(), _sel_initWithInt_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithInteger: NSNumber initWithInteger_(int value) { - final _ret = _objc_msgSend_crtxa9( + final _ret = _objc_msgSend_8o14b( this.ref.retainAndReturnPointer(), _sel_initWithInteger_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithLong: NSNumber initWithLong_(int value) { - final _ret = _objc_msgSend_crtxa9( + final _ret = _objc_msgSend_8o14b( this.ref.retainAndReturnPointer(), _sel_initWithLong_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithLongLong: NSNumber initWithLongLong_(int value) { - final _ret = _objc_msgSend_yjzv9z( + final _ret = _objc_msgSend_94zdgv( this.ref.retainAndReturnPointer(), _sel_initWithLongLong_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithShort: NSNumber initWithShort_(int value) { - final _ret = _objc_msgSend_15di41h( + final _ret = _objc_msgSend_cvzqr9( this.ref.retainAndReturnPointer(), _sel_initWithShort_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithUnsignedChar: NSNumber initWithUnsignedChar_(int value) { - final _ret = _objc_msgSend_1ar9f5m( + final _ret = _objc_msgSend_uzucl8( this.ref.retainAndReturnPointer(), _sel_initWithUnsignedChar_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithUnsignedInt: NSNumber initWithUnsignedInt_(int value) { - final _ret = _objc_msgSend_pxgym4( + final _ret = _objc_msgSend_12mhqtk( this.ref.retainAndReturnPointer(), _sel_initWithUnsignedInt_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithUnsignedInteger: NSNumber initWithUnsignedInteger_(int value) { - final _ret = _objc_msgSend_ehxl2g(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1qrcblu(this.ref.retainAndReturnPointer(), _sel_initWithUnsignedInteger_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithUnsignedLong: NSNumber initWithUnsignedLong_(int value) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( this.ref.retainAndReturnPointer(), _sel_initWithUnsignedLong_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithUnsignedLongLong: NSNumber initWithUnsignedLongLong_(int value) { - final _ret = _objc_msgSend_ybbscc(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_98pnic(this.ref.retainAndReturnPointer(), _sel_initWithUnsignedLongLong_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// initWithUnsignedShort: NSNumber initWithUnsignedShort_(int value) { - final _ret = _objc_msgSend_122gbai( + final _ret = _objc_msgSend_onx6bi( this.ref.retainAndReturnPointer(), _sel_initWithUnsignedShort_, value); return NSNumber.castFromPointer(_ret, retain: false, release: true); } /// intValue int get intValue { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_intValue); + return _objc_msgSend_13yqbb6(this.ref.pointer, _sel_intValue); } /// integerValue int get integerValue { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_integerValue); + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_integerValue); } /// isEqualToNumber: bool isEqualToNumber_(NSNumber number) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isEqualToNumber_, number.ref.pointer); } - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSNumber, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - /// longLongValue int get longLongValue { - return _objc_msgSend_e94jsr(this.ref.pointer, _sel_longLongValue); + return _objc_msgSend_1k101e3(this.ref.pointer, _sel_longLongValue); } /// longValue int get longValue { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_longValue); + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_longValue); } - /// new - static NSNumber new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSNumber, _sel_new); - return NSNumber.castFromPointer(_ret, retain: false, release: true); + /// shortValue + int get shortValue { + return _objc_msgSend_1jwityx(this.ref.pointer, _sel_shortValue); + } + + /// stringValue + NSString get stringValue { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_stringValue); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// unsignedCharValue + int get unsignedCharValue { + return _objc_msgSend_1ko4qka(this.ref.pointer, _sel_unsignedCharValue); + } + + /// unsignedIntValue + int get unsignedIntValue { + return _objc_msgSend_3pyzne(this.ref.pointer, _sel_unsignedIntValue); + } + + /// unsignedIntegerValue + int get unsignedIntegerValue { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_unsignedIntegerValue); } + /// unsignedLongLongValue + int get unsignedLongLongValue { + return _objc_msgSend_1p4gbjy(this.ref.pointer, _sel_unsignedLongLongValue); + } + + /// unsignedLongValue + int get unsignedLongValue { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_unsignedLongValue); + } + + /// unsignedShortValue + int get unsignedShortValue { + return _objc_msgSend_ud8gg(this.ref.pointer, _sel_unsignedShortValue); + } +} + +/// NSNumberCreation +extension NSNumberCreation on NSNumber { /// numberWithBool: static NSNumber numberWithBool_(bool value) { final _ret = - _objc_msgSend_1upz917(_class_NSNumber, _sel_numberWithBool_, value); + _objc_msgSend_1l3kbc1(_class_NSNumber, _sel_numberWithBool_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithChar: static NSNumber numberWithChar_(int value) { final _ret = - _objc_msgSend_1pfmxrb(_class_NSNumber, _sel_numberWithChar_, value); + _objc_msgSend_vx1f2d(_class_NSNumber, _sel_numberWithChar_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithDouble: static NSNumber numberWithDouble_(double value) { final _ret = - _objc_msgSend_m7jc8y(_class_NSNumber, _sel_numberWithDouble_, value); + _objc_msgSend_1x911p2(_class_NSNumber, _sel_numberWithDouble_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithFloat: static NSNumber numberWithFloat_(double value) { final _ret = - _objc_msgSend_1pmj399(_class_NSNumber, _sel_numberWithFloat_, value); + _objc_msgSend_1f4qa0h(_class_NSNumber, _sel_numberWithFloat_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithInt: static NSNumber numberWithInt_(int value) { final _ret = - _objc_msgSend_105o5we(_class_NSNumber, _sel_numberWithInt_, value); + _objc_msgSend_1a0iyvk(_class_NSNumber, _sel_numberWithInt_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithInteger: static NSNumber numberWithInteger_(int value) { final _ret = - _objc_msgSend_crtxa9(_class_NSNumber, _sel_numberWithInteger_, value); + _objc_msgSend_8o14b(_class_NSNumber, _sel_numberWithInteger_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithLong: static NSNumber numberWithLong_(int value) { final _ret = - _objc_msgSend_crtxa9(_class_NSNumber, _sel_numberWithLong_, value); + _objc_msgSend_8o14b(_class_NSNumber, _sel_numberWithLong_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithLongLong: static NSNumber numberWithLongLong_(int value) { final _ret = - _objc_msgSend_yjzv9z(_class_NSNumber, _sel_numberWithLongLong_, value); + _objc_msgSend_94zdgv(_class_NSNumber, _sel_numberWithLongLong_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithShort: static NSNumber numberWithShort_(int value) { final _ret = - _objc_msgSend_15di41h(_class_NSNumber, _sel_numberWithShort_, value); + _objc_msgSend_cvzqr9(_class_NSNumber, _sel_numberWithShort_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithUnsignedChar: static NSNumber numberWithUnsignedChar_(int value) { - final _ret = _objc_msgSend_1ar9f5m( + final _ret = _objc_msgSend_uzucl8( _class_NSNumber, _sel_numberWithUnsignedChar_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithUnsignedInt: static NSNumber numberWithUnsignedInt_(int value) { - final _ret = _objc_msgSend_pxgym4( + final _ret = _objc_msgSend_12mhqtk( _class_NSNumber, _sel_numberWithUnsignedInt_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithUnsignedInteger: static NSNumber numberWithUnsignedInteger_(int value) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSNumber, _sel_numberWithUnsignedInteger_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithUnsignedLong: static NSNumber numberWithUnsignedLong_(int value) { - final _ret = _objc_msgSend_ehxl2g( + final _ret = _objc_msgSend_1qrcblu( _class_NSNumber, _sel_numberWithUnsignedLong_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithUnsignedLongLong: static NSNumber numberWithUnsignedLongLong_(int value) { - final _ret = _objc_msgSend_ybbscc( + final _ret = _objc_msgSend_98pnic( _class_NSNumber, _sel_numberWithUnsignedLongLong_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } /// numberWithUnsignedShort: static NSNumber numberWithUnsignedShort_(int value) { - final _ret = _objc_msgSend_122gbai( + final _ret = _objc_msgSend_onx6bi( _class_NSNumber, _sel_numberWithUnsignedShort_, value); return NSNumber.castFromPointer(_ret, retain: true, release: true); } +} - /// shortValue - int get shortValue { - return _objc_msgSend_157j54x(this.ref.pointer, _sel_shortValue); - } +/// NSObject +class NSObject extends objc.ObjCObjectBase { + NSObject._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super(pointer, retain: retain, release: release); - /// stringValue - NSString get stringValue { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_stringValue); - return NSString.castFromPointer(_ret, retain: true, release: true); - } + /// Constructs a [NSObject] that points to the same underlying object as [other]. + NSObject.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSNumber, _sel_supportsSecureCoding); - } + /// Constructs a [NSObject] that wraps the given raw object pointer. + NSObject.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); - /// unsignedCharValue - int get unsignedCharValue { - return _objc_msgSend_1cswds(this.ref.pointer, _sel_unsignedCharValue); + /// Returns whether [obj] is an instance of [NSObject]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSObject); } - /// unsignedIntValue - int get unsignedIntValue { - return _objc_msgSend_dzloj4(this.ref.pointer, _sel_unsignedIntValue); + /// alloc + static NSObject alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSObject, _sel_alloc); + return NSObject.castFromPointer(_ret, retain: false, release: true); } - /// unsignedIntegerValue - int get unsignedIntegerValue { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_unsignedIntegerValue); - } - - /// unsignedLongLongValue - int get unsignedLongLongValue { - return _objc_msgSend_1cirwn8(this.ref.pointer, _sel_unsignedLongLongValue); + /// allocWithZone: + static NSObject allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSObject, _sel_allocWithZone_, zone); + return NSObject.castFromPointer(_ret, retain: false, release: true); } - /// unsignedLongValue - int get unsignedLongValue { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_unsignedLongValue); + /// class + static objc.ObjCObjectBase class1() { + final _ret = _objc_msgSend_1x359cv(_class_NSObject, _sel_class); + return objc.ObjCObjectBase(_ret, retain: true, release: true); } - /// unsignedShortValue - int get unsignedShortValue { - return _objc_msgSend_req28e(this.ref.pointer, _sel_unsignedShortValue); + /// conformsToProtocol: + static bool conformsToProtocol_(Protocol protocol) { + return _objc_msgSend_69e0x1( + _class_NSObject, _sel_conformsToProtocol_, protocol.ref.pointer); } - /// value:withObjCType: - static NSValue value_withObjCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSNumber, _sel_value_withObjCType_, value, type); - return NSValue.castFromPointer(_ret, retain: true, release: true); + /// copyWithZone: + static objc.ObjCObjectBase copyWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSObject, _sel_copyWithZone_, zone); + return objc.ObjCObjectBase(_ret, retain: false, release: true); } - /// valueWithBytes:objCType: - static NSValue valueWithBytes_objCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSNumber, _sel_valueWithBytes_objCType_, value, type); - return NSValue.castFromPointer(_ret, retain: true, release: true); + /// debugDescription + static NSString debugDescription() { + final _ret = _objc_msgSend_1x359cv(_class_NSObject, _sel_debugDescription); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// valueWithNonretainedObject: - static NSValue valueWithNonretainedObject_(objc.ObjCObjectBase? anObject) { - final _ret = _objc_msgSend_juohf7(_class_NSNumber, - _sel_valueWithNonretainedObject_, anObject?.ref.pointer ?? ffi.nullptr); - return NSValue.castFromPointer(_ret, retain: true, release: true); + /// description + static NSString description() { + final _ret = _objc_msgSend_1x359cv(_class_NSObject, _sel_description); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// valueWithPointer: - static NSValue valueWithPointer_(ffi.Pointer pointer) { - final _ret = - _objc_msgSend_1ph8ubj(_class_NSNumber, _sel_valueWithPointer_, pointer); - return NSValue.castFromPointer(_ret, retain: true, release: true); + /// hash + static int hash() { + return _objc_msgSend_xw2lbc(_class_NSObject, _sel_hash); } - /// valueWithRange: - static NSValue valueWithRange_(NSRange range) { - final _ret = - _objc_msgSend_176f8tz(_class_NSNumber, _sel_valueWithRange_, range); - return NSValue.castFromPointer(_ret, retain: true, release: true); + /// initialize + static void initialize() { + _objc_msgSend_1pl9qdv(_class_NSObject, _sel_initialize); } -} - -/// NSObject -class NSObject extends objc.ObjCObjectBase { - NSObject._(ffi.Pointer pointer, - {bool retain = false, bool release = false}) - : super(pointer, retain: retain, release: release); - /// Constructs a [NSObject] that points to the same underlying object as [other]. - NSObject.castFrom(objc.ObjCObjectBase other) - : this._(other.ref.pointer, retain: true, release: true); + /// instanceMethodForSelector: + static ffi.Pointer> + instanceMethodForSelector_(ffi.Pointer aSelector) { + return _objc_msgSend_1pa9f4m( + _class_NSObject, _sel_instanceMethodForSelector_, aSelector); + } - /// Constructs a [NSObject] that wraps the given raw object pointer. - NSObject.castFromPointer(ffi.Pointer other, - {bool retain = false, bool release = false}) - : this._(other, retain: retain, release: release); + /// instanceMethodSignatureForSelector: + static NSMethodSignature instanceMethodSignatureForSelector_( + ffi.Pointer aSelector) { + final _ret = _objc_msgSend_19hbqky( + _class_NSObject, _sel_instanceMethodSignatureForSelector_, aSelector); + return NSMethodSignature.castFromPointer(_ret, retain: true, release: true); + } - /// Returns whether [obj] is an instance of [NSObject]. - static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( - obj.ref.pointer, _sel_isKindOfClass_, _class_NSObject); + /// instancesRespondToSelector: + static bool instancesRespondToSelector_( + ffi.Pointer aSelector) { + return _objc_msgSend_1srf6wk( + _class_NSObject, _sel_instancesRespondToSelector_, aSelector); } - /// addObserver:forKeyPath:options:context: - void addObserver_forKeyPath_options_context_( - NSObject observer, - NSString keyPath, - NSKeyValueObservingOptions options, - ffi.Pointer context) { - _objc_msgSend_l8a843( - this.ref.pointer, - _sel_addObserver_forKeyPath_options_context_, - observer.ref.pointer, - keyPath.ref.pointer, - options.value, - context); + /// isSubclassOfClass: + static bool isSubclassOfClass_(objc.ObjCObjectBase aClass) { + return _objc_msgSend_69e0x1( + _class_NSObject, _sel_isSubclassOfClass_, aClass.ref.pointer); } - /// alloc - static NSObject alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSObject, _sel_alloc); - return NSObject.castFromPointer(_ret, retain: false, release: true); + /// load + static void load() { + _objc_msgSend_1pl9qdv(_class_NSObject, _sel_load); } - /// allocWithZone: - static NSObject allocWithZone_(ffi.Pointer<_NSZone> zone) { + /// mutableCopyWithZone: + static objc.ObjCObjectBase mutableCopyWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSObject, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSObject, _sel_mutableCopyWithZone_, zone); + return objc.ObjCObjectBase(_ret, retain: false, release: true); + } + + /// new + static NSObject new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSObject, _sel_new); return NSObject.castFromPointer(_ret, retain: false, release: true); } - /// attemptRecoveryFromError:optionIndex: - bool attemptRecoveryFromError_optionIndex_( - NSError error, int recoveryOptionIndex) { - return _objc_msgSend_1hjrbws( - this.ref.pointer, - _sel_attemptRecoveryFromError_optionIndex_, - error.ref.pointer, - recoveryOptionIndex); - } - - /// attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo: - void - attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo_( - NSError error, - int recoveryOptionIndex, - objc.ObjCObjectBase? delegate, - ffi.Pointer didRecoverSelector, - ffi.Pointer contextInfo) { - _objc_msgSend_1xz4izt( - this.ref.pointer, - _sel_attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo_, - error.ref.pointer, - recoveryOptionIndex, - delegate?.ref.pointer ?? ffi.nullptr, - didRecoverSelector, - contextInfo); + /// resolveClassMethod: + static bool resolveClassMethod_(ffi.Pointer sel) { + return _objc_msgSend_1srf6wk( + _class_NSObject, _sel_resolveClassMethod_, sel); } - /// autoContentAccessingProxy - objc.ObjCObjectBase get autoContentAccessingProxy { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autoContentAccessingProxy); - return objc.ObjCObjectBase(_ret, retain: true, release: true); + /// resolveInstanceMethod: + static bool resolveInstanceMethod_(ffi.Pointer sel) { + return _objc_msgSend_1srf6wk( + _class_NSObject, _sel_resolveInstanceMethod_, sel); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSObject, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// superclass + static objc.ObjCObjectBase superclass() { + final _ret = _objc_msgSend_1x359cv(_class_NSObject, _sel_superclass); + return objc.ObjCObjectBase(_ret, retain: true, release: true); } /// autorelease NSObject autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return NSObject.castFromPointer(_ret, retain: true, release: true); } - /// awakeAfterUsingCoder: - objc.ObjCObjectBase? awakeAfterUsingCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), - _sel_awakeAfterUsingCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: false, release: true); - } - /// class - objc.ObjCObjectBase class1() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_class); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// classForCoder - objc.ObjCObjectBase get classForCoder { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_classForCoder); + objc.ObjCObjectBase class2() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_class); return objc.ObjCObjectBase(_ret, retain: true, release: true); } /// conformsToProtocol: - bool conformsToProtocol_(Protocol aProtocol) { - return _objc_msgSend_l8lotg( + bool conformsToProtocol_1(Protocol aProtocol) { + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_conformsToProtocol_, aProtocol.ref.pointer); } /// copy objc.ObjCObjectBase copy() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_copy); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// copyWithZone: - static objc.ObjCObjectBase copyWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSObject, _sel_copyWithZone_, zone); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_copy); return objc.ObjCObjectBase(_ret, retain: false, release: true); } /// dealloc void dealloc() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_dealloc); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_dealloc); } /// debugDescription - NSString debugDescription() { - if (!objc.respondsToSelector(ref.pointer, _sel_debugDescription)) { + NSString get debugDescription1 { + if (!objc.respondsToSelector(this.ref.pointer, _sel_debugDescription)) { throw objc.UnimplementedOptionalMethodException( 'NSObject', 'debugDescription'); } - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_debugDescription); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_debugDescription); return NSString.castFromPointer(_ret, retain: true, release: true); } /// description - static NSString description() { - final _ret = _objc_msgSend_1unuoxw(_class_NSObject, _sel_description); + NSString get description1 { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// didChange:valuesAtIndexes:forKey: - void didChange_valuesAtIndexes_forKey_( - NSKeyValueChange changeKind, NSIndexSet indexes, NSString key) { - _objc_msgSend_ujfhr( - this.ref.pointer, - _sel_didChange_valuesAtIndexes_forKey_, - changeKind.value, - indexes.ref.pointer, - key.ref.pointer); - } - - /// didChangeValueForKey: - void didChangeValueForKey_(NSString key) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_didChangeValueForKey_, key.ref.pointer); - } - - /// didChangeValueForKey:withSetMutation:usingObjects: - void didChangeValueForKey_withSetMutation_usingObjects_( - NSString key, NSKeyValueSetMutationKind mutationKind, NSSet objects) { - _objc_msgSend_129zzcm( - this.ref.pointer, - _sel_didChangeValueForKey_withSetMutation_usingObjects_, - key.ref.pointer, - mutationKind.value, - objects.ref.pointer); - } - /// doesNotRecognizeSelector: void doesNotRecognizeSelector_(ffi.Pointer aSelector) { - _objc_msgSend_5ns8s6( + _objc_msgSend_1d9e4oe( this.ref.pointer, _sel_doesNotRecognizeSelector_, aSelector); } /// forwardInvocation: void forwardInvocation_(NSInvocation anInvocation) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_forwardInvocation_, anInvocation.ref.pointer); } /// forwardingTargetForSelector: objc.ObjCObjectBase forwardingTargetForSelector_( ffi.Pointer aSelector) { - final _ret = _objc_msgSend_12790oz( + final _ret = _objc_msgSend_19hbqky( this.ref.pointer, _sel_forwardingTargetForSelector_, aSelector); return objc.ObjCObjectBase(_ret, retain: true, release: true); } /// hash - static int hash() { - return _objc_msgSend_eldhrq(_class_NSObject, _sel_hash); + int get hash1 { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_hash); } /// init NSObject init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSObject.castFromPointer(_ret, retain: false, release: true); } - /// initialize - static void initialize() { - _objc_msgSend_ksby9f(_class_NSObject, _sel_initialize); - } - - /// instanceMethodForSelector: - static ffi.Pointer> - instanceMethodForSelector_(ffi.Pointer aSelector) { - return _objc_msgSend_nbaahq( - _class_NSObject, _sel_instanceMethodForSelector_, aSelector); - } - - /// instanceMethodSignatureForSelector: - static NSMethodSignature instanceMethodSignatureForSelector_( - ffi.Pointer aSelector) { - final _ret = _objc_msgSend_12790oz( - _class_NSObject, _sel_instanceMethodSignatureForSelector_, aSelector); - return NSMethodSignature.castFromPointer(_ret, retain: true, release: true); - } - - /// instancesRespondToSelector: - static bool instancesRespondToSelector_( - ffi.Pointer aSelector) { - return _objc_msgSend_8d7dvc( - _class_NSObject, _sel_instancesRespondToSelector_, aSelector); - } - /// isEqual: bool isEqual_(objc.ObjCObjectBase object) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isEqual_, object.ref.pointer); } /// isKindOfClass: bool isKindOfClass_(objc.ObjCObjectBase aClass) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isKindOfClass_, aClass.ref.pointer); } /// isMemberOfClass: bool isMemberOfClass_(objc.ObjCObjectBase aClass) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isMemberOfClass_, aClass.ref.pointer); } /// isProxy bool isProxy() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isProxy); - } - - /// isSubclassOfClass: - static bool isSubclassOfClass_(objc.ObjCObjectBase aClass) { - return _objc_msgSend_l8lotg( - _class_NSObject, _sel_isSubclassOfClass_, aClass.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSObject, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// load - static void load() { - _objc_msgSend_ksby9f(_class_NSObject, _sel_load); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isProxy); } /// methodForSelector: ffi.Pointer> methodForSelector_( ffi.Pointer aSelector) { - return _objc_msgSend_nbaahq( + return _objc_msgSend_1pa9f4m( this.ref.pointer, _sel_methodForSelector_, aSelector); } /// methodSignatureForSelector: NSMethodSignature methodSignatureForSelector_( ffi.Pointer aSelector) { - final _ret = _objc_msgSend_12790oz( + final _ret = _objc_msgSend_19hbqky( this.ref.pointer, _sel_methodSignatureForSelector_, aSelector); return NSMethodSignature.castFromPointer(_ret, retain: true, release: true); } /// mutableCopy objc.ObjCObjectBase mutableCopy() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_mutableCopy); - return objc.ObjCObjectBase(_ret, retain: false, release: true); - } - - /// mutableCopyWithZone: - static objc.ObjCObjectBase mutableCopyWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = - _objc_msgSend_1b3ihd0(_class_NSObject, _sel_mutableCopyWithZone_, zone); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_mutableCopy); return objc.ObjCObjectBase(_ret, retain: false, release: true); } - /// new - static NSObject new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSObject, _sel_new); - return NSObject.castFromPointer(_ret, retain: false, release: true); - } - - /// observationInfo - ffi.Pointer get observationInfo { - return _objc_msgSend_1578rxt(this.ref.pointer, _sel_observationInfo); - } - - /// observeValueForKeyPath:ofObject:change:context: - void observeValueForKeyPath_ofObject_change_context_( - NSString? keyPath, - objc.ObjCObjectBase? object, - NSDictionary? change, - ffi.Pointer context) { - _objc_msgSend_laogel( - this.ref.pointer, - _sel_observeValueForKeyPath_ofObject_change_context_, - keyPath?.ref.pointer ?? ffi.nullptr, - object?.ref.pointer ?? ffi.nullptr, - change?.ref.pointer ?? ffi.nullptr, - context); - } - /// performSelector: objc.ObjCObjectBase performSelector_( ffi.Pointer aSelector) { - final _ret = _objc_msgSend_12790oz( + final _ret = _objc_msgSend_19hbqky( this.ref.pointer, _sel_performSelector_, aSelector); return objc.ObjCObjectBase(_ret, retain: true, release: true); } @@ -6872,7 +5146,7 @@ class NSObject extends objc.ObjCObjectBase { /// performSelector:withObject: objc.ObjCObjectBase performSelector_withObject_( ffi.Pointer aSelector, objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_1g3ang8(this.ref.pointer, + final _ret = _objc_msgSend_1wlgx7q(this.ref.pointer, _sel_performSelector_withObject_, aSelector, object.ref.pointer); return objc.ObjCObjectBase(_ret, retain: true, release: true); } @@ -6882,7 +5156,7 @@ class NSObject extends objc.ObjCObjectBase { ffi.Pointer aSelector, objc.ObjCObjectBase object1, objc.ObjCObjectBase object2) { - final _ret = _objc_msgSend_1f2tuqz( + final _ret = _objc_msgSend_189974q( this.ref.pointer, _sel_performSelector_withObject_withObject_, aSelector, @@ -6893,122 +5167,178 @@ class NSObject extends objc.ObjCObjectBase { /// release void release() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_release); - } - - /// removeObserver:forKeyPath: - void removeObserver_forKeyPath_(NSObject observer, NSString keyPath) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeObserver_forKeyPath_, - observer.ref.pointer, keyPath.ref.pointer); - } - - /// removeObserver:forKeyPath:context: - void removeObserver_forKeyPath_context_( - NSObject observer, NSString keyPath, ffi.Pointer context) { - _objc_msgSend_sk5ilc( - this.ref.pointer, - _sel_removeObserver_forKeyPath_context_, - observer.ref.pointer, - keyPath.ref.pointer, - context); - } - - /// replacementObjectForCoder: - objc.ObjCObjectBase? replacementObjectForCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_replacementObjectForCoder_, coder.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// resolveClassMethod: - static bool resolveClassMethod_(ffi.Pointer sel) { - return _objc_msgSend_8d7dvc(_class_NSObject, _sel_resolveClassMethod_, sel); - } - - /// resolveInstanceMethod: - static bool resolveInstanceMethod_(ffi.Pointer sel) { - return _objc_msgSend_8d7dvc( - _class_NSObject, _sel_resolveInstanceMethod_, sel); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_release); } /// respondsToSelector: bool respondsToSelector_(ffi.Pointer aSelector) { - return _objc_msgSend_8d7dvc( + return _objc_msgSend_1srf6wk( this.ref.pointer, _sel_respondsToSelector_, aSelector); } /// retain NSObject retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSObject.castFromPointer(_ret, retain: true, release: true); } /// retainCount int retainCount() { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_retainCount); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_retainCount); } /// self NSObject self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSObject.castFromPointer(_ret, retain: true, release: true); } - /// setObservationInfo: - set observationInfo(ffi.Pointer value) { - return _objc_msgSend_hepzs( - this.ref.pointer, _sel_setObservationInfo_, value); + /// superclass + objc.ObjCObjectBase get superclass1 { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_superclass); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// zone + ffi.Pointer<_NSZone> zone() { + return _objc_msgSend_sz90oi(this.ref.pointer, _sel_zone); } +} + +/// NSOrderedCollectionDifference +class NSOrderedCollectionDifference extends NSObject { + NSOrderedCollectionDifference._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); - /// setVersion: - static void setVersion_(int aVersion) { - _objc_msgSend_ke7qz2(_class_NSObject, _sel_setVersion_, aVersion); + /// Constructs a [NSOrderedCollectionDifference] that points to the same underlying object as [other]. + NSOrderedCollectionDifference.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSOrderedCollectionDifference] that wraps the given raw object pointer. + NSOrderedCollectionDifference.castFromPointer( + ffi.Pointer other, + {bool retain = false, + bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSOrderedCollectionDifference]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1(obj.ref.pointer, _sel_isKindOfClass_, + _class_NSOrderedCollectionDifference); } - /// superclass - objc.ObjCObjectBase superclass() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_superclass); - return objc.ObjCObjectBase(_ret, retain: true, release: true); + /// alloc + static NSOrderedCollectionDifference alloc() { + final _ret = + _objc_msgSend_1x359cv(_class_NSOrderedCollectionDifference, _sel_alloc); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); } - /// version - static int version() { - return _objc_msgSend_z1fx1b(_class_NSObject, _sel_version); + /// allocWithZone: + static NSOrderedCollectionDifference allocWithZone_( + ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSOrderedCollectionDifference, _sel_allocWithZone_, zone); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); } - /// willChange:valuesAtIndexes:forKey: - void willChange_valuesAtIndexes_forKey_( - NSKeyValueChange changeKind, NSIndexSet indexes, NSString key) { - _objc_msgSend_ujfhr( - this.ref.pointer, - _sel_willChange_valuesAtIndexes_forKey_, - changeKind.value, - indexes.ref.pointer, - key.ref.pointer); + /// new + static NSOrderedCollectionDifference new1() { + final _ret = + _objc_msgSend_1x359cv(_class_NSOrderedCollectionDifference, _sel_new); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); } - /// willChangeValueForKey: - void willChangeValueForKey_(NSString key) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_willChangeValueForKey_, key.ref.pointer); + /// countByEnumeratingWithState:objects:count: + int countByEnumeratingWithState_objects_count_( + ffi.Pointer state, + ffi.Pointer> buffer, + int len) { + return _objc_msgSend_1b5ysjl(this.ref.pointer, + _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); } - /// willChangeValueForKey:withSetMutation:usingObjects: - void willChangeValueForKey_withSetMutation_usingObjects_( - NSString key, NSKeyValueSetMutationKind mutationKind, NSSet objects) { - _objc_msgSend_129zzcm( - this.ref.pointer, - _sel_willChangeValueForKey_withSetMutation_usingObjects_, - key.ref.pointer, - mutationKind.value, - objects.ref.pointer); + /// hasChanges + bool get hasChanges { + return _objc_msgSend_91o635(this.ref.pointer, _sel_hasChanges); } - /// zone - ffi.Pointer<_NSZone> zone() { - return _objc_msgSend_j04r6g(this.ref.pointer, _sel_zone); + /// init + NSOrderedCollectionDifference init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithChanges: + NSOrderedCollectionDifference initWithChanges_(objc.ObjCObjectBase changes) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithChanges_, changes.ref.pointer); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects: + NSOrderedCollectionDifference + initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_( + NSIndexSet inserts, + objc.ObjCObjectBase? insertedObjects, + NSIndexSet removes, + objc.ObjCObjectBase? removedObjects) { + final _ret = _objc_msgSend_1ghpoap( + this.ref.retainAndReturnPointer(), + _sel_initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_, + inserts.ref.pointer, + insertedObjects?.ref.pointer ?? ffi.nullptr, + removes.ref.pointer, + removedObjects?.ref.pointer ?? ffi.nullptr); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:additionalChanges: + NSOrderedCollectionDifference + initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_additionalChanges_( + NSIndexSet inserts, + objc.ObjCObjectBase? insertedObjects, + NSIndexSet removes, + objc.ObjCObjectBase? removedObjects, + objc.ObjCObjectBase changes) { + final _ret = _objc_msgSend_1aoxlyn( + this.ref.retainAndReturnPointer(), + _sel_initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_additionalChanges_, + inserts.ref.pointer, + insertedObjects?.ref.pointer ?? ffi.nullptr, + removes.ref.pointer, + removedObjects?.ref.pointer ?? ffi.nullptr, + changes.ref.pointer); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: false, release: true); + } + + /// insertions + objc.ObjCObjectBase get insertions { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_insertions); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// inverseDifference + NSOrderedCollectionDifference inverseDifference() { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_inverseDifference); + return NSOrderedCollectionDifference.castFromPointer(_ret, + retain: true, release: true); + } + + /// removals + objc.ObjCObjectBase get removals { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_removals); + return objc.ObjCObjectBase(_ret, retain: true, release: true); } } @@ -7047,162 +5377,164 @@ class NSOrderedSet extends NSObject { /// Returns whether [obj] is an instance of [NSOrderedSet]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSOrderedSet); } - /// addObserver:forKeyPath:options:context: - void addObserver_forKeyPath_options_context_( - NSObject observer, - NSString keyPath, - NSKeyValueObservingOptions options, - ffi.Pointer context) { - _objc_msgSend_l8a843( - this.ref.pointer, - _sel_addObserver_forKeyPath_options_context_, - observer.ref.pointer, - keyPath.ref.pointer, - options.value, - context); - } - /// alloc static NSOrderedSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrderedSet, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSOrderedSet, _sel_alloc); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSOrderedSet allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSOrderedSet, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSOrderedSet, _sel_allocWithZone_, zone); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } - /// array - NSArray get array { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_array); - return NSArray.castFromPointer(_ret, retain: true, release: true); + /// new + static NSOrderedSet new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSOrderedSet, _sel_new); + return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSOrderedSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// orderedSet + static NSOrderedSet orderedSet() { + final _ret = _objc_msgSend_1x359cv(_class_NSOrderedSet, _sel_orderedSet); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// autorelease - NSOrderedSet autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + /// orderedSetWithArray: + static NSOrderedSet orderedSetWithArray_(NSArray array) { + final _ret = _objc_msgSend_62nh5j( + _class_NSOrderedSet, _sel_orderedSetWithArray_, array.ref.pointer); return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// containsObject: - bool containsObject_(objc.ObjCObjectBase object) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_containsObject_, object.ref.pointer); + /// orderedSetWithArray:range:copyItems: + static NSOrderedSet orderedSetWithArray_range_copyItems_( + NSArray array, NSRange range, bool flag) { + final _ret = _objc_msgSend_1cqd8wl( + _class_NSOrderedSet, + _sel_orderedSetWithArray_range_copyItems_, + array.ref.pointer, + range, + flag); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// count - int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); + /// orderedSetWithObject: + static NSOrderedSet orderedSetWithObject_(objc.ObjCObjectBase object) { + final _ret = _objc_msgSend_62nh5j( + _class_NSOrderedSet, _sel_orderedSetWithObject_, object.ref.pointer); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// countByEnumeratingWithState:objects:count: - int countByEnumeratingWithState_objects_count_( - ffi.Pointer state, - ffi.Pointer> buffer, - int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, - _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); + /// orderedSetWithObjects: + static NSOrderedSet orderedSetWithObjects_(objc.ObjCObjectBase firstObj) { + final _ret = _objc_msgSend_62nh5j( + _class_NSOrderedSet, _sel_orderedSetWithObjects_, firstObj.ref.pointer); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// orderedSetWithObjects:count: + static NSOrderedSet orderedSetWithObjects_count_( + ffi.Pointer> objects, int cnt) { + final _ret = _objc_msgSend_1lqqdvl( + _class_NSOrderedSet, _sel_orderedSetWithObjects_count_, objects, cnt); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// descriptionWithLocale: - NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// orderedSetWithOrderedSet: + static NSOrderedSet orderedSetWithOrderedSet_(NSOrderedSet set) { + final _ret = _objc_msgSend_62nh5j( + _class_NSOrderedSet, _sel_orderedSetWithOrderedSet_, set.ref.pointer); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// descriptionWithLocale:indent: - NSString descriptionWithLocale_indent_( - objc.ObjCObjectBase? locale, int level) { - final _ret = _objc_msgSend_183c8xv( - this.ref.pointer, - _sel_descriptionWithLocale_indent_, - locale?.ref.pointer ?? ffi.nullptr, - level); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// orderedSetWithOrderedSet:range:copyItems: + static NSOrderedSet orderedSetWithOrderedSet_range_copyItems_( + NSOrderedSet set, NSRange range, bool flag) { + final _ret = _objc_msgSend_1cqd8wl( + _class_NSOrderedSet, + _sel_orderedSetWithOrderedSet_range_copyItems_, + set.ref.pointer, + range, + flag); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// differenceFromOrderedSet: - objc.ObjCObjectBase differenceFromOrderedSet_(NSOrderedSet other) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_differenceFromOrderedSet_, other.ref.pointer); - return objc.ObjCObjectBase(_ret, retain: true, release: true); + /// orderedSetWithSet: + static NSOrderedSet orderedSetWithSet_(objc.ObjCObjectBase set) { + final _ret = _objc_msgSend_62nh5j( + _class_NSOrderedSet, _sel_orderedSetWithSet_, set.ref.pointer); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// differenceFromOrderedSet:withOptions: - objc.ObjCObjectBase differenceFromOrderedSet_withOptions_(NSOrderedSet other, - NSOrderedCollectionDifferenceCalculationOptions options) { - final _ret = _objc_msgSend_17fkh4i( - this.ref.pointer, - _sel_differenceFromOrderedSet_withOptions_, - other.ref.pointer, - options.value); - return objc.ObjCObjectBase(_ret, retain: true, release: true); + /// orderedSetWithSet:copyItems: + static NSOrderedSet orderedSetWithSet_copyItems_( + objc.ObjCObjectBase set, bool flag) { + final _ret = _objc_msgSend_1bdmr5f(_class_NSOrderedSet, + _sel_orderedSetWithSet_copyItems_, set.ref.pointer, flag); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - /// encodeWithCoder: - void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSOrderedSet, _sel_supportsSecureCoding); } - /// firstObject - objc.ObjCObjectBase? get firstObject { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_firstObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); + /// autorelease + NSOrderedSet autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); + } + + /// count + int get count { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_count); + } + + /// countByEnumeratingWithState:objects:count: + int countByEnumeratingWithState_objects_count_( + ffi.Pointer state, + ffi.Pointer> buffer, + int len) { + return _objc_msgSend_1b5ysjl(this.ref.pointer, + _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); } - /// getObjects:range: - void getObjects_range_( - ffi.Pointer> objects, NSRange range) { - _objc_msgSend_1j6yja6( - this.ref.pointer, _sel_getObjects_range_, objects, range); + /// encodeWithCoder: + void encodeWithCoder_(NSCoder coder) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } /// indexOfObject: int indexOfObject_(objc.ObjCObjectBase object) { - return _objc_msgSend_eymsul( + return _objc_msgSend_1p4b7x4( this.ref.pointer, _sel_indexOfObject_, object.ref.pointer); } /// init NSOrderedSet init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithArray: NSOrderedSet initWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithArray_, array.ref.pointer); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithArray:copyItems: NSOrderedSet initWithArray_copyItems_(NSArray set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithArray_copyItems_, set.ref.pointer, flag); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } @@ -7210,14 +5542,14 @@ class NSOrderedSet extends NSObject { /// initWithArray:range:copyItems: NSOrderedSet initWithArray_range_copyItems_( NSArray set, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1cqd8wl(this.ref.retainAndReturnPointer(), _sel_initWithArray_range_copyItems_, set.ref.pointer, range, flag); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSOrderedSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -7226,14 +5558,14 @@ class NSOrderedSet extends NSObject { /// initWithObject: NSOrderedSet initWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObject_, object.ref.pointer); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithObjects: NSOrderedSet initWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjects_, firstObj.ref.pointer); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } @@ -7241,21 +5573,21 @@ class NSOrderedSet extends NSObject { /// initWithObjects:count: NSOrderedSet initWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1lqqdvl(this.ref.retainAndReturnPointer(), _sel_initWithObjects_count_, objects, cnt); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithOrderedSet: NSOrderedSet initWithOrderedSet_(NSOrderedSet set) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithOrderedSet_, set.ref.pointer); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithOrderedSet:copyItems: NSOrderedSet initWithOrderedSet_copyItems_(NSOrderedSet set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithOrderedSet_copyItems_, set.ref.pointer, flag); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } @@ -7263,247 +5595,43 @@ class NSOrderedSet extends NSObject { /// initWithOrderedSet:range:copyItems: NSOrderedSet initWithOrderedSet_range_copyItems_( NSOrderedSet set, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1cqd8wl(this.ref.retainAndReturnPointer(), _sel_initWithOrderedSet_range_copyItems_, set.ref.pointer, range, flag); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithSet: NSOrderedSet initWithSet_(objc.ObjCObjectBase set) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.retainAndReturnPointer(), _sel_initWithSet_, set.ref.pointer); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } /// initWithSet:copyItems: NSOrderedSet initWithSet_copyItems_(objc.ObjCObjectBase set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithSet_copyItems_, set.ref.pointer, flag); return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); } - /// intersectsOrderedSet: - bool intersectsOrderedSet_(NSOrderedSet other) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_intersectsOrderedSet_, other.ref.pointer); - } - - /// intersectsSet: - bool intersectsSet_(objc.ObjCObjectBase set) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_intersectsSet_, set.ref.pointer); - } - - /// isEqualToOrderedSet: - bool isEqualToOrderedSet_(NSOrderedSet other) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToOrderedSet_, other.ref.pointer); - } - - /// isSubsetOfOrderedSet: - bool isSubsetOfOrderedSet_(NSOrderedSet other) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isSubsetOfOrderedSet_, other.ref.pointer); - } - - /// isSubsetOfSet: - bool isSubsetOfSet_(objc.ObjCObjectBase set) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isSubsetOfSet_, set.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSOrderedSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// lastObject - objc.ObjCObjectBase? get lastObject { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_lastObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// new - static NSOrderedSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrderedSet, _sel_new); - return NSOrderedSet.castFromPointer(_ret, retain: false, release: true); - } - /// objectAtIndex: objc.ObjCObjectBase objectAtIndex_(int idx) { final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_objectAtIndex_, idx); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// objectAtIndexedSubscript: - objc.ObjCObjectBase objectAtIndexedSubscript_(int idx) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_objectAtIndexedSubscript_, idx); + _objc_msgSend_1qrcblu(this.ref.pointer, _sel_objectAtIndex_, idx); return objc.ObjCObjectBase(_ret, retain: true, release: true); } - /// objectEnumerator - NSEnumerator objectEnumerator() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectEnumerator); - return NSEnumerator.castFromPointer(_ret, retain: true, release: true); - } - - /// objectsAtIndexes: - NSArray objectsAtIndexes_(NSIndexSet indexes) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_objectsAtIndexes_, indexes.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSet - static NSOrderedSet orderedSet() { - final _ret = _objc_msgSend_1unuoxw(_class_NSOrderedSet, _sel_orderedSet); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetByApplyingDifference: - NSOrderedSet? orderedSetByApplyingDifference_( - objc.ObjCObjectBase difference) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_orderedSetByApplyingDifference_, difference.ref.pointer); - return _ret.address == 0 - ? null - : NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithArray: - static NSOrderedSet orderedSetWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7( - _class_NSOrderedSet, _sel_orderedSetWithArray_, array.ref.pointer); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithArray:range:copyItems: - static NSOrderedSet orderedSetWithArray_range_copyItems_( - NSArray array, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3( - _class_NSOrderedSet, - _sel_orderedSetWithArray_range_copyItems_, - array.ref.pointer, - range, - flag); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithObject: - static NSOrderedSet orderedSetWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7( - _class_NSOrderedSet, _sel_orderedSetWithObject_, object.ref.pointer); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithObjects: - static NSOrderedSet orderedSetWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7( - _class_NSOrderedSet, _sel_orderedSetWithObjects_, firstObj.ref.pointer); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithObjects:count: - static NSOrderedSet orderedSetWithObjects_count_( - ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es( - _class_NSOrderedSet, _sel_orderedSetWithObjects_count_, objects, cnt); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithOrderedSet: - static NSOrderedSet orderedSetWithOrderedSet_(NSOrderedSet set) { - final _ret = _objc_msgSend_juohf7( - _class_NSOrderedSet, _sel_orderedSetWithOrderedSet_, set.ref.pointer); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithOrderedSet:range:copyItems: - static NSOrderedSet orderedSetWithOrderedSet_range_copyItems_( - NSOrderedSet set, NSRange range, bool flag) { - final _ret = _objc_msgSend_hyhdx3( - _class_NSOrderedSet, - _sel_orderedSetWithOrderedSet_range_copyItems_, - set.ref.pointer, - range, - flag); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithSet: - static NSOrderedSet orderedSetWithSet_(objc.ObjCObjectBase set) { - final _ret = _objc_msgSend_juohf7( - _class_NSOrderedSet, _sel_orderedSetWithSet_, set.ref.pointer); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// orderedSetWithSet:copyItems: - static NSOrderedSet orderedSetWithSet_copyItems_( - objc.ObjCObjectBase set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(_class_NSOrderedSet, - _sel_orderedSetWithSet_copyItems_, set.ref.pointer, flag); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// removeObserver:forKeyPath: - void removeObserver_forKeyPath_(NSObject observer, NSString keyPath) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeObserver_forKeyPath_, - observer.ref.pointer, keyPath.ref.pointer); - } - - /// removeObserver:forKeyPath:context: - void removeObserver_forKeyPath_context_( - NSObject observer, NSString keyPath, ffi.Pointer context) { - _objc_msgSend_sk5ilc( - this.ref.pointer, - _sel_removeObserver_forKeyPath_context_, - observer.ref.pointer, - keyPath.ref.pointer, - context); - } - /// retain NSOrderedSet retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); - return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); - } - - /// reverseObjectEnumerator - NSEnumerator reverseObjectEnumerator() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reverseObjectEnumerator); - return NSEnumerator.castFromPointer(_ret, retain: true, release: true); - } - - /// reversedOrderedSet - NSOrderedSet get reversedOrderedSet { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_reversedOrderedSet); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } /// self NSOrderedSet self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSOrderedSet.castFromPointer(_ret, retain: true, release: true); } - - /// set - objc.ObjCObjectBase get set1 { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_set); - return objc.ObjCObjectBase(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSOrderedSet, _sel_supportsSecureCoding); - } } /// NSOutputStream @@ -7523,54 +5651,59 @@ class NSOutputStream extends NSStream { /// Returns whether [obj] is an instance of [NSOutputStream]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSOutputStream); } - /// getBoundStreamsWithBufferSize:inputStream:outputStream: - static void getBoundStreamsWithBufferSize_inputStream_outputStream_( - int bufferSize, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_5r8xlx( - _class_NSOutputStream, - _sel_getBoundStreamsWithBufferSize_inputStream_outputStream_, - bufferSize, - inputStream, - outputStream); - } - - /// getStreamsToHostWithName:port:inputStream:outputStream: - static void getStreamsToHostWithName_port_inputStream_outputStream_( - NSString hostname, - int port, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_imc4v7( - _class_NSOutputStream, - _sel_getStreamsToHostWithName_port_inputStream_outputStream_, - hostname.ref.pointer, - port, - inputStream, - outputStream); + /// outputStreamToBuffer:capacity: + static NSOutputStream outputStreamToBuffer_capacity_( + ffi.Pointer buffer, int capacity) { + final _ret = _objc_msgSend_7ukip1(_class_NSOutputStream, + _sel_outputStreamToBuffer_capacity_, buffer, capacity); + return NSOutputStream.castFromPointer(_ret, retain: true, release: true); } - /// hasSpaceAvailable - bool get hasSpaceAvailable { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasSpaceAvailable); + /// outputStreamToFileAtPath:append: + static NSOutputStream outputStreamToFileAtPath_append_( + NSString path, bool shouldAppend) { + final _ret = _objc_msgSend_1bdmr5f(_class_NSOutputStream, + _sel_outputStreamToFileAtPath_append_, path.ref.pointer, shouldAppend); + return NSOutputStream.castFromPointer(_ret, retain: true, release: true); } - /// initToBuffer:capacity: - NSOutputStream initToBuffer_capacity_( - ffi.Pointer buffer, int capacity) { - final _ret = _objc_msgSend_pblopu(this.ref.retainAndReturnPointer(), - _sel_initToBuffer_capacity_, buffer, capacity); - return NSOutputStream.castFromPointer(_ret, retain: false, release: true); + /// outputStreamToMemory + static NSOutputStream outputStreamToMemory() { + final _ret = + _objc_msgSend_1x359cv(_class_NSOutputStream, _sel_outputStreamToMemory); + return NSOutputStream.castFromPointer(_ret, retain: true, release: true); } - /// initToFileAtPath:append: - NSOutputStream? initToFileAtPath_append_(NSString path, bool shouldAppend) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + /// outputStreamWithURL:append: + static NSOutputStream? outputStreamWithURL_append_( + NSURL url, bool shouldAppend) { + final _ret = _objc_msgSend_1bdmr5f(_class_NSOutputStream, + _sel_outputStreamWithURL_append_, url.ref.pointer, shouldAppend); + return _ret.address == 0 + ? null + : NSOutputStream.castFromPointer(_ret, retain: true, release: true); + } + + /// hasSpaceAvailable + bool get hasSpaceAvailable { + return _objc_msgSend_91o635(this.ref.pointer, _sel_hasSpaceAvailable); + } + + /// initToBuffer:capacity: + NSOutputStream initToBuffer_capacity_( + ffi.Pointer buffer, int capacity) { + final _ret = _objc_msgSend_7ukip1(this.ref.retainAndReturnPointer(), + _sel_initToBuffer_capacity_, buffer, capacity); + return NSOutputStream.castFromPointer(_ret, retain: false, release: true); + } + + /// initToFileAtPath:append: + NSOutputStream? initToFileAtPath_append_(NSString path, bool shouldAppend) { + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initToFileAtPath_append_, path.ref.pointer, shouldAppend); return _ret.address == 0 ? null @@ -7579,56 +5712,23 @@ class NSOutputStream extends NSStream { /// initToMemory NSOutputStream initToMemory() { - final _ret = _objc_msgSend_1unuoxw( + final _ret = _objc_msgSend_1x359cv( this.ref.retainAndReturnPointer(), _sel_initToMemory); return NSOutputStream.castFromPointer(_ret, retain: false, release: true); } /// initWithURL:append: NSOutputStream? initWithURL_append_(NSURL url, bool shouldAppend) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithURL_append_, url.ref.pointer, shouldAppend); return _ret.address == 0 ? null : NSOutputStream.castFromPointer(_ret, retain: false, release: true); } - /// outputStreamToBuffer:capacity: - static NSOutputStream outputStreamToBuffer_capacity_( - ffi.Pointer buffer, int capacity) { - final _ret = _objc_msgSend_pblopu(_class_NSOutputStream, - _sel_outputStreamToBuffer_capacity_, buffer, capacity); - return NSOutputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// outputStreamToFileAtPath:append: - static NSOutputStream outputStreamToFileAtPath_append_( - NSString path, bool shouldAppend) { - final _ret = _objc_msgSend_qqbb5y(_class_NSOutputStream, - _sel_outputStreamToFileAtPath_append_, path.ref.pointer, shouldAppend); - return NSOutputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// outputStreamToMemory - static NSOutputStream outputStreamToMemory() { - final _ret = - _objc_msgSend_1unuoxw(_class_NSOutputStream, _sel_outputStreamToMemory); - return NSOutputStream.castFromPointer(_ret, retain: true, release: true); - } - - /// outputStreamWithURL:append: - static NSOutputStream? outputStreamWithURL_append_( - NSURL url, bool shouldAppend) { - final _ret = _objc_msgSend_qqbb5y(_class_NSOutputStream, - _sel_outputStreamWithURL_append_, url.ref.pointer, shouldAppend); - return _ret.address == 0 - ? null - : NSOutputStream.castFromPointer(_ret, retain: true, release: true); - } - /// write:maxLength: int write_maxLength_(ffi.Pointer buffer, int len) { - return _objc_msgSend_1wopcqf( + return _objc_msgSend_11e9f5x( this.ref.pointer, _sel_write_maxLength_, buffer, len); } } @@ -7650,90 +5750,96 @@ class NSProxy extends objc.ObjCObjectBase { /// Returns whether [obj] is an instance of [NSProxy]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSProxy); } /// alloc static objc.ObjCObjectBase alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProxy, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSProxy, _sel_alloc); return objc.ObjCObjectBase(_ret, retain: false, release: true); } /// allocWithZone: static objc.ObjCObjectBase allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSProxy, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSProxy, _sel_allocWithZone_, zone); return objc.ObjCObjectBase(_ret, retain: false, release: true); } - /// autorelease - NSProxy autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); - return NSProxy.castFromPointer(_ret, retain: true, release: true); - } - /// class static objc.ObjCObjectBase class1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSProxy, _sel_class); + final _ret = _objc_msgSend_1x359cv(_class_NSProxy, _sel_class); return objc.ObjCObjectBase(_ret, retain: true, release: true); } + /// respondsToSelector: + static bool respondsToSelector_(ffi.Pointer aSelector) { + return _objc_msgSend_1srf6wk( + _class_NSProxy, _sel_respondsToSelector_, aSelector); + } + + /// autorelease + NSProxy autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSProxy.castFromPointer(_ret, retain: true, release: true); + } + /// dealloc void dealloc() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_dealloc); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_dealloc); } /// debugDescription NSString get debugDescription { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_debugDescription); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_debugDescription); return NSString.castFromPointer(_ret, retain: true, release: true); } /// description NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); return NSString.castFromPointer(_ret, retain: true, release: true); } /// finalize void finalize() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_finalize); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_finalize); } /// forwardInvocation: void forwardInvocation_(NSInvocation invocation) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_forwardInvocation_, invocation.ref.pointer); } /// isEqual: bool isEqual_(objc.ObjCObjectBase object) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isEqual_, object.ref.pointer); } /// isKindOfClass: bool isKindOfClass_(objc.ObjCObjectBase aClass) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isKindOfClass_, aClass.ref.pointer); } /// isMemberOfClass: bool isMemberOfClass_(objc.ObjCObjectBase aClass) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( this.ref.pointer, _sel_isMemberOfClass_, aClass.ref.pointer); } /// isProxy bool isProxy() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isProxy); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isProxy); } /// methodSignatureForSelector: NSMethodSignature? methodSignatureForSelector_( ffi.Pointer sel) { - final _ret = _objc_msgSend_12790oz( + final _ret = _objc_msgSend_19hbqky( this.ref.pointer, _sel_methodSignatureForSelector_, sel); return _ret.address == 0 ? null @@ -7743,7 +5849,7 @@ class NSProxy extends objc.ObjCObjectBase { /// performSelector: objc.ObjCObjectBase performSelector_( ffi.Pointer aSelector) { - final _ret = _objc_msgSend_12790oz( + final _ret = _objc_msgSend_19hbqky( this.ref.pointer, _sel_performSelector_, aSelector); return objc.ObjCObjectBase(_ret, retain: true, release: true); } @@ -7751,7 +5857,7 @@ class NSProxy extends objc.ObjCObjectBase { /// performSelector:withObject: objc.ObjCObjectBase performSelector_withObject_( ffi.Pointer aSelector, objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_1g3ang8(this.ref.pointer, + final _ret = _objc_msgSend_1wlgx7q(this.ref.pointer, _sel_performSelector_withObject_, aSelector, object.ref.pointer); return objc.ObjCObjectBase(_ret, retain: true, release: true); } @@ -7761,7 +5867,7 @@ class NSProxy extends objc.ObjCObjectBase { ffi.Pointer aSelector, objc.ObjCObjectBase object1, objc.ObjCObjectBase object2) { - final _ret = _objc_msgSend_1f2tuqz( + final _ret = _objc_msgSend_189974q( this.ref.pointer, _sel_performSelector_withObject_withObject_, aSelector, @@ -7772,35 +5878,29 @@ class NSProxy extends objc.ObjCObjectBase { /// release void release() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_release); - } - - /// respondsToSelector: - static bool respondsToSelector_(ffi.Pointer aSelector) { - return _objc_msgSend_8d7dvc( - _class_NSProxy, _sel_respondsToSelector_, aSelector); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_release); } /// retain NSProxy retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSProxy.castFromPointer(_ret, retain: true, release: true); } /// retainCount int retainCount() { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_retainCount); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_retainCount); } /// self NSProxy self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSProxy.castFromPointer(_ret, retain: true, release: true); } /// zone ffi.Pointer<_NSZone> zone() { - return _objc_msgSend_j04r6g(this.ref.pointer, _sel_zone); + return _objc_msgSend_sz90oi(this.ref.pointer, _sel_zone); } } @@ -7829,7 +5929,7 @@ class NSRunLoop extends objc.ObjCObjectBase { /// Returns whether [obj] is an instance of [NSRunLoop]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSRunLoop); } } @@ -7851,66 +5951,78 @@ class NSSet extends NSObject { /// Returns whether [obj] is an instance of [NSSet]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSSet); } - /// addObserver:forKeyPath:options:context: - void addObserver_forKeyPath_options_context_( - NSObject observer, - NSString keyPath, - NSKeyValueObservingOptions options, - ffi.Pointer context) { - _objc_msgSend_l8a843( - this.ref.pointer, - _sel_addObserver_forKeyPath_options_context_, - observer.ref.pointer, - keyPath.ref.pointer, - options.value, - context); - } - - /// allObjects - NSArray get allObjects { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_allObjects); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// alloc static NSSet alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSSet, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSSet, _sel_alloc); return NSSet.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSSet allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0(_class_NSSet, _sel_allocWithZone_, zone); + final _ret = _objc_msgSend_hzlb60(_class_NSSet, _sel_allocWithZone_, zone); return NSSet.castFromPointer(_ret, retain: false, release: true); } - /// anyObject - objc.ObjCObjectBase? anyObject() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_anyObject); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); + /// new + static NSSet new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSSet, _sel_new); + return NSSet.castFromPointer(_ret, retain: false, release: true); + } + + /// set + static NSSet set1() { + final _ret = _objc_msgSend_1x359cv(_class_NSSet, _sel_set); + return NSSet.castFromPointer(_ret, retain: true, release: true); + } + + /// setWithArray: + static NSSet setWithArray_(NSArray array) { + final _ret = _objc_msgSend_62nh5j( + _class_NSSet, _sel_setWithArray_, array.ref.pointer); + return NSSet.castFromPointer(_ret, retain: true, release: true); + } + + /// setWithObject: + static NSSet setWithObject_(objc.ObjCObjectBase object) { + final _ret = _objc_msgSend_62nh5j( + _class_NSSet, _sel_setWithObject_, object.ref.pointer); + return NSSet.castFromPointer(_ret, retain: true, release: true); + } + + /// setWithObjects: + static NSSet setWithObjects_(objc.ObjCObjectBase firstObj) { + final _ret = _objc_msgSend_62nh5j( + _class_NSSet, _sel_setWithObjects_, firstObj.ref.pointer); + return NSSet.castFromPointer(_ret, retain: true, release: true); + } + + /// setWithObjects:count: + static NSSet setWithObjects_count_( + ffi.Pointer> objects, int cnt) { + final _ret = _objc_msgSend_1lqqdvl( + _class_NSSet, _sel_setWithObjects_count_, objects, cnt); + return NSSet.castFromPointer(_ret, retain: true, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSSet, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// setWithSet: + static NSSet setWithSet_(NSSet set) { + final _ret = + _objc_msgSend_62nh5j(_class_NSSet, _sel_setWithSet_, set.ref.pointer); + return NSSet.castFromPointer(_ret, retain: true, release: true); } - /// containsObject: - bool containsObject_(objc.ObjCObjectBase anObject) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_containsObject_, anObject.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSSet, _sel_supportsSecureCoding); } /// count int get count { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_count); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_count); } /// countByEnumeratingWithState:objects:count: @@ -7918,46 +6030,33 @@ class NSSet extends NSObject { ffi.Pointer state, ffi.Pointer> buffer, int len) { - return _objc_msgSend_q12f7y(this.ref.pointer, + return _objc_msgSend_1b5ysjl(this.ref.pointer, _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); } - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// descriptionWithLocale: - NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } /// init NSSet init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSSet.castFromPointer(_ret, retain: false, release: true); } /// initWithArray: NSSet initWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithArray_, array.ref.pointer); return NSSet.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSSet? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -7966,7 +6065,7 @@ class NSSet extends NSObject { /// initWithObjects: NSSet initWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithObjects_, firstObj.ref.pointer); return NSSet.castFromPointer(_ret, retain: false, release: true); } @@ -7974,171 +6073,39 @@ class NSSet extends NSObject { /// initWithObjects:count: NSSet initWithObjects_count_( ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1lqqdvl(this.ref.retainAndReturnPointer(), _sel_initWithObjects_count_, objects, cnt); return NSSet.castFromPointer(_ret, retain: false, release: true); } /// initWithSet: NSSet initWithSet_(NSSet set) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.retainAndReturnPointer(), _sel_initWithSet_, set.ref.pointer); return NSSet.castFromPointer(_ret, retain: false, release: true); } /// initWithSet:copyItems: NSSet initWithSet_copyItems_(NSSet set, bool flag) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initWithSet_copyItems_, set.ref.pointer, flag); return NSSet.castFromPointer(_ret, retain: false, release: true); } - /// intersectsSet: - bool intersectsSet_(NSSet otherSet) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_intersectsSet_, otherSet.ref.pointer); - } - - /// isEqualToSet: - bool isEqualToSet_(NSSet otherSet) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToSet_, otherSet.ref.pointer); - } - - /// isSubsetOfSet: - bool isSubsetOfSet_(NSSet otherSet) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isSubsetOfSet_, otherSet.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSSet, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// makeObjectsPerformSelector: - void makeObjectsPerformSelector_(ffi.Pointer aSelector) { - _objc_msgSend_5ns8s6( - this.ref.pointer, _sel_makeObjectsPerformSelector_, aSelector); - } - - /// makeObjectsPerformSelector:withObject: - void makeObjectsPerformSelector_withObject_( - ffi.Pointer aSelector, objc.ObjCObjectBase? argument) { - _objc_msgSend_1x7hfdx( - this.ref.pointer, - _sel_makeObjectsPerformSelector_withObject_, - aSelector, - argument?.ref.pointer ?? ffi.nullptr); - } - /// member: objc.ObjCObjectBase? member_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.pointer, _sel_member_, object.ref.pointer); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); } - /// new - static NSSet new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSSet, _sel_new); - return NSSet.castFromPointer(_ret, retain: false, release: true); - } - /// objectEnumerator NSEnumerator objectEnumerator() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_objectEnumerator); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_objectEnumerator); return NSEnumerator.castFromPointer(_ret, retain: true, release: true); } - - /// removeObserver:forKeyPath: - void removeObserver_forKeyPath_(NSObject observer, NSString keyPath) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeObserver_forKeyPath_, - observer.ref.pointer, keyPath.ref.pointer); - } - - /// removeObserver:forKeyPath:context: - void removeObserver_forKeyPath_context_( - NSObject observer, NSString keyPath, ffi.Pointer context) { - _objc_msgSend_sk5ilc( - this.ref.pointer, - _sel_removeObserver_forKeyPath_context_, - observer.ref.pointer, - keyPath.ref.pointer, - context); - } - - /// set - static NSSet set1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSSet, _sel_set); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setByAddingObject: - NSSet setByAddingObject_(objc.ObjCObjectBase anObject) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_setByAddingObject_, anObject.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setByAddingObjectsFromArray: - NSSet setByAddingObjectsFromArray_(NSArray other) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_setByAddingObjectsFromArray_, other.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setByAddingObjectsFromSet: - NSSet setByAddingObjectsFromSet_(NSSet other) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, _sel_setByAddingObjectsFromSet_, other.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithArray: - static NSSet setWithArray_(NSArray array) { - final _ret = _objc_msgSend_juohf7( - _class_NSSet, _sel_setWithArray_, array.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithObject: - static NSSet setWithObject_(objc.ObjCObjectBase object) { - final _ret = _objc_msgSend_juohf7( - _class_NSSet, _sel_setWithObject_, object.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithObjects: - static NSSet setWithObjects_(objc.ObjCObjectBase firstObj) { - final _ret = _objc_msgSend_juohf7( - _class_NSSet, _sel_setWithObjects_, firstObj.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithObjects:count: - static NSSet setWithObjects_count_( - ffi.Pointer> objects, int cnt) { - final _ret = _objc_msgSend_2n95es( - _class_NSSet, _sel_setWithObjects_count_, objects, cnt); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// setWithSet: - static NSSet setWithSet_(NSSet set) { - final _ret = - _objc_msgSend_juohf7(_class_NSSet, _sel_setWithSet_, set.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSSet, _sel_supportsSecureCoding); - } } enum NSSortOptions { @@ -8172,104 +6139,63 @@ class NSStream extends NSObject { /// Returns whether [obj] is an instance of [NSStream]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSStream); } /// alloc static NSStream alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSStream, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSStream, _sel_alloc); return NSStream.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSStream allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSStream, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSStream, _sel_allocWithZone_, zone); return NSStream.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSStream, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static NSStream new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSStream, _sel_new); + return NSStream.castFromPointer(_ret, retain: false, release: true); } /// autorelease NSStream autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return NSStream.castFromPointer(_ret, retain: true, release: true); } /// close void close() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_close); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_close); } /// delegate objc.ObjCObjectBase? get delegate { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_delegate); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_delegate); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); } - /// getBoundStreamsWithBufferSize:inputStream:outputStream: - static void getBoundStreamsWithBufferSize_inputStream_outputStream_( - int bufferSize, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_5r8xlx( - _class_NSStream, - _sel_getBoundStreamsWithBufferSize_inputStream_outputStream_, - bufferSize, - inputStream, - outputStream); - } - - /// getStreamsToHostWithName:port:inputStream:outputStream: - static void getStreamsToHostWithName_port_inputStream_outputStream_( - NSString hostname, - int port, - ffi.Pointer> inputStream, - ffi.Pointer> outputStream) { - _objc_msgSend_imc4v7( - _class_NSStream, - _sel_getStreamsToHostWithName_port_inputStream_outputStream_, - hostname.ref.pointer, - port, - inputStream, - outputStream); - } - /// init NSStream init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSStream.castFromPointer(_ret, retain: false, release: true); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSStream, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSStream new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSStream, _sel_new); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSStream.castFromPointer(_ret, retain: false, release: true); } /// open void open() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_open); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_open); } /// propertyForKey: objc.ObjCObjectBase? propertyForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.pointer, _sel_propertyForKey_, key.ref.pointer); return _ret.address == 0 ? null @@ -8278,43 +6204,43 @@ class NSStream extends NSObject { /// removeFromRunLoop:forMode: void removeFromRunLoop_forMode_(NSRunLoop aRunLoop, NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_removeFromRunLoop_forMode_, + _objc_msgSend_wjvic9(this.ref.pointer, _sel_removeFromRunLoop_forMode_, aRunLoop.ref.pointer, mode.ref.pointer); } /// retain NSStream retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSStream.castFromPointer(_ret, retain: true, release: true); } /// scheduleInRunLoop:forMode: void scheduleInRunLoop_forMode_(NSRunLoop aRunLoop, NSString mode) { - _objc_msgSend_1tjlcwl(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, + _objc_msgSend_wjvic9(this.ref.pointer, _sel_scheduleInRunLoop_forMode_, aRunLoop.ref.pointer, mode.ref.pointer); } /// self NSStream self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSStream.castFromPointer(_ret, retain: true, release: true); } /// setDelegate: set delegate(objc.ObjCObjectBase? value) { - return _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); } /// setProperty:forKey: bool setProperty_forKey_(objc.ObjCObjectBase? property, NSString key) { - return _objc_msgSend_1ywe6ev(this.ref.pointer, _sel_setProperty_forKey_, + return _objc_msgSend_1lqxdg3(this.ref.pointer, _sel_setProperty_forKey_, property?.ref.pointer ?? ffi.nullptr, key.ref.pointer); } /// streamError NSError? get streamError { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_streamError); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_streamError); return _ret.address == 0 ? null : NSError.castFromPointer(_ret, retain: true, release: true); @@ -8322,7 +6248,7 @@ class NSStream extends NSObject { /// streamStatus NSStreamStatus get streamStatus { - final _ret = _objc_msgSend_1pu7ifu(this.ref.pointer, _sel_streamStatus); + final _ret = _objc_msgSend_1efxbd8(this.ref.pointer, _sel_streamStatus); return NSStreamStatus.fromValue(_ret); } } @@ -8370,6 +6296,7 @@ abstract final class NSStreamDelegate { /// stream:handleEvent: static final stream_handleEvent_ = objc.ObjCProtocolListenableMethod( + _protocol_NSStreamDelegate, _sel_stream_handleEvent_, objc.getProtocolMethodSignature( _protocol_NSStreamDelegate, @@ -8467,363 +6394,270 @@ class NSString extends NSObject { /// Returns whether [obj] is an instance of [NSString]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSString); } - /// UTF8String - ffi.Pointer get UTF8String { - return _objc_msgSend_1ypnhm3(this.ref.pointer, _sel_UTF8String); - } - /// alloc static NSString alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSString, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSString, _sel_alloc); return NSString.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSString allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSString, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSString, _sel_allocWithZone_, zone); return NSString.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSString, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// availableStringEncodings - static ffi.Pointer getAvailableStringEncodings() { - return _objc_msgSend_gvd36k(_class_NSString, _sel_availableStringEncodings); - } - - /// boolValue - bool get boolValue { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_boolValue); + /// localizedStringWithFormat: + static NSString localizedStringWithFormat_(NSString format) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_localizedStringWithFormat_, format.ref.pointer); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// cStringUsingEncoding: - ffi.Pointer cStringUsingEncoding_(int encoding) { - return _objc_msgSend_1o478a1( - this.ref.pointer, _sel_cStringUsingEncoding_, encoding); + /// localizedStringWithValidatedFormat:validFormatSpecifiers:error: + static NSString? + localizedStringWithValidatedFormat_validFormatSpecifiers_error_( + NSString format, + NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSString, + _sel_localizedStringWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// canBeConvertedToEncoding: - bool canBeConvertedToEncoding_(int encoding) { - return _objc_msgSend_91rfyn( - this.ref.pointer, _sel_canBeConvertedToEncoding_, encoding); + /// new + static NSString new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSString, _sel_new); + return NSString.castFromPointer(_ret, retain: false, release: true); } - /// capitalizedString - NSString get capitalizedString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_capitalizedString); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// objectWithItemProviderData:typeIdentifier:error: + static NSString? objectWithItemProviderData_typeIdentifier_error_( + NSData data, + NSString typeIdentifier, + ffi.Pointer> outError) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSString, + _sel_objectWithItemProviderData_typeIdentifier_error_, + data.ref.pointer, + typeIdentifier.ref.pointer, + outError); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// capitalizedStringWithLocale: - NSString capitalizedStringWithLocale_(NSLocale? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_capitalizedStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + /// string + static NSString string() { + final _ret = _objc_msgSend_1x359cv(_class_NSString, _sel_string); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// caseInsensitiveCompare: - NSComparisonResult caseInsensitiveCompare_(NSString string) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_caseInsensitiveCompare_, string.ref.pointer); - return NSComparisonResult.fromValue(_ret); - } - - /// characterAtIndex: - int characterAtIndex_(int index) { - return _objc_msgSend_fnfvai( - this.ref.pointer, _sel_characterAtIndex_, index); + /// stringWithCString:encoding: + static NSString? stringWithCString_encoding_( + ffi.Pointer cString, int enc) { + final _ret = _objc_msgSend_a15xhc( + _class_NSString, _sel_stringWithCString_encoding_, cString, enc); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// commonPrefixWithString:options: - NSString commonPrefixWithString_options_( - NSString str, NSStringCompareOptions mask) { - final _ret = _objc_msgSend_h8mnav(this.ref.pointer, - _sel_commonPrefixWithString_options_, str.ref.pointer, mask.value); + /// stringWithCharacters:length: + static NSString stringWithCharacters_length_( + ffi.Pointer characters, int length) { + final _ret = _objc_msgSend_13z9dkp( + _class_NSString, _sel_stringWithCharacters_length_, characters, length); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// compare: - NSComparisonResult compare_(NSString string) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_compare_, string.ref.pointer); - return NSComparisonResult.fromValue(_ret); - } - - /// compare:options: - NSComparisonResult compare_options_( - NSString string, NSStringCompareOptions mask) { - final _ret = _objc_msgSend_1e32dnv(this.ref.pointer, _sel_compare_options_, - string.ref.pointer, mask.value); - return NSComparisonResult.fromValue(_ret); + /// stringWithContentsOfFile:encoding:error: + static NSString? stringWithContentsOfFile_encoding_error_( + NSString path, int enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + _class_NSString, + _sel_stringWithContentsOfFile_encoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// compare:options:range: - NSComparisonResult compare_options_range_(NSString string, - NSStringCompareOptions mask, NSRange rangeOfReceiverToCompare) { - final _ret = _objc_msgSend_mhn4k( - this.ref.pointer, - _sel_compare_options_range_, - string.ref.pointer, - mask.value, - rangeOfReceiverToCompare); - return NSComparisonResult.fromValue(_ret); + /// stringWithContentsOfFile:usedEncoding:error: + static NSString? stringWithContentsOfFile_usedEncoding_error_( + NSString path, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + _class_NSString, + _sel_stringWithContentsOfFile_usedEncoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// compare:options:range:locale: - NSComparisonResult compare_options_range_locale_( - NSString string, - NSStringCompareOptions mask, - NSRange rangeOfReceiverToCompare, - objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_884p6v( - this.ref.pointer, - _sel_compare_options_range_locale_, - string.ref.pointer, - mask.value, - rangeOfReceiverToCompare, - locale?.ref.pointer ?? ffi.nullptr); - return NSComparisonResult.fromValue(_ret); + /// stringWithContentsOfURL:encoding:error: + static NSString? stringWithContentsOfURL_encoding_error_( + NSURL url, int enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + _class_NSString, + _sel_stringWithContentsOfURL_encoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// componentsSeparatedByCharactersInSet: - NSArray componentsSeparatedByCharactersInSet_(NSCharacterSet separator) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_componentsSeparatedByCharactersInSet_, separator.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); + /// stringWithContentsOfURL:usedEncoding:error: + static NSString? stringWithContentsOfURL_usedEncoding_error_( + NSURL url, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + _class_NSString, + _sel_stringWithContentsOfURL_usedEncoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// componentsSeparatedByString: - NSArray componentsSeparatedByString_(NSString separator) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_componentsSeparatedByString_, separator.ref.pointer); - return NSArray.castFromPointer(_ret, retain: true, release: true); + /// stringWithFormat: + static NSString stringWithFormat_(NSString format) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_stringWithFormat_, format.ref.pointer); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// containsString: - bool containsString_(NSString str) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_containsString_, str.ref.pointer); + /// stringWithString: + static NSString stringWithString_(NSString string) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_stringWithString_, string.ref.pointer); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// dataUsingEncoding: - NSData? dataUsingEncoding_(int encoding) { - final _ret = _objc_msgSend_ehxl2g( - this.ref.pointer, _sel_dataUsingEncoding_, encoding); + /// stringWithUTF8String: + static NSString? stringWithUTF8String_( + ffi.Pointer nullTerminatedCString) { + final _ret = _objc_msgSend_rqwdif( + _class_NSString, _sel_stringWithUTF8String_, nullTerminatedCString); return _ret.address == 0 ? null - : NSData.castFromPointer(_ret, retain: true, release: true); + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// dataUsingEncoding:allowLossyConversion: - NSData? dataUsingEncoding_allowLossyConversion_(int encoding, bool lossy) { - final _ret = _objc_msgSend_1btrt37(this.ref.pointer, - _sel_dataUsingEncoding_allowLossyConversion_, encoding, lossy); + /// stringWithValidatedFormat:validFormatSpecifiers:error: + static NSString? stringWithValidatedFormat_validFormatSpecifiers_error_( + NSString format, + NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSString, + _sel_stringWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); return _ret.address == 0 ? null - : NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// decomposedStringWithCanonicalMapping - NSString get decomposedStringWithCanonicalMapping { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_decomposedStringWithCanonicalMapping); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// decomposedStringWithCompatibilityMapping - NSString get decomposedStringWithCompatibilityMapping { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_decomposedStringWithCompatibilityMapping); - return NSString.castFromPointer(_ret, retain: true, release: true); + : NSString.castFromPointer(_ret, retain: true, release: true); } - /// defaultCStringEncoding - static int getDefaultCStringEncoding() { - return _objc_msgSend_eldhrq(_class_NSString, _sel_defaultCStringEncoding); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSString, _sel_supportsSecureCoding); } - /// description - NSString get description { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_description); + /// autorelease + NSString autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// doubleValue - double get doubleValue { - return objc.useMsgSendVariants - ? _objc_msgSend_10noklmFpret(this.ref.pointer, _sel_doubleValue) - : _objc_msgSend_10noklm(this.ref.pointer, _sel_doubleValue); + /// characterAtIndex: + int characterAtIndex_(int index) { + return _objc_msgSend_1deg8x( + this.ref.pointer, _sel_characterAtIndex_, index); } /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } - /// fastestEncoding - int get fastestEncoding { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_fastestEncoding); + /// init + NSString init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSString.castFromPointer(_ret, retain: false, release: true); } - /// floatValue - double get floatValue { - return objc.useMsgSendVariants - ? _objc_msgSend_fcilgxFpret(this.ref.pointer, _sel_floatValue) - : _objc_msgSend_fcilgx(this.ref.pointer, _sel_floatValue); + /// initWithBytes:length:encoding: + NSString? initWithBytes_length_encoding_( + ffi.Pointer bytes, int len, int encoding) { + final _ret = _objc_msgSend_i38ton(this.ref.retainAndReturnPointer(), + _sel_initWithBytes_length_encoding_, bytes, len, encoding); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: false, release: true); } - /// getBytes:maxLength:usedLength:encoding:options:range:remainingRange: - bool getBytes_maxLength_usedLength_encoding_options_range_remainingRange_( - ffi.Pointer buffer, - int maxBufferCount, - ffi.Pointer usedBufferCount, - int encoding, - NSStringEncodingConversionOptions options, - NSRange range, - ffi.Pointer leftover) { - return _objc_msgSend_q7zjde( - this.ref.pointer, - _sel_getBytes_maxLength_usedLength_encoding_options_range_remainingRange_, - buffer, - maxBufferCount, - usedBufferCount, + /// initWithBytesNoCopy:length:encoding:freeWhenDone: + NSString? initWithBytesNoCopy_length_encoding_freeWhenDone_( + ffi.Pointer bytes, int len, int encoding, bool freeBuffer) { + final _ret = _objc_msgSend_o2ktnn( + this.ref.retainAndReturnPointer(), + _sel_initWithBytesNoCopy_length_encoding_freeWhenDone_, + bytes, + len, encoding, - options.value, - range, - leftover); + freeBuffer); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: false, release: true); } - /// getCString:maxLength:encoding: - bool getCString_maxLength_encoding_( - ffi.Pointer buffer, int maxBufferCount, int encoding) { - return _objc_msgSend_j97tz8(this.ref.pointer, - _sel_getCString_maxLength_encoding_, buffer, maxBufferCount, encoding); + /// initWithCString:encoding: + NSString? initWithCString_encoding_( + ffi.Pointer nullTerminatedCString, int encoding) { + final _ret = _objc_msgSend_a15xhc(this.ref.retainAndReturnPointer(), + _sel_initWithCString_encoding_, nullTerminatedCString, encoding); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: false, release: true); } - /// getCharacters: - void getCharacters_(ffi.Pointer buffer) { - _objc_msgSend_brmmwn(this.ref.pointer, _sel_getCharacters_, buffer); - } - - /// getCharacters:range: - void getCharacters_range_( - ffi.Pointer buffer, NSRange range) { - _objc_msgSend_18qbbjk( - this.ref.pointer, _sel_getCharacters_range_, buffer, range); - } - - /// getLineStart:end:contentsEnd:forRange: - void getLineStart_end_contentsEnd_forRange_( - ffi.Pointer startPtr, - ffi.Pointer lineEndPtr, - ffi.Pointer contentsEndPtr, - NSRange range) { - _objc_msgSend_6s6aog( - this.ref.pointer, - _sel_getLineStart_end_contentsEnd_forRange_, - startPtr, - lineEndPtr, - contentsEndPtr, - range); - } - - /// getParagraphStart:end:contentsEnd:forRange: - void getParagraphStart_end_contentsEnd_forRange_( - ffi.Pointer startPtr, - ffi.Pointer parEndPtr, - ffi.Pointer contentsEndPtr, - NSRange range) { - _objc_msgSend_6s6aog( - this.ref.pointer, - _sel_getParagraphStart_end_contentsEnd_forRange_, - startPtr, - parEndPtr, - contentsEndPtr, - range); - } - - /// hasPrefix: - bool hasPrefix_(NSString str) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasPrefix_, str.ref.pointer); - } - - /// hasSuffix: - bool hasSuffix_(NSString str) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_hasSuffix_, str.ref.pointer); - } - - /// hash - int get hash { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_hash); - } - - /// init - NSString init() { - final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSString.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithBytes:length:encoding: - NSString? initWithBytes_length_encoding_( - ffi.Pointer bytes, int len, int encoding) { - final _ret = _objc_msgSend_1ea4mhr(this.ref.retainAndReturnPointer(), - _sel_initWithBytes_length_encoding_, bytes, len, encoding); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithBytesNoCopy:length:encoding:freeWhenDone: - NSString? initWithBytesNoCopy_length_encoding_freeWhenDone_( - ffi.Pointer bytes, int len, int encoding, bool freeBuffer) { - final _ret = _objc_msgSend_1idnlsy( - this.ref.retainAndReturnPointer(), - _sel_initWithBytesNoCopy_length_encoding_freeWhenDone_, - bytes, - len, - encoding, - freeBuffer); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCString:encoding: - NSString? initWithCString_encoding_( - ffi.Pointer nullTerminatedCString, int encoding) { - final _ret = _objc_msgSend_1t5rcq1(this.ref.retainAndReturnPointer(), - _sel_initWithCString_encoding_, nullTerminatedCString, encoding); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: false, release: true); - } - - /// initWithCharacters:length: - NSString initWithCharacters_length_( - ffi.Pointer characters, int length) { - final _ret = _objc_msgSend_syhe4c(this.ref.retainAndReturnPointer(), - _sel_initWithCharacters_length_, characters, length); - return NSString.castFromPointer(_ret, retain: false, release: true); + /// initWithCharacters:length: + NSString initWithCharacters_length_( + ffi.Pointer characters, int length) { + final _ret = _objc_msgSend_13z9dkp(this.ref.retainAndReturnPointer(), + _sel_initWithCharacters_length_, characters, length); + return NSString.castFromPointer(_ret, retain: false, release: true); } /// initWithCharactersNoCopy:length:freeWhenDone: NSString initWithCharactersNoCopy_length_freeWhenDone_( ffi.Pointer characters, int length, bool freeBuffer) { - final _ret = _objc_msgSend_1rimh2f( + final _ret = _objc_msgSend_zsd8q9( this.ref.retainAndReturnPointer(), _sel_initWithCharactersNoCopy_length_freeWhenDone_, characters, @@ -8834,7 +6668,7 @@ class NSString extends NSObject { /// initWithCoder: NSString? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -8844,7 +6678,7 @@ class NSString extends NSObject { /// initWithContentsOfFile:encoding:error: NSString? initWithContentsOfFile_encoding_error_( NSString path, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( + final _ret = _objc_msgSend_94cet5( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_encoding_error_, path.ref.pointer, @@ -8860,7 +6694,7 @@ class NSString extends NSObject { NSString path, ffi.Pointer enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( + final _ret = _objc_msgSend_1gxo8gv( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfFile_usedEncoding_error_, path.ref.pointer, @@ -8874,7 +6708,7 @@ class NSString extends NSObject { /// initWithContentsOfURL:encoding:error: NSString? initWithContentsOfURL_encoding_error_( NSURL url, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( + final _ret = _objc_msgSend_94cet5( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_encoding_error_, url.ref.pointer, @@ -8890,7 +6724,7 @@ class NSString extends NSObject { NSURL url, ffi.Pointer enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( + final _ret = _objc_msgSend_1gxo8gv( this.ref.retainAndReturnPointer(), _sel_initWithContentsOfURL_usedEncoding_error_, url.ref.pointer, @@ -8903,7 +6737,7 @@ class NSString extends NSObject { /// initWithData:encoding: NSString? initWithData_encoding_(NSData data, int encoding) { - final _ret = _objc_msgSend_183c8xv(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_dcd68g(this.ref.retainAndReturnPointer(), _sel_initWithData_encoding_, data.ref.pointer, encoding); return _ret.address == 0 ? null @@ -8912,7 +6746,7 @@ class NSString extends NSObject { /// initWithFormat: NSString initWithFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithFormat_, format.ref.pointer); return NSString.castFromPointer(_ret, retain: false, release: true); } @@ -8920,7 +6754,7 @@ class NSString extends NSObject { /// initWithFormat:locale: NSString initWithFormat_locale_( NSString format, objc.ObjCObjectBase? locale) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initWithFormat_locale_, format.ref.pointer, @@ -8930,14 +6764,14 @@ class NSString extends NSObject { /// initWithString: NSString initWithString_(NSString aString) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithString_, aString.ref.pointer); return NSString.castFromPointer(_ret, retain: false, release: true); } /// initWithUTF8String: NSString? initWithUTF8String_(ffi.Pointer nullTerminatedCString) { - final _ret = _objc_msgSend_1og3t2d(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_rqwdif(this.ref.retainAndReturnPointer(), _sel_initWithUTF8String_, nullTerminatedCString); return _ret.address == 0 ? null @@ -8949,7 +6783,7 @@ class NSString extends NSObject { NSString format, NSString validFormatSpecifiers, ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( + final _ret = _objc_msgSend_bo6ep4( this.ref.retainAndReturnPointer(), _sel_initWithValidatedFormat_validFormatSpecifiers_error_, format.ref.pointer, @@ -8966,7 +6800,7 @@ class NSString extends NSObject { NSString validFormatSpecifiers, objc.ObjCObjectBase? locale, ffi.Pointer> error) { - final _ret = _objc_msgSend_w9wiqt( + final _ret = _objc_msgSend_2izev6( this.ref.retainAndReturnPointer(), _sel_initWithValidatedFormat_validFormatSpecifiers_locale_error_, format.ref.pointer, @@ -8978,353 +6812,624 @@ class NSString extends NSObject { : NSString.castFromPointer(_ret, retain: false, release: true); } - /// intValue - int get intValue { - return _objc_msgSend_1tf0yjs(this.ref.pointer, _sel_intValue); + /// length + int get length { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_length); } - /// integerValue - int get integerValue { - return _objc_msgSend_z1fx1b(this.ref.pointer, _sel_integerValue); + /// retain + NSString retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// isEqualToString: - bool isEqualToString_(NSString aString) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToString_, aString.ref.pointer); + /// self + NSString self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSString.castFromPointer(_ret, retain: true, release: true); } +} - /// itemProviderVisibilityForRepresentationWithTypeIdentifier: - NSItemProviderRepresentationVisibility - itemProviderVisibilityForRepresentationWithTypeIdentifier_( - NSString typeIdentifier) { - if (!objc.respondsToSelector(ref.pointer, - _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_)) { - throw objc.UnimplementedOptionalMethodException('NSString', - 'itemProviderVisibilityForRepresentationWithTypeIdentifier:'); - } - final _ret = _objc_msgSend_xnpl2w( - this.ref.pointer, - _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_, - typeIdentifier.ref.pointer); - return NSItemProviderRepresentationVisibility.fromValue(_ret); - } +enum NSStringCompareOptions { + NSCaseInsensitiveSearch(1), + NSLiteralSearch(2), + NSBackwardsSearch(4), + NSAnchoredSearch(8), + NSNumericSearch(64), + NSDiacriticInsensitiveSearch(128), + NSWidthInsensitiveSearch(256), + NSForcedOrderingSearch(512), + NSRegularExpressionSearch(1024); - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSString, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } + final int value; + const NSStringCompareOptions(this.value); - /// length - int get length { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_length); - } + static NSStringCompareOptions fromValue(int value) => switch (value) { + 1 => NSCaseInsensitiveSearch, + 2 => NSLiteralSearch, + 4 => NSBackwardsSearch, + 8 => NSAnchoredSearch, + 64 => NSNumericSearch, + 128 => NSDiacriticInsensitiveSearch, + 256 => NSWidthInsensitiveSearch, + 512 => NSForcedOrderingSearch, + 1024 => NSRegularExpressionSearch, + _ => throw ArgumentError( + "Unknown value for NSStringCompareOptions: $value"), + }; +} - /// lengthOfBytesUsingEncoding: - int lengthOfBytesUsingEncoding_(int enc) { - return _objc_msgSend_1eigyr6( - this.ref.pointer, _sel_lengthOfBytesUsingEncoding_, enc); +enum NSStringEncodingConversionOptions { + NSStringEncodingConversionAllowLossy(1), + NSStringEncodingConversionExternalRepresentation(2); + + final int value; + const NSStringEncodingConversionOptions(this.value); + + static NSStringEncodingConversionOptions fromValue(int value) => + switch (value) { + 1 => NSStringEncodingConversionAllowLossy, + 2 => NSStringEncodingConversionExternalRepresentation, + _ => throw ArgumentError( + "Unknown value for NSStringEncodingConversionOptions: $value"), + }; +} + +enum NSStringEnumerationOptions { + NSStringEnumerationByLines(0), + NSStringEnumerationByParagraphs(1), + NSStringEnumerationByComposedCharacterSequences(2), + NSStringEnumerationByWords(3), + NSStringEnumerationBySentences(4), + NSStringEnumerationByCaretPositions(5), + NSStringEnumerationByDeletionClusters(6), + NSStringEnumerationReverse(256), + NSStringEnumerationSubstringNotRequired(512), + NSStringEnumerationLocalized(1024); + + final int value; + const NSStringEnumerationOptions(this.value); + + static NSStringEnumerationOptions fromValue(int value) => switch (value) { + 0 => NSStringEnumerationByLines, + 1 => NSStringEnumerationByParagraphs, + 2 => NSStringEnumerationByComposedCharacterSequences, + 3 => NSStringEnumerationByWords, + 4 => NSStringEnumerationBySentences, + 5 => NSStringEnumerationByCaretPositions, + 6 => NSStringEnumerationByDeletionClusters, + 256 => NSStringEnumerationReverse, + 512 => NSStringEnumerationSubstringNotRequired, + 1024 => NSStringEnumerationLocalized, + _ => throw ArgumentError( + "Unknown value for NSStringEnumerationOptions: $value"), + }; +} + +/// NSStringExtensionMethods +extension NSStringExtensionMethods on NSString { + /// availableStringEncodings + static ffi.Pointer getAvailableStringEncodings() { + return _objc_msgSend_1h2q612( + _class_NSString, _sel_availableStringEncodings); } - /// lineRangeForRange: - NSRange lineRangeForRange_(NSRange range) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_hgyeceStret( - _ptr, this.ref.pointer, _sel_lineRangeForRange_, range) - : _ptr.ref = _objc_msgSend_hgyece( - this.ref.pointer, _sel_lineRangeForRange_, range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// defaultCStringEncoding + static int getDefaultCStringEncoding() { + return _objc_msgSend_xw2lbc(_class_NSString, _sel_defaultCStringEncoding); } - /// localizedCapitalizedString - NSString get localizedCapitalizedString { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_localizedCapitalizedString); + /// localizedNameOfStringEncoding: + static NSString localizedNameOfStringEncoding_(int encoding) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSString, _sel_localizedNameOfStringEncoding_, encoding); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// localizedCaseInsensitiveCompare: - NSComparisonResult localizedCaseInsensitiveCompare_(NSString string) { - final _ret = _objc_msgSend_1ile2ev(this.ref.pointer, - _sel_localizedCaseInsensitiveCompare_, string.ref.pointer); - return NSComparisonResult.fromValue(_ret); + /// UTF8String + ffi.Pointer get UTF8String { + return _objc_msgSend_1fuqfwb(this.ref.pointer, _sel_UTF8String); } - /// localizedCaseInsensitiveContainsString: - bool localizedCaseInsensitiveContainsString_(NSString str) { - return _objc_msgSend_l8lotg(this.ref.pointer, - _sel_localizedCaseInsensitiveContainsString_, str.ref.pointer); + /// boolValue + bool get boolValue { + return _objc_msgSend_91o635(this.ref.pointer, _sel_boolValue); } - /// localizedCompare: - NSComparisonResult localizedCompare_(NSString string) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_localizedCompare_, string.ref.pointer); - return NSComparisonResult.fromValue(_ret); + /// cStringUsingEncoding: + ffi.Pointer cStringUsingEncoding_(int encoding) { + return _objc_msgSend_1jtxufi( + this.ref.pointer, _sel_cStringUsingEncoding_, encoding); } - /// localizedLowercaseString - NSString get localizedLowercaseString { + /// canBeConvertedToEncoding: + bool canBeConvertedToEncoding_(int encoding) { + return _objc_msgSend_6peh6o( + this.ref.pointer, _sel_canBeConvertedToEncoding_, encoding); + } + + /// capitalizedString + NSString get capitalizedString { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedLowercaseString); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_capitalizedString); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// localizedNameOfStringEncoding: - static NSString localizedNameOfStringEncoding_(int encoding) { - final _ret = _objc_msgSend_ehxl2g( - _class_NSString, _sel_localizedNameOfStringEncoding_, encoding); + /// capitalizedStringWithLocale: + NSString capitalizedStringWithLocale_(NSLocale? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_capitalizedStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// localizedStandardCompare: - NSComparisonResult localizedStandardCompare_(NSString string) { - final _ret = _objc_msgSend_1ile2ev( - this.ref.pointer, _sel_localizedStandardCompare_, string.ref.pointer); + /// caseInsensitiveCompare: + NSComparisonResult caseInsensitiveCompare_(NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_caseInsensitiveCompare_, string.ref.pointer); return NSComparisonResult.fromValue(_ret); } - /// localizedStandardContainsString: - bool localizedStandardContainsString_(NSString str) { - return _objc_msgSend_l8lotg(this.ref.pointer, - _sel_localizedStandardContainsString_, str.ref.pointer); + /// commonPrefixWithString:options: + NSString commonPrefixWithString_options_( + NSString str, NSStringCompareOptions mask) { + final _ret = _objc_msgSend_fcs5vo(this.ref.pointer, + _sel_commonPrefixWithString_options_, str.ref.pointer, mask.value); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// localizedStandardRangeOfString: - NSRange localizedStandardRangeOfString_(NSString str) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1pl4rx6Stret(_ptr, this.ref.pointer, - _sel_localizedStandardRangeOfString_, str.ref.pointer) - : _ptr.ref = _objc_msgSend_1pl4rx6(this.ref.pointer, - _sel_localizedStandardRangeOfString_, str.ref.pointer); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// localizedStringWithFormat: - static NSString localizedStringWithFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7( - _class_NSString, _sel_localizedStringWithFormat_, format.ref.pointer); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// compare: + NSComparisonResult compare_(NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_compare_, string.ref.pointer); + return NSComparisonResult.fromValue(_ret); } - /// localizedStringWithValidatedFormat:validFormatSpecifiers:error: - static NSString? - localizedStringWithValidatedFormat_validFormatSpecifiers_error_( - NSString format, - NSString validFormatSpecifiers, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSString, - _sel_localizedStringWithValidatedFormat_validFormatSpecifiers_error_, - format.ref.pointer, - validFormatSpecifiers.ref.pointer, - error); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); + /// compare:options: + NSComparisonResult compare_options_( + NSString string, NSStringCompareOptions mask) { + final _ret = _objc_msgSend_16ydezh(this.ref.pointer, _sel_compare_options_, + string.ref.pointer, mask.value); + return NSComparisonResult.fromValue(_ret); } - /// localizedUppercaseString - NSString get localizedUppercaseString { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_localizedUppercaseString); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// compare:options:range: + NSComparisonResult compare_options_range_(NSString string, + NSStringCompareOptions mask, NSRange rangeOfReceiverToCompare) { + final _ret = _objc_msgSend_eeuxub( + this.ref.pointer, + _sel_compare_options_range_, + string.ref.pointer, + mask.value, + rangeOfReceiverToCompare); + return NSComparisonResult.fromValue(_ret); } - /// longLongValue - int get longLongValue { - return _objc_msgSend_e94jsr(this.ref.pointer, _sel_longLongValue); + /// compare:options:range:locale: + NSComparisonResult compare_options_range_locale_( + NSString string, + NSStringCompareOptions mask, + NSRange rangeOfReceiverToCompare, + objc.ObjCObjectBase? locale) { + final _ret = _objc_msgSend_i4hdht( + this.ref.pointer, + _sel_compare_options_range_locale_, + string.ref.pointer, + mask.value, + rangeOfReceiverToCompare, + locale?.ref.pointer ?? ffi.nullptr); + return NSComparisonResult.fromValue(_ret); } - /// lowercaseString - NSString get lowercaseString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_lowercaseString); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// componentsSeparatedByCharactersInSet: + NSArray componentsSeparatedByCharactersInSet_(NSCharacterSet separator) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_componentsSeparatedByCharactersInSet_, separator.ref.pointer); + return NSArray.castFromPointer(_ret, retain: true, release: true); } - /// lowercaseStringWithLocale: - NSString lowercaseStringWithLocale_(NSLocale? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_lowercaseStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); - return NSString.castFromPointer(_ret, retain: true, release: true); + /// componentsSeparatedByString: + NSArray componentsSeparatedByString_(NSString separator) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_componentsSeparatedByString_, separator.ref.pointer); + return NSArray.castFromPointer(_ret, retain: true, release: true); } - /// maximumLengthOfBytesUsingEncoding: - int maximumLengthOfBytesUsingEncoding_(int enc) { - return _objc_msgSend_1eigyr6( - this.ref.pointer, _sel_maximumLengthOfBytesUsingEncoding_, enc); + /// containsString: + bool containsString_(NSString str) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_containsString_, str.ref.pointer); } - /// new - static NSString new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSString, _sel_new); - return NSString.castFromPointer(_ret, retain: false, release: true); + /// dataUsingEncoding: + NSData? dataUsingEncoding_(int encoding) { + final _ret = _objc_msgSend_1qrcblu( + this.ref.pointer, _sel_dataUsingEncoding_, encoding); + return _ret.address == 0 + ? null + : NSData.castFromPointer(_ret, retain: true, release: true); } - /// objectWithItemProviderData:typeIdentifier:error: - static NSString? objectWithItemProviderData_typeIdentifier_error_( - NSData data, - NSString typeIdentifier, - ffi.Pointer> outError) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSString, - _sel_objectWithItemProviderData_typeIdentifier_error_, - data.ref.pointer, - typeIdentifier.ref.pointer, - outError); + /// dataUsingEncoding:allowLossyConversion: + NSData? dataUsingEncoding_allowLossyConversion_(int encoding, bool lossy) { + final _ret = _objc_msgSend_rubz6a(this.ref.pointer, + _sel_dataUsingEncoding_allowLossyConversion_, encoding, lossy); return _ret.address == 0 ? null - : NSString.castFromPointer(_ret, retain: true, release: true); + : NSData.castFromPointer(_ret, retain: true, release: true); } - /// paragraphRangeForRange: - NSRange paragraphRangeForRange_(NSRange range) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_hgyeceStret( - _ptr, this.ref.pointer, _sel_paragraphRangeForRange_, range) - : _ptr.ref = _objc_msgSend_hgyece( - this.ref.pointer, _sel_paragraphRangeForRange_, range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// decomposedStringWithCanonicalMapping + NSString get decomposedStringWithCanonicalMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_decomposedStringWithCanonicalMapping); + return NSString.castFromPointer(_ret, retain: true, release: true); } - /// precomposedStringWithCanonicalMapping - NSString get precomposedStringWithCanonicalMapping { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_precomposedStringWithCanonicalMapping); + /// decomposedStringWithCompatibilityMapping + NSString get decomposedStringWithCompatibilityMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_decomposedStringWithCompatibilityMapping); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// precomposedStringWithCompatibilityMapping - NSString get precomposedStringWithCompatibilityMapping { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_precomposedStringWithCompatibilityMapping); + /// description + NSString get description { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// propertyList - objc.ObjCObjectBase propertyList() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_propertyList); - return objc.ObjCObjectBase(_ret, retain: true, release: true); + /// doubleValue + double get doubleValue { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_doubleValue) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_doubleValue); } - /// propertyListFromStringsFileFormat - NSDictionary? propertyListFromStringsFileFormat() { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_propertyListFromStringsFileFormat); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); + /// fastestEncoding + int get fastestEncoding { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_fastestEncoding); } - /// rangeOfCharacterFromSet: - NSRange rangeOfCharacterFromSet_(NSCharacterSet searchSet) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1pl4rx6Stret(_ptr, this.ref.pointer, - _sel_rangeOfCharacterFromSet_, searchSet.ref.pointer) - : _ptr.ref = _objc_msgSend_1pl4rx6(this.ref.pointer, - _sel_rangeOfCharacterFromSet_, searchSet.ref.pointer); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// floatValue + double get floatValue { + return objc.useMsgSendVariants + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_floatValue) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_floatValue); } - /// rangeOfCharacterFromSet:options: - NSRange rangeOfCharacterFromSet_options_( - NSCharacterSet searchSet, NSStringCompareOptions mask) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_1yjgs24Stret( - _ptr, - this.ref.pointer, - _sel_rangeOfCharacterFromSet_options_, - searchSet.ref.pointer, - mask.value) - : _ptr.ref = _objc_msgSend_1yjgs24( - this.ref.pointer, - _sel_rangeOfCharacterFromSet_options_, - searchSet.ref.pointer, - mask.value); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// getBytes:maxLength:usedLength:encoding:options:range:remainingRange: + bool getBytes_maxLength_usedLength_encoding_options_range_remainingRange_( + ffi.Pointer buffer, + int maxBufferCount, + ffi.Pointer usedBufferCount, + int encoding, + NSStringEncodingConversionOptions options, + NSRange range, + ffi.Pointer leftover) { + return _objc_msgSend_i30zh3( + this.ref.pointer, + _sel_getBytes_maxLength_usedLength_encoding_options_range_remainingRange_, + buffer, + maxBufferCount, + usedBufferCount, + encoding, + options.value, + range, + leftover); } - /// rangeOfCharacterFromSet:options:range: - NSRange rangeOfCharacterFromSet_options_range_(NSCharacterSet searchSet, - NSStringCompareOptions mask, NSRange rangeOfReceiverToSearch) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_ws2nkjStret( - _ptr, - this.ref.pointer, - _sel_rangeOfCharacterFromSet_options_range_, - searchSet.ref.pointer, - mask.value, - rangeOfReceiverToSearch) - : _ptr.ref = _objc_msgSend_ws2nkj( - this.ref.pointer, - _sel_rangeOfCharacterFromSet_options_range_, - searchSet.ref.pointer, - mask.value, - rangeOfReceiverToSearch); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// getCString:maxLength:encoding: + bool getCString_maxLength_encoding_( + ffi.Pointer buffer, int maxBufferCount, int encoding) { + return _objc_msgSend_1lv8yz3(this.ref.pointer, + _sel_getCString_maxLength_encoding_, buffer, maxBufferCount, encoding); } - /// rangeOfComposedCharacterSequenceAtIndex: - NSRange rangeOfComposedCharacterSequenceAtIndex_(int index) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_rmij85Stret(_ptr, this.ref.pointer, - _sel_rangeOfComposedCharacterSequenceAtIndex_, index) - : _ptr.ref = _objc_msgSend_rmij85(this.ref.pointer, - _sel_rangeOfComposedCharacterSequenceAtIndex_, index); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// getCharacters:range: + void getCharacters_range_( + ffi.Pointer buffer, NSRange range) { + _objc_msgSend_898fog( + this.ref.pointer, _sel_getCharacters_range_, buffer, range); } - /// rangeOfComposedCharacterSequencesForRange: - NSRange rangeOfComposedCharacterSequencesForRange_(NSRange range) { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_hgyeceStret(_ptr, this.ref.pointer, - _sel_rangeOfComposedCharacterSequencesForRange_, range) - : _ptr.ref = _objc_msgSend_hgyece(this.ref.pointer, - _sel_rangeOfComposedCharacterSequencesForRange_, range); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); + /// getLineStart:end:contentsEnd:forRange: + void getLineStart_end_contentsEnd_forRange_( + ffi.Pointer startPtr, + ffi.Pointer lineEndPtr, + ffi.Pointer contentsEndPtr, + NSRange range) { + _objc_msgSend_ourvf2( + this.ref.pointer, + _sel_getLineStart_end_contentsEnd_forRange_, + startPtr, + lineEndPtr, + contentsEndPtr, + range); } - /// rangeOfString: + /// getParagraphStart:end:contentsEnd:forRange: + void getParagraphStart_end_contentsEnd_forRange_( + ffi.Pointer startPtr, + ffi.Pointer parEndPtr, + ffi.Pointer contentsEndPtr, + NSRange range) { + _objc_msgSend_ourvf2( + this.ref.pointer, + _sel_getParagraphStart_end_contentsEnd_forRange_, + startPtr, + parEndPtr, + contentsEndPtr, + range); + } + + /// hasPrefix: + bool hasPrefix_(NSString str) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_hasPrefix_, str.ref.pointer); + } + + /// hasSuffix: + bool hasSuffix_(NSString str) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_hasSuffix_, str.ref.pointer); + } + + /// hash + int get hash { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_hash); + } + + /// intValue + int get intValue { + return _objc_msgSend_13yqbb6(this.ref.pointer, _sel_intValue); + } + + /// integerValue + int get integerValue { + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_integerValue); + } + + /// isEqualToString: + bool isEqualToString_(NSString aString) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_isEqualToString_, aString.ref.pointer); + } + + /// lengthOfBytesUsingEncoding: + int lengthOfBytesUsingEncoding_(int enc) { + return _objc_msgSend_12py2ux( + this.ref.pointer, _sel_lengthOfBytesUsingEncoding_, enc); + } + + /// lineRangeForRange: + NSRange lineRangeForRange_(NSRange range) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_uimyc7Stret( + _ptr, this.ref.pointer, _sel_lineRangeForRange_, range) + : _ptr.ref = _objc_msgSend_uimyc7( + this.ref.pointer, _sel_lineRangeForRange_, range); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// localizedCapitalizedString + NSString get localizedCapitalizedString { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_localizedCapitalizedString); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedCaseInsensitiveCompare: + NSComparisonResult localizedCaseInsensitiveCompare_(NSString string) { + final _ret = _objc_msgSend_1wpduvy(this.ref.pointer, + _sel_localizedCaseInsensitiveCompare_, string.ref.pointer); + return NSComparisonResult.fromValue(_ret); + } + + /// localizedCaseInsensitiveContainsString: + bool localizedCaseInsensitiveContainsString_(NSString str) { + return _objc_msgSend_69e0x1(this.ref.pointer, + _sel_localizedCaseInsensitiveContainsString_, str.ref.pointer); + } + + /// localizedCompare: + NSComparisonResult localizedCompare_(NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_localizedCompare_, string.ref.pointer); + return NSComparisonResult.fromValue(_ret); + } + + /// localizedLowercaseString + NSString get localizedLowercaseString { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedLowercaseString); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedStandardCompare: + NSComparisonResult localizedStandardCompare_(NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_localizedStandardCompare_, string.ref.pointer); + return NSComparisonResult.fromValue(_ret); + } + + /// localizedStandardContainsString: + bool localizedStandardContainsString_(NSString str) { + return _objc_msgSend_69e0x1(this.ref.pointer, + _sel_localizedStandardContainsString_, str.ref.pointer); + } + + /// localizedStandardRangeOfString: + NSRange localizedStandardRangeOfString_(NSString str) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_x4muu7Stret(_ptr, this.ref.pointer, + _sel_localizedStandardRangeOfString_, str.ref.pointer) + : _ptr.ref = _objc_msgSend_x4muu7(this.ref.pointer, + _sel_localizedStandardRangeOfString_, str.ref.pointer); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// localizedUppercaseString + NSString get localizedUppercaseString { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedUppercaseString); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// longLongValue + int get longLongValue { + return _objc_msgSend_1k101e3(this.ref.pointer, _sel_longLongValue); + } + + /// lowercaseString + NSString get lowercaseString { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_lowercaseString); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// lowercaseStringWithLocale: + NSString lowercaseStringWithLocale_(NSLocale? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_lowercaseStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// maximumLengthOfBytesUsingEncoding: + int maximumLengthOfBytesUsingEncoding_(int enc) { + return _objc_msgSend_12py2ux( + this.ref.pointer, _sel_maximumLengthOfBytesUsingEncoding_, enc); + } + + /// paragraphRangeForRange: + NSRange paragraphRangeForRange_(NSRange range) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_uimyc7Stret( + _ptr, this.ref.pointer, _sel_paragraphRangeForRange_, range) + : _ptr.ref = _objc_msgSend_uimyc7( + this.ref.pointer, _sel_paragraphRangeForRange_, range); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// precomposedStringWithCanonicalMapping + NSString get precomposedStringWithCanonicalMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_precomposedStringWithCanonicalMapping); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// precomposedStringWithCompatibilityMapping + NSString get precomposedStringWithCompatibilityMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_precomposedStringWithCompatibilityMapping); + return NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// rangeOfCharacterFromSet: + NSRange rangeOfCharacterFromSet_(NSCharacterSet searchSet) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_x4muu7Stret(_ptr, this.ref.pointer, + _sel_rangeOfCharacterFromSet_, searchSet.ref.pointer) + : _ptr.ref = _objc_msgSend_x4muu7(this.ref.pointer, + _sel_rangeOfCharacterFromSet_, searchSet.ref.pointer); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfCharacterFromSet:options: + NSRange rangeOfCharacterFromSet_options_( + NSCharacterSet searchSet, NSStringCompareOptions mask) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_1kwndnwStret( + _ptr, + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_, + searchSet.ref.pointer, + mask.value) + : _ptr.ref = _objc_msgSend_1kwndnw( + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_, + searchSet.ref.pointer, + mask.value); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfCharacterFromSet:options:range: + NSRange rangeOfCharacterFromSet_options_range_(NSCharacterSet searchSet, + NSStringCompareOptions mask, NSRange rangeOfReceiverToSearch) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_ackzikStret( + _ptr, + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_range_, + searchSet.ref.pointer, + mask.value, + rangeOfReceiverToSearch) + : _ptr.ref = _objc_msgSend_ackzik( + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_range_, + searchSet.ref.pointer, + mask.value, + rangeOfReceiverToSearch); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfComposedCharacterSequenceAtIndex: + NSRange rangeOfComposedCharacterSequenceAtIndex_(int index) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_d3i1uyStret(_ptr, this.ref.pointer, + _sel_rangeOfComposedCharacterSequenceAtIndex_, index) + : _ptr.ref = _objc_msgSend_d3i1uy(this.ref.pointer, + _sel_rangeOfComposedCharacterSequenceAtIndex_, index); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfComposedCharacterSequencesForRange: + NSRange rangeOfComposedCharacterSequencesForRange_(NSRange range) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_uimyc7Stret(_ptr, this.ref.pointer, + _sel_rangeOfComposedCharacterSequencesForRange_, range) + : _ptr.ref = _objc_msgSend_uimyc7(this.ref.pointer, + _sel_rangeOfComposedCharacterSequencesForRange_, range); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfString: NSRange rangeOfString_(NSString searchString) { final _ptr = pkg_ffi.calloc(); objc.useMsgSendVariants - ? _objc_msgSend_1pl4rx6Stret(_ptr, this.ref.pointer, - _sel_rangeOfString_, searchString.ref.pointer) - : _ptr.ref = _objc_msgSend_1pl4rx6( + ? _objc_msgSend_x4muu7Stret(_ptr, this.ref.pointer, _sel_rangeOfString_, + searchString.ref.pointer) + : _ptr.ref = _objc_msgSend_x4muu7( this.ref.pointer, _sel_rangeOfString_, searchString.ref.pointer); final _finalizable = _ptr.cast().asTypedList( ffi.sizeOf(), @@ -9337,9 +7442,9 @@ class NSString extends NSObject { NSString searchString, NSStringCompareOptions mask) { final _ptr = pkg_ffi.calloc(); objc.useMsgSendVariants - ? _objc_msgSend_1yjgs24Stret(_ptr, this.ref.pointer, + ? _objc_msgSend_1kwndnwStret(_ptr, this.ref.pointer, _sel_rangeOfString_options_, searchString.ref.pointer, mask.value) - : _ptr.ref = _objc_msgSend_1yjgs24(this.ref.pointer, + : _ptr.ref = _objc_msgSend_1kwndnw(this.ref.pointer, _sel_rangeOfString_options_, searchString.ref.pointer, mask.value); final _finalizable = _ptr.cast().asTypedList( ffi.sizeOf(), @@ -9352,14 +7457,14 @@ class NSString extends NSObject { NSStringCompareOptions mask, NSRange rangeOfReceiverToSearch) { final _ptr = pkg_ffi.calloc(); objc.useMsgSendVariants - ? _objc_msgSend_ws2nkjStret( + ? _objc_msgSend_ackzikStret( _ptr, this.ref.pointer, _sel_rangeOfString_options_range_, searchString.ref.pointer, mask.value, rangeOfReceiverToSearch) - : _ptr.ref = _objc_msgSend_ws2nkj( + : _ptr.ref = _objc_msgSend_ackzik( this.ref.pointer, _sel_rangeOfString_options_range_, searchString.ref.pointer, @@ -9379,7 +7484,7 @@ class NSString extends NSObject { NSLocale? locale) { final _ptr = pkg_ffi.calloc(); objc.useMsgSendVariants - ? _objc_msgSend_17qtp0oStret( + ? _objc_msgSend_198mga8Stret( _ptr, this.ref.pointer, _sel_rangeOfString_options_range_locale_, @@ -9387,7 +7492,7 @@ class NSString extends NSObject { mask.value, rangeOfReceiverToSearch, locale?.ref.pointer ?? ffi.nullptr) - : _ptr.ref = _objc_msgSend_17qtp0o( + : _ptr.ref = _objc_msgSend_198mga8( this.ref.pointer, _sel_rangeOfString_options_range_locale_, searchString.ref.pointer, @@ -9400,46 +7505,21 @@ class NSString extends NSObject { return ffi.Struct.create(_finalizable); } - /// readableTypeIdentifiersForItemProvider - static NSArray readableTypeIdentifiersForItemProvider() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSString, _sel_readableTypeIdentifiersForItemProvider); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// smallestEncoding int get smallestEncoding { - return _objc_msgSend_eldhrq(this.ref.pointer, _sel_smallestEncoding); - } - - /// string - static NSString string() { - final _ret = _objc_msgSend_1unuoxw(_class_NSString, _sel_string); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringByAddingPercentEncodingWithAllowedCharacters: - NSString? stringByAddingPercentEncodingWithAllowedCharacters_( - NSCharacterSet allowedCharacters) { - final _ret = _objc_msgSend_juohf7( - this.ref.pointer, - _sel_stringByAddingPercentEncodingWithAllowedCharacters_, - allowedCharacters.ref.pointer); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_smallestEncoding); } /// stringByAppendingFormat: NSString stringByAppendingFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.pointer, _sel_stringByAppendingFormat_, format.ref.pointer); return NSString.castFromPointer(_ret, retain: true, release: true); } /// stringByAppendingString: NSString stringByAppendingString_(NSString aString) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( this.ref.pointer, _sel_stringByAppendingString_, aString.ref.pointer); return NSString.castFromPointer(_ret, retain: true, release: true); } @@ -9447,7 +7527,7 @@ class NSString extends NSObject { /// stringByApplyingTransform:reverse: NSString? stringByApplyingTransform_reverse_( NSString transform, bool reverse) { - final _ret = _objc_msgSend_qqbb5y( + final _ret = _objc_msgSend_1bdmr5f( this.ref.pointer, _sel_stringByApplyingTransform_reverse_, transform.ref.pointer, @@ -9460,7 +7540,7 @@ class NSString extends NSObject { /// stringByFoldingWithOptions:locale: NSString stringByFoldingWithOptions_locale_( NSStringCompareOptions options, NSLocale? locale) { - final _ret = _objc_msgSend_lqq9l( + final _ret = _objc_msgSend_146986e( this.ref.pointer, _sel_stringByFoldingWithOptions_locale_, options.value, @@ -9471,7 +7551,7 @@ class NSString extends NSObject { /// stringByPaddingToLength:withString:startingAtIndex: NSString stringByPaddingToLength_withString_startingAtIndex_( int newLength, NSString padString, int padIndex) { - final _ret = _objc_msgSend_h7jsjv( + final _ret = _objc_msgSend_exgdqb( this.ref.pointer, _sel_stringByPaddingToLength_withString_startingAtIndex_, newLength, @@ -9480,19 +7560,10 @@ class NSString extends NSObject { return NSString.castFromPointer(_ret, retain: true, release: true); } - /// stringByRemovingPercentEncoding - NSString? get stringByRemovingPercentEncoding { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_stringByRemovingPercentEncoding); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - /// stringByReplacingCharactersInRange:withString: NSString stringByReplacingCharactersInRange_withString_( NSRange range, NSString replacement) { - final _ret = _objc_msgSend_1g0atks( + final _ret = _objc_msgSend_197wcu5( this.ref.pointer, _sel_stringByReplacingCharactersInRange_withString_, range, @@ -9503,7 +7574,7 @@ class NSString extends NSObject { /// stringByReplacingOccurrencesOfString:withString: NSString stringByReplacingOccurrencesOfString_withString_( NSString target, NSString replacement) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.pointer, _sel_stringByReplacingOccurrencesOfString_withString_, target.ref.pointer, @@ -9517,7 +7588,7 @@ class NSString extends NSObject { NSString replacement, NSStringCompareOptions options, NSRange searchRange) { - final _ret = _objc_msgSend_x1q1g5( + final _ret = _objc_msgSend_1wrs2o6( this.ref.pointer, _sel_stringByReplacingOccurrencesOfString_withString_options_range_, target.ref.pointer, @@ -9529,203 +7600,52 @@ class NSString extends NSObject { /// stringByTrimmingCharactersInSet: NSString stringByTrimmingCharactersInSet_(NSCharacterSet set) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, _sel_stringByTrimmingCharactersInSet_, set.ref.pointer); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// stringEncodingForData:encodingOptions:convertedString:usedLossyConversion: - static int - stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_( - NSData data, - NSDictionary? opts, - ffi.Pointer> string, - ffi.Pointer usedLossyConversion) { - return _objc_msgSend_1el0by7( - _class_NSString, - _sel_stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_, - data.ref.pointer, - opts?.ref.pointer ?? ffi.nullptr, - string, - usedLossyConversion); - } - - /// stringWithCString:encoding: - static NSString? stringWithCString_encoding_( - ffi.Pointer cString, int enc) { - final _ret = _objc_msgSend_1t5rcq1( - _class_NSString, _sel_stringWithCString_encoding_, cString, enc); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithCharacters:length: - static NSString stringWithCharacters_length_( - ffi.Pointer characters, int length) { - final _ret = _objc_msgSend_syhe4c( - _class_NSString, _sel_stringWithCharacters_length_, characters, length); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfFile:encoding:error: - static NSString? stringWithContentsOfFile_encoding_error_( - NSString path, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( - _class_NSString, - _sel_stringWithContentsOfFile_encoding_error_, - path.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfFile:usedEncoding:error: - static NSString? stringWithContentsOfFile_usedEncoding_error_( - NSString path, - ffi.Pointer enc, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( - _class_NSString, - _sel_stringWithContentsOfFile_usedEncoding_error_, - path.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfURL:encoding:error: - static NSString? stringWithContentsOfURL_encoding_error_( - NSURL url, int enc, ffi.Pointer> error) { - final _ret = _objc_msgSend_1u9el4t( - _class_NSString, - _sel_stringWithContentsOfURL_encoding_error_, - url.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithContentsOfURL:usedEncoding:error: - static NSString? stringWithContentsOfURL_usedEncoding_error_( - NSURL url, - ffi.Pointer enc, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1h339ej( - _class_NSString, - _sel_stringWithContentsOfURL_usedEncoding_error_, - url.ref.pointer, - enc, - error); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithFormat: - static NSString stringWithFormat_(NSString format) { - final _ret = _objc_msgSend_juohf7( - _class_NSString, _sel_stringWithFormat_, format.ref.pointer); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithString: - static NSString stringWithString_(NSString string) { - final _ret = _objc_msgSend_juohf7( - _class_NSString, _sel_stringWithString_, string.ref.pointer); - return NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithUTF8String: - static NSString? stringWithUTF8String_( - ffi.Pointer nullTerminatedCString) { - final _ret = _objc_msgSend_1og3t2d( - _class_NSString, _sel_stringWithUTF8String_, nullTerminatedCString); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// stringWithValidatedFormat:validFormatSpecifiers:error: - static NSString? stringWithValidatedFormat_validFormatSpecifiers_error_( - NSString format, - NSString validFormatSpecifiers, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSString, - _sel_stringWithValidatedFormat_validFormatSpecifiers_error_, - format.ref.pointer, - validFormatSpecifiers.ref.pointer, - error); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - /// substringFromIndex: NSString substringFromIndex_(int from) { final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_substringFromIndex_, from); + _objc_msgSend_1qrcblu(this.ref.pointer, _sel_substringFromIndex_, from); return NSString.castFromPointer(_ret, retain: true, release: true); } /// substringToIndex: NSString substringToIndex_(int to) { final _ret = - _objc_msgSend_ehxl2g(this.ref.pointer, _sel_substringToIndex_, to); + _objc_msgSend_1qrcblu(this.ref.pointer, _sel_substringToIndex_, to); return NSString.castFromPointer(_ret, retain: true, release: true); } /// substringWithRange: NSString substringWithRange_(NSRange range) { - final _ret = _objc_msgSend_176f8tz( - this.ref.pointer, _sel_substringWithRange_, range); + final _ret = + _objc_msgSend_83z673(this.ref.pointer, _sel_substringWithRange_, range); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSString, _sel_supportsSecureCoding); - } - /// uppercaseString NSString get uppercaseString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_uppercaseString); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_uppercaseString); return NSString.castFromPointer(_ret, retain: true, release: true); } /// uppercaseStringWithLocale: NSString uppercaseStringWithLocale_(NSLocale? locale) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, _sel_uppercaseStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); return NSString.castFromPointer(_ret, retain: true, release: true); } - /// writableTypeIdentifiersForItemProvider - NSArray writableTypeIdentifiersForItemProvider() { - if (!objc.respondsToSelector( - ref.pointer, _sel_writableTypeIdentifiersForItemProvider)) { - throw objc.UnimplementedOptionalMethodException( - 'NSString', 'writableTypeIdentifiersForItemProvider'); - } - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_writableTypeIdentifiersForItemProvider); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// writeToFile:atomically:encoding:error: bool writeToFile_atomically_encoding_error_( NSString path, bool useAuxiliaryFile, int enc, ffi.Pointer> error) { - return _objc_msgSend_go6fex( + return _objc_msgSend_1140663( this.ref.pointer, _sel_writeToFile_atomically_encoding_error_, path.ref.pointer, @@ -9737,7 +7657,7 @@ class NSString extends NSObject { /// writeToURL:atomically:encoding:error: bool writeToURL_atomically_encoding_error_(NSURL url, bool useAuxiliaryFile, int enc, ffi.Pointer> error) { - return _objc_msgSend_go6fex( + return _objc_msgSend_1140663( this.ref.pointer, _sel_writeToURL_atomically_encoding_error_, url.ref.pointer, @@ -9747,82 +7667,6 @@ class NSString extends NSObject { } } -enum NSStringCompareOptions { - NSCaseInsensitiveSearch(1), - NSLiteralSearch(2), - NSBackwardsSearch(4), - NSAnchoredSearch(8), - NSNumericSearch(64), - NSDiacriticInsensitiveSearch(128), - NSWidthInsensitiveSearch(256), - NSForcedOrderingSearch(512), - NSRegularExpressionSearch(1024); - - final int value; - const NSStringCompareOptions(this.value); - - static NSStringCompareOptions fromValue(int value) => switch (value) { - 1 => NSCaseInsensitiveSearch, - 2 => NSLiteralSearch, - 4 => NSBackwardsSearch, - 8 => NSAnchoredSearch, - 64 => NSNumericSearch, - 128 => NSDiacriticInsensitiveSearch, - 256 => NSWidthInsensitiveSearch, - 512 => NSForcedOrderingSearch, - 1024 => NSRegularExpressionSearch, - _ => throw ArgumentError( - "Unknown value for NSStringCompareOptions: $value"), - }; -} - -enum NSStringEncodingConversionOptions { - NSStringEncodingConversionAllowLossy(1), - NSStringEncodingConversionExternalRepresentation(2); - - final int value; - const NSStringEncodingConversionOptions(this.value); - - static NSStringEncodingConversionOptions fromValue(int value) => - switch (value) { - 1 => NSStringEncodingConversionAllowLossy, - 2 => NSStringEncodingConversionExternalRepresentation, - _ => throw ArgumentError( - "Unknown value for NSStringEncodingConversionOptions: $value"), - }; -} - -enum NSStringEnumerationOptions { - NSStringEnumerationByLines(0), - NSStringEnumerationByParagraphs(1), - NSStringEnumerationByComposedCharacterSequences(2), - NSStringEnumerationByWords(3), - NSStringEnumerationBySentences(4), - NSStringEnumerationByCaretPositions(5), - NSStringEnumerationByDeletionClusters(6), - NSStringEnumerationReverse(256), - NSStringEnumerationSubstringNotRequired(512), - NSStringEnumerationLocalized(1024); - - final int value; - const NSStringEnumerationOptions(this.value); - - static NSStringEnumerationOptions fromValue(int value) => switch (value) { - 0 => NSStringEnumerationByLines, - 1 => NSStringEnumerationByParagraphs, - 2 => NSStringEnumerationByComposedCharacterSequences, - 3 => NSStringEnumerationByWords, - 4 => NSStringEnumerationBySentences, - 5 => NSStringEnumerationByCaretPositions, - 6 => NSStringEnumerationByDeletionClusters, - 256 => NSStringEnumerationReverse, - 512 => NSStringEnumerationSubstringNotRequired, - 1024 => NSStringEnumerationLocalized, - _ => throw ArgumentError( - "Unknown value for NSStringEnumerationOptions: $value"), - }; -} - /// NSURL class NSURL extends NSObject { NSURL._(ffi.Pointer pointer, @@ -9840,65 +7684,16 @@ class NSURL extends NSObject { /// Returns whether [obj] is an instance of [NSURL]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSURL); } - /// URLByAppendingPathComponent: - NSURL? URLByAppendingPathComponent_(NSString pathComponent) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_URLByAppendingPathComponent_, pathComponent.ref.pointer); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLByAppendingPathComponent:isDirectory: - NSURL? URLByAppendingPathComponent_isDirectory_( - NSString pathComponent, bool isDirectory) { - final _ret = _objc_msgSend_qqbb5y( - this.ref.pointer, - _sel_URLByAppendingPathComponent_isDirectory_, - pathComponent.ref.pointer, - isDirectory); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLByAppendingPathExtension: - NSURL? URLByAppendingPathExtension_(NSString pathExtension) { - final _ret = _objc_msgSend_juohf7(this.ref.pointer, - _sel_URLByAppendingPathExtension_, pathExtension.ref.pointer); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLByDeletingLastPathComponent - NSURL? get URLByDeletingLastPathComponent { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_URLByDeletingLastPathComponent); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLByDeletingPathExtension - NSURL? get URLByDeletingPathExtension { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_URLByDeletingPathExtension); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - /// URLByResolvingAliasFileAtURL:options:error: static NSURL? URLByResolvingAliasFileAtURL_options_error_( NSURL url, NSURLBookmarkResolutionOptions options, ffi.Pointer> error) { - final _ret = _objc_msgSend_18rrpy( + final _ret = _objc_msgSend_pdn1fa( _class_NSURL, _sel_URLByResolvingAliasFileAtURL_options_error_, url.ref.pointer, @@ -9917,7 +7712,7 @@ class NSURL extends NSObject { NSURL? relativeURL, ffi.Pointer isStale, ffi.Pointer> error) { - final _ret = _objc_msgSend_1bzaq3a( + final _ret = _objc_msgSend_3ems5q( _class_NSURL, _sel_URLByResolvingBookmarkData_options_relativeToURL_bookmarkDataIsStale_error_, bookmarkData.ref.pointer, @@ -9930,28 +7725,10 @@ class NSURL extends NSObject { : NSURL.castFromPointer(_ret, retain: true, release: true); } - /// URLByResolvingSymlinksInPath - NSURL? get URLByResolvingSymlinksInPath { - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_URLByResolvingSymlinksInPath); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// URLByStandardizingPath - NSURL? get URLByStandardizingPath { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_URLByStandardizingPath); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - /// URLWithDataRepresentation:relativeToURL: static NSURL URLWithDataRepresentation_relativeToURL_( NSData data, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( _class_NSURL, _sel_URLWithDataRepresentation_relativeToURL_, data.ref.pointer, @@ -9961,7 +7738,7 @@ class NSURL extends NSObject { /// URLWithString: static NSURL? URLWithString_(NSString URLString) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSURL, _sel_URLWithString_, URLString.ref.pointer); return _ret.address == 0 ? null @@ -9971,7 +7748,7 @@ class NSURL extends NSObject { /// URLWithString:encodingInvalidCharacters: static NSURL? URLWithString_encodingInvalidCharacters_( NSString URLString, bool encodingInvalidCharacters) { - final _ret = _objc_msgSend_qqbb5y( + final _ret = _objc_msgSend_1bdmr5f( _class_NSURL, _sel_URLWithString_encodingInvalidCharacters_, URLString.ref.pointer, @@ -9984,7 +7761,7 @@ class NSURL extends NSObject { /// URLWithString:relativeToURL: static NSURL? URLWithString_relativeToURL_( NSString URLString, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( _class_NSURL, _sel_URLWithString_relativeToURL_, URLString.ref.pointer, @@ -9994,26 +7771,10 @@ class NSURL extends NSObject { : NSURL.castFromPointer(_ret, retain: true, release: true); } - /// absoluteString - NSString? get absoluteString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_absoluteString); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// absoluteURL - NSURL? get absoluteURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_absoluteURL); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - /// absoluteURLWithDataRepresentation:relativeToURL: static NSURL absoluteURLWithDataRepresentation_relativeToURL_( NSData data, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( _class_NSURL, _sel_absoluteURLWithDataRepresentation_relativeToURL_, data.ref.pointer, @@ -10023,34 +7784,20 @@ class NSURL extends NSObject { /// alloc static NSURL alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURL, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSURL, _sel_alloc); return NSURL.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSURL allocWithZone_(ffi.Pointer<_NSZone> zone) { - final _ret = _objc_msgSend_1b3ihd0(_class_NSURL, _sel_allocWithZone_, zone); + final _ret = _objc_msgSend_hzlb60(_class_NSURL, _sel_allocWithZone_, zone); return NSURL.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSURL, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); - } - - /// baseURL - NSURL? get baseURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_baseURL); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - /// bookmarkDataWithContentsOfURL:error: static NSData? bookmarkDataWithContentsOfURL_error_( NSURL bookmarkFileURL, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh( + final _ret = _objc_msgSend_1705co6( _class_NSURL, _sel_bookmarkDataWithContentsOfURL_error_, bookmarkFileURL.ref.pointer, @@ -10060,78 +7807,10 @@ class NSURL extends NSObject { : NSData.castFromPointer(_ret, retain: true, release: true); } - /// bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error: - NSData? - bookmarkDataWithOptions_includingResourceValuesForKeys_relativeToURL_error_( - NSURLBookmarkCreationOptions options, - NSArray? keys, - NSURL? relativeURL, - ffi.Pointer> error) { - final _ret = _objc_msgSend_1s6ey8e( - this.ref.pointer, - _sel_bookmarkDataWithOptions_includingResourceValuesForKeys_relativeToURL_error_, - options.value, - keys?.ref.pointer ?? ffi.nullptr, - relativeURL?.ref.pointer ?? ffi.nullptr, - error); - return _ret.address == 0 - ? null - : NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// checkPromisedItemIsReachableAndReturnError: - bool checkPromisedItemIsReachableAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll(this.ref.pointer, - _sel_checkPromisedItemIsReachableAndReturnError_, error); - } - - /// checkResourceIsReachableAndReturnError: - bool checkResourceIsReachableAndReturnError_( - ffi.Pointer> error) { - return _objc_msgSend_1rk90ll( - this.ref.pointer, _sel_checkResourceIsReachableAndReturnError_, error); - } - - /// dataRepresentation - NSData get dataRepresentation { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_dataRepresentation); - return NSData.castFromPointer(_ret, retain: true, release: true); - } - - /// encodeWithCoder: - void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( - this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); - } - - /// filePathURL - NSURL? get filePathURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_filePathURL); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// fileReferenceURL - NSURL? fileReferenceURL() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fileReferenceURL); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); - } - - /// fileSystemRepresentation - ffi.Pointer get fileSystemRepresentation { - return _objc_msgSend_1ypnhm3( - this.ref.pointer, _sel_fileSystemRepresentation); - } - /// fileURLWithFileSystemRepresentation:isDirectory:relativeToURL: static NSURL fileURLWithFileSystemRepresentation_isDirectory_relativeToURL_( ffi.Pointer path, bool isDir, NSURL? baseURL) { - final _ret = _objc_msgSend_ozgyxv( + final _ret = _objc_msgSend_qid8e9( _class_NSURL, _sel_fileURLWithFileSystemRepresentation_isDirectory_relativeToURL_, path, @@ -10142,14 +7821,14 @@ class NSURL extends NSObject { /// fileURLWithPath: static NSURL fileURLWithPath_(NSString path) { - final _ret = _objc_msgSend_juohf7( + final _ret = _objc_msgSend_62nh5j( _class_NSURL, _sel_fileURLWithPath_, path.ref.pointer); return NSURL.castFromPointer(_ret, retain: true, release: true); } /// fileURLWithPath:isDirectory: static NSURL fileURLWithPath_isDirectory_(NSString path, bool isDir) { - final _ret = _objc_msgSend_qqbb5y(_class_NSURL, + final _ret = _objc_msgSend_1bdmr5f(_class_NSURL, _sel_fileURLWithPath_isDirectory_, path.ref.pointer, isDir); return NSURL.castFromPointer(_ret, retain: true, release: true); } @@ -10157,7 +7836,7 @@ class NSURL extends NSObject { /// fileURLWithPath:isDirectory:relativeToURL: static NSURL fileURLWithPath_isDirectory_relativeToURL_( NSString path, bool isDir, NSURL? baseURL) { - final _ret = _objc_msgSend_a26wyd( + final _ret = _objc_msgSend_19v53ht( _class_NSURL, _sel_fileURLWithPath_isDirectory_relativeToURL_, path.ref.pointer, @@ -10168,7 +7847,7 @@ class NSURL extends NSObject { /// fileURLWithPath:relativeToURL: static NSURL fileURLWithPath_relativeToURL_(NSString path, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( _class_NSURL, _sel_fileURLWithPath_relativeToURL_, path.ref.pointer, @@ -10176,18 +7855,142 @@ class NSURL extends NSObject { return NSURL.castFromPointer(_ret, retain: true, release: true); } - /// fileURLWithPathComponents: - static NSURL? fileURLWithPathComponents_(NSArray components) { - final _ret = _objc_msgSend_juohf7( - _class_NSURL, _sel_fileURLWithPathComponents_, components.ref.pointer); + /// new + static NSURL new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURL, _sel_new); + return NSURL.castFromPointer(_ret, retain: false, release: true); + } + + /// objectWithItemProviderData:typeIdentifier:error: + static NSURL? objectWithItemProviderData_typeIdentifier_error_( + NSData data, + NSString typeIdentifier, + ffi.Pointer> outError) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSURL, + _sel_objectWithItemProviderData_typeIdentifier_error_, + data.ref.pointer, + typeIdentifier.ref.pointer, + outError); + return _ret.address == 0 + ? null + : NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// resourceValuesForKeys:fromBookmarkData: + static objc.ObjCObjectBase? resourceValuesForKeys_fromBookmarkData_( + NSArray keys, NSData bookmarkData) { + final _ret = _objc_msgSend_rsfdlh( + _class_NSURL, + _sel_resourceValuesForKeys_fromBookmarkData_, + keys.ref.pointer, + bookmarkData.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSURL, _sel_supportsSecureCoding); + } + + /// writeBookmarkData:toURL:options:error: + static bool writeBookmarkData_toURL_options_error_( + NSData bookmarkData, + NSURL bookmarkFileURL, + int options, + ffi.Pointer> error) { + return _objc_msgSend_vdkl2d( + _class_NSURL, + _sel_writeBookmarkData_toURL_options_error_, + bookmarkData.ref.pointer, + bookmarkFileURL.ref.pointer, + options, + error); + } + + /// absoluteString + NSString? get absoluteString { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_absoluteString); + return _ret.address == 0 + ? null + : NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// absoluteURL + NSURL? get absoluteURL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_absoluteURL); + return _ret.address == 0 + ? null + : NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// baseURL + NSURL? get baseURL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_baseURL); + return _ret.address == 0 + ? null + : NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error: + NSData? + bookmarkDataWithOptions_includingResourceValuesForKeys_relativeToURL_error_( + NSURLBookmarkCreationOptions options, + NSArray? keys, + NSURL? relativeURL, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1uj57oj( + this.ref.pointer, + _sel_bookmarkDataWithOptions_includingResourceValuesForKeys_relativeToURL_error_, + options.value, + keys?.ref.pointer ?? ffi.nullptr, + relativeURL?.ref.pointer ?? ffi.nullptr, + error); + return _ret.address == 0 + ? null + : NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// dataRepresentation + NSData get dataRepresentation { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_dataRepresentation); + return NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// encodeWithCoder: + void encodeWithCoder_(NSCoder coder) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); + } + + /// filePathURL + NSURL? get filePathURL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_filePathURL); + return _ret.address == 0 + ? null + : NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// fileReferenceURL + NSURL? fileReferenceURL() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_fileReferenceURL); return _ret.address == 0 ? null : NSURL.castFromPointer(_ret, retain: true, release: true); } + /// fileSystemRepresentation + ffi.Pointer get fileSystemRepresentation { + return _objc_msgSend_1fuqfwb( + this.ref.pointer, _sel_fileSystemRepresentation); + } + /// fragment NSString? get fragment { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_fragment); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_fragment); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10196,40 +7999,27 @@ class NSURL extends NSObject { /// getFileSystemRepresentation:maxLength: bool getFileSystemRepresentation_maxLength_( ffi.Pointer buffer, int maxBufferLength) { - return _objc_msgSend_z1lin0(this.ref.pointer, + return _objc_msgSend_8cymbm(this.ref.pointer, _sel_getFileSystemRepresentation_maxLength_, buffer, maxBufferLength); } - /// getPromisedItemResourceValue:forKey:error: - bool getPromisedItemResourceValue_forKey_error_( - ffi.Pointer> value, - NSString key, - ffi.Pointer> error) { - return _objc_msgSend_1tdtroe( - this.ref.pointer, - _sel_getPromisedItemResourceValue_forKey_error_, - value, - key.ref.pointer, - error); - } - /// getResourceValue:forKey:error: bool getResourceValue_forKey_error_( ffi.Pointer> value, NSString key, ffi.Pointer> error) { - return _objc_msgSend_1tdtroe(this.ref.pointer, + return _objc_msgSend_7iv28v(this.ref.pointer, _sel_getResourceValue_forKey_error_, value, key.ref.pointer, error); } /// hasDirectoryPath bool get hasDirectoryPath { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_hasDirectoryPath); + return _objc_msgSend_91o635(this.ref.pointer, _sel_hasDirectoryPath); } /// host NSString? get host { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_host); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_host); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10238,14 +8028,14 @@ class NSURL extends NSObject { /// init NSURL init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSURL.castFromPointer(_ret, retain: false, release: true); } /// initAbsoluteURLWithDataRepresentation:relativeToURL: NSURL initAbsoluteURLWithDataRepresentation_relativeToURL_( NSData data, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initAbsoluteURLWithDataRepresentation_relativeToURL_, data.ref.pointer, @@ -10261,7 +8051,7 @@ class NSURL extends NSObject { NSURL? relativeURL, ffi.Pointer isStale, ffi.Pointer> error) { - final _ret = _objc_msgSend_1bzaq3a( + final _ret = _objc_msgSend_3ems5q( this.ref.retainAndReturnPointer(), _sel_initByResolvingBookmarkData_options_relativeToURL_bookmarkDataIsStale_error_, bookmarkData.ref.pointer, @@ -10277,7 +8067,7 @@ class NSURL extends NSObject { /// initFileURLWithFileSystemRepresentation:isDirectory:relativeToURL: NSURL initFileURLWithFileSystemRepresentation_isDirectory_relativeToURL_( ffi.Pointer path, bool isDir, NSURL? baseURL) { - final _ret = _objc_msgSend_ozgyxv( + final _ret = _objc_msgSend_qid8e9( this.ref.retainAndReturnPointer(), _sel_initFileURLWithFileSystemRepresentation_isDirectory_relativeToURL_, path, @@ -10288,14 +8078,14 @@ class NSURL extends NSObject { /// initFileURLWithPath: NSURL initFileURLWithPath_(NSString path) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initFileURLWithPath_, path.ref.pointer); return NSURL.castFromPointer(_ret, retain: false, release: true); } /// initFileURLWithPath:isDirectory: NSURL initFileURLWithPath_isDirectory_(NSString path, bool isDir) { - final _ret = _objc_msgSend_qqbb5y(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), _sel_initFileURLWithPath_isDirectory_, path.ref.pointer, isDir); return NSURL.castFromPointer(_ret, retain: false, release: true); } @@ -10303,7 +8093,7 @@ class NSURL extends NSObject { /// initFileURLWithPath:isDirectory:relativeToURL: NSURL initFileURLWithPath_isDirectory_relativeToURL_( NSString path, bool isDir, NSURL? baseURL) { - final _ret = _objc_msgSend_a26wyd( + final _ret = _objc_msgSend_19v53ht( this.ref.retainAndReturnPointer(), _sel_initFileURLWithPath_isDirectory_relativeToURL_, path.ref.pointer, @@ -10314,7 +8104,7 @@ class NSURL extends NSObject { /// initFileURLWithPath:relativeToURL: NSURL initFileURLWithPath_relativeToURL_(NSString path, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initFileURLWithPath_relativeToURL_, path.ref.pointer, @@ -10324,7 +8114,7 @@ class NSURL extends NSObject { /// initWithCoder: NSURL? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null @@ -10333,7 +8123,7 @@ class NSURL extends NSObject { /// initWithDataRepresentation:relativeToURL: NSURL initWithDataRepresentation_relativeToURL_(NSData data, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initWithDataRepresentation_relativeToURL_, data.ref.pointer, @@ -10343,7 +8133,7 @@ class NSURL extends NSObject { /// initWithString: NSURL? initWithString_(NSString URLString) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithString_, URLString.ref.pointer); return _ret.address == 0 ? null @@ -10353,7 +8143,7 @@ class NSURL extends NSObject { /// initWithString:encodingInvalidCharacters: NSURL? initWithString_encodingInvalidCharacters_( NSString URLString, bool encodingInvalidCharacters) { - final _ret = _objc_msgSend_qqbb5y( + final _ret = _objc_msgSend_1bdmr5f( this.ref.retainAndReturnPointer(), _sel_initWithString_encodingInvalidCharacters_, URLString.ref.pointer, @@ -10365,7 +8155,7 @@ class NSURL extends NSObject { /// initWithString:relativeToURL: NSURL? initWithString_relativeToURL_(NSString URLString, NSURL? baseURL) { - final _ret = _objc_msgSend_iq11qg( + final _ret = _objc_msgSend_rsfdlh( this.ref.retainAndReturnPointer(), _sel_initWithString_relativeToURL_, URLString.ref.pointer, @@ -10377,71 +8167,17 @@ class NSURL extends NSObject { /// isFileReferenceURL bool isFileReferenceURL() { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isFileReferenceURL); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isFileReferenceURL); } /// isFileURL bool get fileURL { - return _objc_msgSend_olxnu1(this.ref.pointer, _sel_isFileURL); - } - - /// itemProviderVisibilityForRepresentationWithTypeIdentifier: - NSItemProviderRepresentationVisibility - itemProviderVisibilityForRepresentationWithTypeIdentifier_( - NSString typeIdentifier) { - if (!objc.respondsToSelector(ref.pointer, - _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_)) { - throw objc.UnimplementedOptionalMethodException('NSURL', - 'itemProviderVisibilityForRepresentationWithTypeIdentifier:'); - } - final _ret = _objc_msgSend_xnpl2w( - this.ref.pointer, - _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_, - typeIdentifier.ref.pointer); - return NSItemProviderRepresentationVisibility.fromValue(_ret); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURL, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// lastPathComponent - NSString? get lastPathComponent { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_lastPathComponent); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSURL new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURL, _sel_new); - return NSURL.castFromPointer(_ret, retain: false, release: true); - } - - /// objectWithItemProviderData:typeIdentifier:error: - static NSURL? objectWithItemProviderData_typeIdentifier_error_( - NSData data, - NSString typeIdentifier, - ffi.Pointer> outError) { - final _ret = _objc_msgSend_1lpsn5w( - _class_NSURL, - _sel_objectWithItemProviderData_typeIdentifier_error_, - data.ref.pointer, - typeIdentifier.ref.pointer, - outError); - return _ret.address == 0 - ? null - : NSURL.castFromPointer(_ret, retain: true, release: true); + return _objc_msgSend_91o635(this.ref.pointer, _sel_isFileURL); } /// parameterString NSString? get parameterString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_parameterString); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_parameterString); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10449,7 +8185,7 @@ class NSURL extends NSObject { /// password NSString? get password { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_password); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_password); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10457,23 +8193,7 @@ class NSURL extends NSObject { /// path NSString? get path { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_path); - return _ret.address == 0 - ? null - : NSString.castFromPointer(_ret, retain: true, release: true); - } - - /// pathComponents - NSArray? get pathComponents { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_pathComponents); - return _ret.address == 0 - ? null - : NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// pathExtension - NSString? get pathExtension { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_pathExtension); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_path); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10481,40 +8201,23 @@ class NSURL extends NSObject { /// port NSNumber? get port { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_port); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_port); return _ret.address == 0 ? null : NSNumber.castFromPointer(_ret, retain: true, release: true); } - /// promisedItemResourceValuesForKeys:error: - NSDictionary? promisedItemResourceValuesForKeys_error_( - NSArray keys, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, - _sel_promisedItemResourceValuesForKeys_error_, keys.ref.pointer, error); - return _ret.address == 0 - ? null - : NSDictionary.castFromPointer(_ret, retain: true, release: true); - } - /// query NSString? get query { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_query); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_query); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); } - /// readableTypeIdentifiersForItemProvider - static NSArray readableTypeIdentifiersForItemProvider() { - final _ret = _objc_msgSend_1unuoxw( - _class_NSURL, _sel_readableTypeIdentifiersForItemProvider); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - /// relativePath NSString? get relativePath { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_relativePath); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_relativePath); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10522,25 +8225,25 @@ class NSURL extends NSObject { /// relativeString NSString get relativeString { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_relativeString); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_relativeString); return NSString.castFromPointer(_ret, retain: true, release: true); } /// removeAllCachedResourceValues void removeAllCachedResourceValues() { - _objc_msgSend_ksby9f(this.ref.pointer, _sel_removeAllCachedResourceValues); + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_removeAllCachedResourceValues); } /// removeCachedResourceValueForKey: void removeCachedResourceValueForKey_(NSString key) { - _objc_msgSend_ukcdfq(this.ref.pointer, + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_removeCachedResourceValueForKey_, key.ref.pointer); } /// resourceSpecifier NSString? get resourceSpecifier { final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_resourceSpecifier); + _objc_msgSend_1x359cv(this.ref.pointer, _sel_resourceSpecifier); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10549,29 +8252,16 @@ class NSURL extends NSObject { /// resourceValuesForKeys:error: objc.ObjCObjectBase? resourceValuesForKeys_error_( NSArray keys, ffi.Pointer> error) { - final _ret = _objc_msgSend_1y425zh(this.ref.pointer, + final _ret = _objc_msgSend_1705co6(this.ref.pointer, _sel_resourceValuesForKeys_error_, keys.ref.pointer, error); return _ret.address == 0 ? null : objc.ObjCObjectBase(_ret, retain: true, release: true); } - /// resourceValuesForKeys:fromBookmarkData: - static objc.ObjCObjectBase? resourceValuesForKeys_fromBookmarkData_( - NSArray keys, NSData bookmarkData) { - final _ret = _objc_msgSend_iq11qg( - _class_NSURL, - _sel_resourceValuesForKeys_fromBookmarkData_, - keys.ref.pointer, - bookmarkData.ref.pointer); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - /// scheme NSString? get scheme { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_scheme); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_scheme); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); @@ -10580,7 +8270,7 @@ class NSURL extends NSObject { /// setResourceValue:forKey:error: bool setResourceValue_forKey_error_(objc.ObjCObjectBase? value, NSString key, ffi.Pointer> error) { - return _objc_msgSend_6toz8x( + return _objc_msgSend_6h48uq( this.ref.pointer, _sel_setResourceValue_forKey_error_, value?.ref.pointer ?? ffi.nullptr, @@ -10591,14 +8281,14 @@ class NSURL extends NSObject { /// setResourceValues:error: bool setResourceValues_error_(objc.ObjCObjectBase keyedValues, ffi.Pointer> error) { - return _objc_msgSend_p02k6o(this.ref.pointer, _sel_setResourceValues_error_, + return _objc_msgSend_blqzg8(this.ref.pointer, _sel_setResourceValues_error_, keyedValues.ref.pointer, error); } /// setTemporaryResourceValue:forKey: void setTemporaryResourceValue_forKey_( objc.ObjCObjectBase? value, NSString key) { - _objc_msgSend_1tjlcwl( + _objc_msgSend_wjvic9( this.ref.pointer, _sel_setTemporaryResourceValue_forKey_, value?.ref.pointer ?? ffi.nullptr, @@ -10607,7 +8297,7 @@ class NSURL extends NSObject { /// standardizedURL NSURL? get standardizedURL { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_standardizedURL); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_standardizedURL); return _ret.address == 0 ? null : NSURL.castFromPointer(_ret, retain: true, release: true); @@ -10615,56 +8305,24 @@ class NSURL extends NSObject { /// startAccessingSecurityScopedResource bool startAccessingSecurityScopedResource() { - return _objc_msgSend_olxnu1( + return _objc_msgSend_91o635( this.ref.pointer, _sel_startAccessingSecurityScopedResource); } /// stopAccessingSecurityScopedResource void stopAccessingSecurityScopedResource() { - _objc_msgSend_ksby9f( + _objc_msgSend_1pl9qdv( this.ref.pointer, _sel_stopAccessingSecurityScopedResource); } - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSURL, _sel_supportsSecureCoding); - } - /// user NSString? get user { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_user); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_user); return _ret.address == 0 ? null : NSString.castFromPointer(_ret, retain: true, release: true); } - - /// writableTypeIdentifiersForItemProvider - NSArray writableTypeIdentifiersForItemProvider() { - if (!objc.respondsToSelector( - ref.pointer, _sel_writableTypeIdentifiersForItemProvider)) { - throw objc.UnimplementedOptionalMethodException( - 'NSURL', 'writableTypeIdentifiersForItemProvider'); - } - final _ret = _objc_msgSend_1unuoxw( - this.ref.pointer, _sel_writableTypeIdentifiersForItemProvider); - return NSArray.castFromPointer(_ret, retain: true, release: true); - } - - /// writeBookmarkData:toURL:options:error: - static bool writeBookmarkData_toURL_options_error_( - NSData bookmarkData, - NSURL bookmarkFileURL, - int options, - ffi.Pointer> error) { - return _objc_msgSend_oihbep( - _class_NSURL, - _sel_writeBookmarkData_toURL_options_error_, - bookmarkData.ref.pointer, - bookmarkFileURL.ref.pointer, - options, - error); - } -} +} enum NSURLBookmarkCreationOptions { NSURLBookmarkCreationPreferFileIDResolution(256), @@ -10725,64 +8383,51 @@ class NSURLHandle extends NSObject { /// Returns whether [obj] is an instance of [NSURLHandle]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLHandle); } /// alloc static NSURLHandle alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLHandle, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSURLHandle, _sel_alloc); return NSURLHandle.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSURLHandle allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSURLHandle, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSURLHandle, _sel_allocWithZone_, zone); return NSURLHandle.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSURLHandle, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// new + static NSURLHandle new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLHandle, _sel_new); + return NSURLHandle.castFromPointer(_ret, retain: false, release: true); } /// autorelease NSURLHandle autorelease() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_autorelease); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); return NSURLHandle.castFromPointer(_ret, retain: true, release: true); } /// init NSURLHandle init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); - return NSURLHandle.castFromPointer(_ret, retain: false, release: true); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSURLHandle, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSURLHandle new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSURLHandle, _sel_new); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSURLHandle.castFromPointer(_ret, retain: false, release: true); } /// retain NSURLHandle retain() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_retain); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); return NSURLHandle.castFromPointer(_ret, retain: true, release: true); } /// self NSURLHandle self() { - final _ret = _objc_msgSend_1unuoxw(this.ref.pointer, _sel_self); + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); return NSURLHandle.castFromPointer(_ret, retain: true, release: true); } } @@ -10822,347 +8467,73 @@ class NSValue extends NSObject { /// Returns whether [obj] is an instance of [NSValue]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_NSValue); } /// alloc static NSValue alloc() { - final _ret = _objc_msgSend_1unuoxw(_class_NSValue, _sel_alloc); + final _ret = _objc_msgSend_1x359cv(_class_NSValue, _sel_alloc); return NSValue.castFromPointer(_ret, retain: false, release: true); } /// allocWithZone: static NSValue allocWithZone_(ffi.Pointer<_NSZone> zone) { final _ret = - _objc_msgSend_1b3ihd0(_class_NSValue, _sel_allocWithZone_, zone); + _objc_msgSend_hzlb60(_class_NSValue, _sel_allocWithZone_, zone); + return NSValue.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSValue new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSValue, _sel_new); return NSValue.castFromPointer(_ret, retain: false, release: true); } - /// automaticallyNotifiesObserversForKey: - static bool automaticallyNotifiesObserversForKey_(NSString key) { - return _objc_msgSend_l8lotg(_class_NSValue, - _sel_automaticallyNotifiesObserversForKey_, key.ref.pointer); + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSValue, _sel_supportsSecureCoding); } /// encodeWithCoder: void encodeWithCoder_(NSCoder coder) { - _objc_msgSend_ukcdfq( + _objc_msgSend_1jdvcbf( this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); } - /// getValue: - void getValue_(ffi.Pointer value) { - _objc_msgSend_hepzs(this.ref.pointer, _sel_getValue_, value); - } - /// getValue:size: void getValue_size_(ffi.Pointer value, int size) { - _objc_msgSend_vzqe8w(this.ref.pointer, _sel_getValue_size_, value, size); + _objc_msgSend_zuf90e(this.ref.pointer, _sel_getValue_size_, value, size); } /// init NSValue init() { final _ret = - _objc_msgSend_1unuoxw(this.ref.retainAndReturnPointer(), _sel_init); + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); return NSValue.castFromPointer(_ret, retain: false, release: true); } /// initWithBytes:objCType: NSValue initWithBytes_objCType_( ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_qtxoq7(this.ref.retainAndReturnPointer(), _sel_initWithBytes_objCType_, value, type); return NSValue.castFromPointer(_ret, retain: false, release: true); } /// initWithCoder: NSValue? initWithCoder_(NSCoder coder) { - final _ret = _objc_msgSend_juohf7(this.ref.retainAndReturnPointer(), + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), _sel_initWithCoder_, coder.ref.pointer); return _ret.address == 0 ? null : NSValue.castFromPointer(_ret, retain: false, release: true); } - /// isEqualToValue: - bool isEqualToValue_(NSValue value) { - return _objc_msgSend_l8lotg( - this.ref.pointer, _sel_isEqualToValue_, value.ref.pointer); - } - - /// keyPathsForValuesAffectingValueForKey: - static NSSet keyPathsForValuesAffectingValueForKey_(NSString key) { - final _ret = _objc_msgSend_juohf7(_class_NSValue, - _sel_keyPathsForValuesAffectingValueForKey_, key.ref.pointer); - return NSSet.castFromPointer(_ret, retain: true, release: true); - } - - /// new - static NSValue new1() { - final _ret = _objc_msgSend_1unuoxw(_class_NSValue, _sel_new); - return NSValue.castFromPointer(_ret, retain: false, release: true); - } - - /// nonretainedObjectValue - objc.ObjCObjectBase? get nonretainedObjectValue { - final _ret = - _objc_msgSend_1unuoxw(this.ref.pointer, _sel_nonretainedObjectValue); - return _ret.address == 0 - ? null - : objc.ObjCObjectBase(_ret, retain: true, release: true); - } - /// objCType ffi.Pointer get objCType { - return _objc_msgSend_1ypnhm3(this.ref.pointer, _sel_objCType); - } - - /// pointerValue - ffi.Pointer get pointerValue { - return _objc_msgSend_1578rxt(this.ref.pointer, _sel_pointerValue); - } - - /// rangeValue - NSRange get rangeValue { - final _ptr = pkg_ffi.calloc(); - objc.useMsgSendVariants - ? _objc_msgSend_vi3lefStret(_ptr, this.ref.pointer, _sel_rangeValue) - : _ptr.ref = _objc_msgSend_vi3lef(this.ref.pointer, _sel_rangeValue); - final _finalizable = _ptr.cast().asTypedList( - ffi.sizeOf(), - finalizer: pkg_ffi.calloc.nativeFree); - return ffi.Struct.create(_finalizable); - } - - /// supportsSecureCoding - static bool supportsSecureCoding() { - return _objc_msgSend_olxnu1(_class_NSValue, _sel_supportsSecureCoding); - } - - /// value:withObjCType: - static NSValue value_withObjCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSValue, _sel_value_withObjCType_, value, type); - return NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithBytes:objCType: - static NSValue valueWithBytes_objCType_( - ffi.Pointer value, ffi.Pointer type) { - final _ret = _objc_msgSend_1sdw29g( - _class_NSValue, _sel_valueWithBytes_objCType_, value, type); - return NSValue.castFromPointer(_ret, retain: true, release: true); + return _objc_msgSend_1fuqfwb(this.ref.pointer, _sel_objCType); } - - /// valueWithNonretainedObject: - static NSValue valueWithNonretainedObject_(objc.ObjCObjectBase? anObject) { - final _ret = _objc_msgSend_juohf7(_class_NSValue, - _sel_valueWithNonretainedObject_, anObject?.ref.pointer ?? ffi.nullptr); - return NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithPointer: - static NSValue valueWithPointer_(ffi.Pointer pointer) { - final _ret = - _objc_msgSend_1ph8ubj(_class_NSValue, _sel_valueWithPointer_, pointer); - return NSValue.castFromPointer(_ret, retain: true, release: true); - } - - /// valueWithRange: - static NSValue valueWithRange_(NSRange range) { - final _ret = - _objc_msgSend_176f8tz(_class_NSValue, _sel_valueWithRange_, range); - return NSValue.castFromPointer(_ret, retain: true, release: true); - } -} - -ffi.Pointer _ObjCBlock_NSArray_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSArray_ffiVoid_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSArray_ffiVoid_fnPtrTrampoline) - .cast(); -ffi.Pointer _ObjCBlock_NSArray_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSArray_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSArray_ffiVoid_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_NSArray_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_NSArray_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunction( - NSArray Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_NSArray_ffiVoid_closureCallable, - (ffi.Pointer arg0) => - fn(arg0).ref.retainAndAutorelease()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_NSArray_ffiVoid_CallExtension - on objc.ObjCBlock)> { - NSArray call(ffi.Pointer arg0) => NSArray.castFromPointer( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0), - retain: true, - release: true); -} - -int _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(arg0, arg1); -ffi.Pointer - _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrTrampoline, - 0) - .cast(); -int _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1) => - (objc.getBlockClosure(block) as int Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer - _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureTrampoline, - 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock, NSString)>`. -abstract final class ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString { - /// Returns a block that wraps the given raw block pointer. - static objc - .ObjCBlock, NSString)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - ffi.UnsignedLong Function(ffi.Pointer, - NSString)>(pointer, retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, NSString)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0, - ffi.Pointer arg1)>> - ptr) => - objc.ObjCBlock, NSString)>( - objc.newPointerBlock(_ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock, NSString)> fromFunction( - NSItemProviderRepresentationVisibility Function( - ffi.Pointer, NSString) - fn) => - objc.ObjCBlock, NSString)>( - objc.newClosureBlock( - _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1) => - fn(arg0, NSString.castFromPointer(arg1, retain: true, release: true)) - .value), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock, NSString)>`. -extension ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_CallExtension - on objc - .ObjCBlock, NSString)> { - NSItemProviderRepresentationVisibility call( - ffi.Pointer arg0, NSString arg1) => - NSItemProviderRepresentationVisibility.fromValue(ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>()( - ref.pointer, arg0, arg1.ref.pointer)); } ffi.Pointer _ObjCBlock_NSString_ffiVoid_fnPtrTrampoline( @@ -11252,38 +8623,36 @@ extension ObjCBlock_NSString_ffiVoid_CallExtension release: true); } -ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline( +int _ObjCBlock_NSUInteger_ffiVoid_fnPtrTrampoline( ffi.Pointer block, ffi.Pointer arg0) => block.ref.target .cast< ffi.NativeFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer)>()(arg0); -ffi.Pointer _ObjCBlock_NSZone_ffiVoid_fnPtrCallable = + ffi.UnsignedLong Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_NSUInteger_ffiVoid_fnPtrCallable = ffi.Pointer.fromFunction< - ffi.Pointer<_NSZone> Function( + ffi.UnsignedLong Function( ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline) + _ObjCBlock_NSUInteger_ffiVoid_fnPtrTrampoline, 0) .cast(); -ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_closureTrampoline( +int _ObjCBlock_NSUInteger_ffiVoid_closureTrampoline( ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as ffi.Pointer<_NSZone> Function( - ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_NSZone_ffiVoid_closureCallable = + (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_NSUInteger_ffiVoid_closureCallable = ffi.Pointer.fromFunction< - ffi.Pointer<_NSZone> Function( + ffi.UnsignedLong Function( ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_NSZone_ffiVoid_closureTrampoline) + _ObjCBlock_NSUInteger_ffiVoid_closureTrampoline, 0) .cast(); -/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. -abstract final class ObjCBlock_NSZone_ffiVoid { +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_NSUInteger_ffiVoid { /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock Function(ffi.Pointer)> + static objc.ObjCBlock)> castFromPointer(ffi.Pointer pointer, {bool retain = false, bool release = false}) => - objc.ObjCBlock Function(ffi.Pointer)>( + objc.ObjCBlock)>( pointer, retain: retain, release: release); @@ -11293,15 +8662,15 @@ abstract final class ObjCBlock_NSZone_ffiVoid { /// This block must be invoked by native code running on the same thread as /// the isolate that registered it. Invoking the block on the wrong thread /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> + static objc.ObjCBlock)> fromFunctionPointer( ffi.Pointer< ffi.NativeFunction< - ffi.Pointer<_NSZone> Function( + ffi.UnsignedLong Function( ffi.Pointer arg0)>> ptr) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newPointerBlock(_ObjCBlock_NSZone_ffiVoid_fnPtrCallable, ptr.cast()), + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_NSUInteger_ffiVoid_fnPtrCallable, ptr.cast()), retain: false, release: true); @@ -11310,32 +8679,257 @@ abstract final class ObjCBlock_NSZone_ffiVoid { /// This block must be invoked by native code running on the same thread as /// the isolate that registered it. Invoking the block on the wrong thread /// will result in a crash. - static objc.ObjCBlock Function(ffi.Pointer)> - fromFunction(ffi.Pointer<_NSZone> Function(ffi.Pointer) fn) => - objc.ObjCBlock Function(ffi.Pointer)>( - objc.newClosureBlock(_ObjCBlock_NSZone_ffiVoid_closureCallable, + static objc.ObjCBlock)> + fromFunction(int Function(ffi.Pointer) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_NSUInteger_ffiVoid_closureCallable, (ffi.Pointer arg0) => fn(arg0)), retain: false, release: true); } -/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. -extension ObjCBlock_NSZone_ffiVoid_CallExtension - on objc.ObjCBlock Function(ffi.Pointer)> { - ffi.Pointer<_NSZone> call(ffi.Pointer arg0) => - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -bool _ObjCBlock_bool_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_NSUInteger_ffiVoid_CallExtension + on objc.ObjCBlock)> { + int call(ffi.Pointer arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0); +} + +int _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + int arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + ffi.UnsignedLong arg3)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>( + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrTrampoline, + 0) + .cast(); +int _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + int arg3) => + (objc.getBlockClosure(block) as int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureCallable = + ffi.Pointer.fromFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>( + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureTrampoline, + 0) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. +abstract final class ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, ffi.UnsignedLong arg3)>> ptr) => + objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>( + objc.newPointerBlock(_ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> fromFunction(int Function(ffi.Pointer, ffi.Pointer, ffi.Pointer>, int) fn) => + objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>( + objc.newClosureBlock( + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, int arg3) => + fn(arg0, arg1, arg2, arg3)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. +extension ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_CallExtension + on objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> { + int call(ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer> arg2, int arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + ffi.UnsignedLong arg3)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>()(ref.pointer, arg0, arg1, arg2, arg3); +} + +ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer<_NSZone> Function(ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer<_NSZone> Function(ffi.Pointer)>()(arg0); +ffi.Pointer _ObjCBlock_NSZone_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer<_NSZone> Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSZone_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer<_NSZone> _ObjCBlock_NSZone_ffiVoid_closureTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + (objc.getBlockClosure(block) as ffi.Pointer<_NSZone> Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_NSZone_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer<_NSZone> Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSZone_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. +abstract final class ObjCBlock_NSZone_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock Function(ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock Function(ffi.Pointer)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock Function(ffi.Pointer)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer<_NSZone> Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock Function(ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_NSZone_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock Function(ffi.Pointer)> + fromFunction(ffi.Pointer<_NSZone> Function(ffi.Pointer) fn) => + objc.ObjCBlock Function(ffi.Pointer)>( + objc.newClosureBlock(_ObjCBlock_NSZone_ffiVoid_closureCallable, + (ffi.Pointer arg0) => fn(arg0)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. +extension ObjCBlock_NSZone_ffiVoid_CallExtension + on objc.ObjCBlock Function(ffi.Pointer)> { + ffi.Pointer<_NSZone> call(ffi.Pointer arg0) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer<_NSZone> Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer<_NSZone> Function(ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0); +} + +bool _ObjCBlock_bool_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => block.ref.target .cast< ffi.NativeFunction arg0)>>() @@ -11701,157 +9295,98 @@ extension ObjCBlock_bool_ffiVoid_objcObjCSelector_CallExtension ffi.Pointer)>()(ref.pointer, arg0, arg1); } -int _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>>() - .asFunction)>()(arg0); -ffi.Pointer _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrCallable = +void + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrCallable = ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrTrampoline, 0) + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrTrampoline) .cast(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_closureTrampoline( - ffi.Pointer block, ffi.Pointer arg0) => - (objc.getBlockClosure(block) as int Function(ffi.Pointer))(arg0); -ffi.Pointer _ObjCBlock_ffiUnsignedLong_ffiVoid_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_closureTrampoline, 0) - .cast(); - -/// Construction methods for `objc.ObjCBlock)>`. -abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock)>( - pointer, - retain: retain, - release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> fromFunctionPointer( - ffi.Pointer< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer arg0)>> - ptr) => - objc.ObjCBlock)>( - objc.newPointerBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock)> - fromFunction(int Function(ffi.Pointer) fn) => - objc.ObjCBlock)>( - objc.newClosureBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_closureCallable, - (ffi.Pointer arg0) => fn(arg0)), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock)>`. -extension ObjCBlock_ffiUnsignedLong_ffiVoid_CallExtension - on objc.ObjCBlock)> { - int call(ffi.Pointer arg0) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer block, - ffi.Pointer arg0)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer)>()(ref.pointer, arg0); -} - -int _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - ffi.UnsignedLong arg3)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>()(arg0, arg1, arg2, arg3); +void + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); ffi.Pointer - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrCallable = + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureCallable = ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( + ffi.Void Function( ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrTrampoline, - 0) - .cast(); -int _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - int arg3) => - (objc.getBlockClosure(block) as int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int))(arg0, arg1, arg2, arg3); -ffi.Pointer - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureCallable = - ffi.Pointer.fromFunction< - ffi.UnsignedLong Function( ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureTrampoline, - 0) + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureTrampoline) .cast(); +void + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} -/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. -abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong { +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock?, NSError)>, ffi.Pointer, NSDictionary)>`. +abstract final class ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary { /// Returns a block that wraps the given raw block pointer. static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>, + ffi.Pointer, + NSDictionary)> + castFromPointer(ffi.Pointer pointer, {bool retain = false, bool release = false}) => objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>(pointer, retain: retain, release: release); + ffi.Void Function( + objc.ObjCBlock?, NSError)>, + ffi.Pointer, + NSDictionary)>(pointer, retain: retain, release: release); /// Creates a block from a C function pointer. /// @@ -11859,68 +9394,111 @@ abstract final class ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_ob /// the isolate that registered it. Invoking the block on the wrong thread /// will result in a crash. static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> - fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, ffi.UnsignedLong arg3)>> ptr) => + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>, + ffi.Pointer, + NSDictionary)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>( - objc.newPointerBlock(_ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_fnPtrCallable, ptr.cast()), - retain: false, - release: true); + ffi.Void Function( + objc.ObjCBlock?, NSError)>, + ffi.Pointer, + NSDictionary)>(objc.newPointerBlock(_ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrCallable, ptr.cast()), retain: false, release: true); /// Creates a block from a Dart function. /// /// This block must be invoked by native code running on the same thread as /// the isolate that registered it. Invoking the block on the wrong thread /// will result in a crash. + static objc.ObjCBlock?, NSError)>, ffi.Pointer, NSDictionary)> + fromFunction(void Function(objc.ObjCBlock?, NSError)>, objc.ObjCObjectBase, NSDictionary) fn) => + objc.ObjCBlock?, NSError)>, ffi.Pointer, NSDictionary)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + ObjCBlock_ffiVoid_objcObjCObject_NSError.castFromPointer(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true), + NSDictionary.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. static objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> fromFunction(int Function(ffi.Pointer, ffi.Pointer, ffi.Pointer>, int) fn) => - objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>( - objc.newClosureBlock( - _ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_closureCallable, - (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, int arg3) => - fn(arg0, arg1, arg2, arg3)), - retain: false, - release: true); + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>, + ffi.Pointer, + NSDictionary)> listener( + void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>, + objc.ObjCObjectBase, + NSDictionary) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + ObjCBlock_ffiVoid_objcObjCObject_NSError.castFromPointer(arg0, + retain: false, release: true), + objc.ObjCObjectBase(arg1, retain: false, release: true), + NSDictionary.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _ObjectiveCBindings_wrapListenerBlock_1j2nt86(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>, + ffi.Pointer, + NSDictionary)>(wrapper, retain: false, release: true); + } } -/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. -extension ObjCBlock_ffiUnsignedLong_ffiVoid_NSFastEnumerationState_objcObjCObject_ffiUnsignedLong_CallExtension +/// Call operator for `objc.ObjCBlock?, NSError)>, ffi.Pointer, NSDictionary)>`. +extension ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_CallExtension on objc.ObjCBlock< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)> { - int call(ffi.Pointer arg0, ffi.Pointer arg1, - ffi.Pointer> arg2, int arg3) => + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>, + ffi.Pointer, + NSDictionary)> { + void call( + objc.ObjCBlock?, NSError)> + arg0, + objc.ObjCObjectBase arg1, + NSDictionary arg2) => ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer arg1, - ffi.Pointer> arg2, - ffi.UnsignedLong arg3)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>()(ref.pointer, arg0, arg1, arg2, arg3); + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2.ref.pointer); } void _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline( @@ -12011,7 +9589,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_ffiVoid_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(arg0)); - final wrapper = _ObjectiveCBindings_wrapListenerBlock_hepzs(raw); + final wrapper = _ObjectiveCBindings_wrapListenerBlock_ovsamd(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock)>(wrapper, retain: false, release: true); @@ -12140,7 +9718,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid_NSCoder { .cast(), (ffi.Pointer arg0, ffi.Pointer arg1) => fn( arg0, NSCoder.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _ObjectiveCBindings_wrapListenerBlock_sjfpmz(raw); + final wrapper = _ObjectiveCBindings_wrapListenerBlock_wjovn7(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock, NSCoder)>( wrapper, @@ -12303,7 +9881,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid_NSStream_NSStreamEvent { arg0, NSStream.castFromPointer(arg1, retain: false, release: true), NSStreamEvent.fromValue(arg2))); - final wrapper = _ObjectiveCBindings_wrapListenerBlock_m1viep(raw); + final wrapper = _ObjectiveCBindings_wrapListenerBlock_18d6mda(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer, NSStream, @@ -12332,41 +9910,193 @@ extension ObjCBlock_ffiVoid_ffiVoid_NSStream_NSStreamEvent_CallExtension int)>()(ref.pointer, arg0, arg1.ref.pointer, arg2.value); } -instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline( +void _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline( ffi.Pointer block, - ffi.Pointer arg0, + ffi.Pointer arg0, ffi.Pointer arg1) => block.ref.target .cast< ffi.NativeFunction< - instancetype Function(ffi.Pointer arg0, + ffi.Void Function(ffi.Pointer arg0, ffi.Pointer arg1)>>() .asFunction< - instancetype Function(ffi.Pointer, + void Function(ffi.Pointer, ffi.Pointer)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable = +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable = ffi.Pointer.fromFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline) + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline) .cast(); -instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline( +void _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline( ffi.Pointer block, - ffi.Pointer arg0, + ffi.Pointer arg0, ffi.Pointer arg1) => - (objc.getBlockClosure(block) as instancetype Function( - ffi.Pointer, ffi.Pointer))(arg0, arg1); -ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable = + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable = ffi.Pointer.fromFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>( - _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline) + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline) .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} -/// Construction methods for `objc.ObjCBlock?> Function(ffi.Pointer, NSCoder)>`. -abstract final class ObjCBlock_instancetype_ffiVoid_NSCoder { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock?, NSError)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock?, NSError)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, + NSError)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?, NSError)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock?, NSError)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?, NSError)> fromFunction( + void Function(objc.ObjCObjectBase?, NSError) fn) => + objc.ObjCBlock?, NSError)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1) => + fn( + arg0.address == 0 + ? null + : objc.ObjCObjectBase(arg0, retain: true, release: true), + NSError.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc + .ObjCBlock?, NSError)> + listener(void Function(objc.ObjCObjectBase?, NSError) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1) => + fn( + arg0.address == 0 + ? null + : objc.ObjCObjectBase(arg0, retain: false, release: true), + NSError.castFromPointer(arg1, retain: false, release: true))); + final wrapper = _ObjectiveCBindings_wrapListenerBlock_wjvic9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, NSError)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock?, NSError)>`. +extension ObjCBlock_ffiVoid_objcObjCObject_NSError_CallExtension on objc + .ObjCBlock?, NSError)> { + void call(objc.ObjCObjectBase? arg0, NSError arg1) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1.ref.pointer); +} + +instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + instancetype Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + instancetype Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable = + ffi.Pointer.fromFunction< + instancetype Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline) + .cast(); +instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as instancetype Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable = + ffi.Pointer.fromFunction< + instancetype Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock?> Function(ffi.Pointer, NSCoder)>`. +abstract final class ObjCBlock_instancetype_ffiVoid_NSCoder { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< objc.Retained?> Function( ffi.Pointer, NSCoder)> castFromPointer(ffi.Pointer pointer, @@ -12679,116 +10409,6 @@ extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension on objc release: true); } -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1) => - block.ref.target - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>()(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrTrampoline) - .cast(); -ffi.Pointer - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureTrampoline( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1) => - (objc.getBlockClosure(block) as ffi.Pointer Function( - ffi.Pointer, ffi.Pointer<_NSZone>))(arg0, arg1); -ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureCallable = - ffi.Pointer.fromFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureTrampoline) - .cast(); - -/// Construction methods for `objc.ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)>`. -abstract final class ObjCBlock_objcObjCObject_ffiVoid_NSZone { - /// Returns a block that wraps the given raw block pointer. - static objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> - castFromPointer(ffi.Pointer pointer, - {bool retain = false, bool release = false}) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>(pointer, - retain: retain, release: release); - - /// Creates a block from a C function pointer. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> - fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1)>> ptr) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>( - objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_NSZone_fnPtrCallable, ptr.cast()), - retain: false, - release: true); - - /// Creates a block from a Dart function. - /// - /// This block must be invoked by native code running on the same thread as - /// the isolate that registered it. Invoking the block on the wrong thread - /// will result in a crash. - static objc - .ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)> - fromFunction(objc.ObjCObjectBase Function(ffi.Pointer, ffi.Pointer<_NSZone>) fn) => - objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)>( - objc.newClosureBlock( - _ObjCBlock_objcObjCObject_ffiVoid_NSZone_closureCallable, - (ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1) => - fn(arg0, arg1).ref.retainAndReturnPointer()), - retain: false, - release: true); -} - -/// Call operator for `objc.ObjCBlock> Function(ffi.Pointer, ffi.Pointer<_NSZone>)>`. -extension ObjCBlock_objcObjCObject_ffiVoid_NSZone_CallExtension - on objc.ObjCBlock< - objc.Retained> Function( - ffi.Pointer, ffi.Pointer<_NSZone>)> { - objc.ObjCObjectBase call( - ffi.Pointer arg0, ffi.Pointer<_NSZone> arg1) => - objc.ObjCObjectBase( - ref.pointer.ref.invoke - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer block, - ffi.Pointer arg0, - ffi.Pointer<_NSZone> arg1)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer<_NSZone>)>()(ref.pointer, arg0, arg1), - retain: false, - release: true); -} - ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_objcObjCSelector_fnPtrTrampoline( ffi.Pointer block, @@ -13200,17 +10820,18 @@ class Protocol extends objc.ObjCObjectBase { /// Returns whether [obj] is an instance of [Protocol]. static bool isInstance(objc.ObjCObjectBase obj) { - return _objc_msgSend_l8lotg( + return _objc_msgSend_69e0x1( obj.ref.pointer, _sel_isKindOfClass_, _class_Protocol); } } final class _NSZone extends ffi.Opaque {} -late final _class_DartInputStreamAdapter = - objc.getClass("DartInputStreamAdapter"); -late final _class_DartProxy = objc.getClass("DartProxy"); -late final _class_DartProxyBuilder = objc.getClass("DartProxyBuilder"); +late final _class_DOBJCDartInputStreamAdapter = + objc.getClass("DOBJCDartInputStreamAdapter"); +late final _class_DOBJCDartProxy = objc.getClass("DOBJCDartProxy"); +late final _class_DOBJCDartProxyBuilder = + objc.getClass("DOBJCDartProxyBuilder"); late final _class_NSArray = objc.getClass("NSArray"); late final _class_NSCharacterSet = objc.getClass("NSCharacterSet"); late final _class_NSCoder = objc.getClass("NSCoder"); @@ -13226,974 +10847,246 @@ late final _class_NSItemProvider = objc.getClass("NSItemProvider"); late final _class_NSLocale = objc.getClass("NSLocale"); late final _class_NSMethodSignature = objc.getClass("NSMethodSignature"); late final _class_NSMutableArray = objc.getClass("NSMutableArray"); -late final _class_NSMutableData = objc.getClass("NSMutableData"); -late final _class_NSMutableDictionary = objc.getClass("NSMutableDictionary"); -late final _class_NSMutableIndexSet = objc.getClass("NSMutableIndexSet"); -late final _class_NSMutableOrderedSet = objc.getClass("NSMutableOrderedSet"); -late final _class_NSMutableSet = objc.getClass("NSMutableSet"); -late final _class_NSMutableString = objc.getClass("NSMutableString"); -late final _class_NSNotification = objc.getClass("NSNotification"); -late final _class_NSNumber = objc.getClass("NSNumber"); -late final _class_NSObject = objc.getClass("NSObject"); -late final _class_NSOrderedSet = objc.getClass("NSOrderedSet"); -late final _class_NSOutputStream = objc.getClass("NSOutputStream"); -late final _class_NSProxy = objc.getClass("NSProxy"); -late final _class_NSRunLoop = objc.getClass("NSRunLoop"); -late final _class_NSSet = objc.getClass("NSSet"); -late final _class_NSStream = objc.getClass("NSStream"); -late final _class_NSString = objc.getClass("NSString"); -late final _class_NSURL = objc.getClass("NSURL"); -late final _class_NSURLHandle = objc.getClass("NSURLHandle"); -late final _class_NSValue = objc.getClass("NSValue"); -late final _class_Protocol = objc.getClass("Protocol"); -final _objc_msgSend_105o5we = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_10noklm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_10noklmFpret = objc.msgSendFpretPointer - .cast< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_11hffth = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>(); -final _objc_msgSend_11w1eba = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - NSRange, - ffi.Pointer, - NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - NSRange, - ffi.Pointer, - NSRange)>(); -final _objc_msgSend_122gbai = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedShort)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_12790oz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1294bp9 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -final _objc_msgSend_129zzcm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -final _objc_msgSend_14is8x5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -final _objc_msgSend_1578rxt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_157j54x = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Short Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_15di41h = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Short)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_16nmq1c = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>, - ffi.Pointer)>(); -final _objc_msgSend_171owuh = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Char Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_176f8tz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, NSRange)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, NSRange)>(); -final _objc_msgSend_17fkh4i = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_17gxu27 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool)>(); -final _objc_msgSend_17qtp0o = objc.msgSendPointer - .cast< - ffi.NativeFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSRange, - ffi.Pointer)>>() - .asFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - NSRange, - ffi.Pointer)>(); -final _objc_msgSend_17qtp0oStret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSRange, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - NSRange, - ffi.Pointer)>(); -final _objc_msgSend_17tek7t = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - NSRange, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, NSRange, ffi.Pointer)>(); -final _objc_msgSend_17v6vbw = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_183c8xv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_18qbbjk = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - NSRange)>(); -final _objc_msgSend_18rrpy = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -final _objc_msgSend_1a4j45m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -final _objc_msgSend_1ar9f5m = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedChar)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_1b3ihd0 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<_NSZone>)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer<_NSZone>)>(); -final _objc_msgSend_1btrt37 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong, ffi.Bool)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, bool)>(); -final _objc_msgSend_1bzaq3a = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_1cirwn8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLongLong Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1crn9hn = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.Uint8)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_1cswds = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedChar Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1d0rqol = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer>)>(); -final _objc_msgSend_1dostih = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_1dw56bx = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool, - NSRange, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - bool, - NSRange, - ffi.Pointer)>(); -final _objc_msgSend_1e32dnv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_1ea4mhr = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int, int)>(); -final _objc_msgSend_1eigyr6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_1el0by7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>>() - .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>(); -final _objc_msgSend_1ev9yls = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_1f2tuqz = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_1g0atks = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - NSRange, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - NSRange, - ffi.Pointer)>(); -final _objc_msgSend_1g3ang8 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_1h339ej = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_1hfngdd = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer, NSRange)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, NSRange)>(); -final _objc_msgSend_1hjrbws = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_1idnlsy = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.UnsignedLong, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - int, - bool)>(); -final _objc_msgSend_1ile2ev = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1j6yja6 = objc.msgSendPointer +late final _class_NSMutableData = objc.getClass("NSMutableData"); +late final _class_NSMutableDictionary = objc.getClass("NSMutableDictionary"); +late final _class_NSMutableIndexSet = objc.getClass("NSMutableIndexSet"); +late final _class_NSMutableOrderedSet = objc.getClass("NSMutableOrderedSet"); +late final _class_NSMutableSet = objc.getClass("NSMutableSet"); +late final _class_NSMutableString = objc.getClass("NSMutableString"); +late final _class_NSNotification = objc.getClass("NSNotification"); +late final _class_NSNumber = objc.getClass("NSNumber"); +late final _class_NSObject = objc.getClass("NSObject"); +late final _class_NSOrderedCollectionDifference = + objc.getClass("NSOrderedCollectionDifference"); +late final _class_NSOrderedSet = objc.getClass("NSOrderedSet"); +late final _class_NSOutputStream = objc.getClass("NSOutputStream"); +late final _class_NSProxy = objc.getClass("NSProxy"); +late final _class_NSRunLoop = objc.getClass("NSRunLoop"); +late final _class_NSSet = objc.getClass("NSSet"); +late final _class_NSStream = objc.getClass("NSStream"); +late final _class_NSString = objc.getClass("NSString"); +late final _class_NSURL = objc.getClass("NSURL"); +late final _class_NSURLHandle = objc.getClass("NSURLHandle"); +late final _class_NSValue = objc.getClass("NSValue"); +late final _class_Protocol = objc.getClass("Protocol"); +final _objc_msgSend_10i1axw = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>, - NSRange)>>() - .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - NSRange)>(); -final _objc_msgSend_1k4zaz5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_1lpsn5w = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>>() + ffi.UnsignedLong)>>() .asFunction< - instancetype Function( + void Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_1ma83mm = objc.msgSendPointer + int)>(); +final _objc_msgSend_1140663 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Bool Function( ffi.Pointer, ffi.Pointer, + ffi.Pointer, + ffi.Bool, ffi.UnsignedLong, ffi.Pointer>)>>() .asFunction< bool Function( ffi.Pointer, ffi.Pointer, + ffi.Pointer, + bool, int, ffi.Pointer>)>(); -final _objc_msgSend_1n8vqu1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedInt)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_1o3mqxx = objc.msgSendPointer +final _objc_msgSend_11e9f5x = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Long Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, + ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -final _objc_msgSend_1o478a1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_1og3t2d = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1ov25i7 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - NSRange)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, NSRange)>(); -final _objc_msgSend_1pfmxrb = objc.msgSendPointer + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +final _objc_msgSend_12mhqtk = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Char)>>() + ffi.Pointer, ffi.UnsignedInt)>>() .asFunction< ffi.Pointer Function(ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_1ph8ubj = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1pk67jm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - bool)>(); -final _objc_msgSend_1pl4rx6 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1pl4rx6Stret = objc.msgSendStretPointer - .cast< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1pmj399 = objc.msgSendPointer +final _objc_msgSend_12py2ux = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Float)>>() + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, double)>(); -final _objc_msgSend_1pu7ifu = objc.msgSendPointer + int Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_13yqbb6 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, + ffi.Int Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< int Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1qfg2kn = objc.msgSendPointer +final _objc_msgSend_13z9dkp = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Long, - ffi.Pointer)>>() + ffi.Pointer, + ffi.UnsignedLong)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -final _objc_msgSend_1rimh2f = objc.msgSendPointer + ffi.Pointer, + int)>(); +final _objc_msgSend_146986e = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong, - ffi.Bool)>>() + ffi.Pointer)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, int, - bool)>(); -final _objc_msgSend_1rk90ll = objc.msgSendPointer + ffi.Pointer)>(); +final _objc_msgSend_16ydezh = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Long Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>>() + ffi.Pointer, + ffi.UnsignedLong)>>() .asFunction< - bool Function( + int Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_1s6ey8e = objc.msgSendPointer + ffi.Pointer, + int)>(); +final _objc_msgSend_1705co6 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer, ffi.Pointer, ffi.Pointer>)>>() .asFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - int, - ffi.Pointer, ffi.Pointer, ffi.Pointer>)>(); -final _objc_msgSend_1sdw29g = objc.msgSendPointer +final _objc_msgSend_17xjpl7 = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer, + ffi.Long, + ffi.Pointer)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_1t5rcq1 = objc.msgSendPointer + ffi.Pointer, + int, + ffi.Pointer)>(); +final _objc_msgSend_189974q = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_1tdtroe = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer, - ffi.Pointer>, ffi.Pointer, - ffi.Pointer>)>>() + ffi.Pointer)>>() .asFunction< - bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>, + ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_1tf0yjs = objc.msgSendPointer + ffi.Pointer)>(); +final _objc_msgSend_197wcu5 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + ffi.Pointer)>>() .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1tjlcwl = objc.msgSendPointer + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + ffi.Pointer)>(); +final _objc_msgSend_198mga8 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + NSRange Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, + ffi.UnsignedLong, + NSRange, ffi.Pointer)>>() .asFunction< - void Function( + NSRange Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, + int, + NSRange, ffi.Pointer)>(); -final _objc_msgSend_1u9el4t = objc.msgSendPointer +final _objc_msgSend_198mga8Stret = objc.msgSendStretPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.UnsignedLong, - ffi.Pointer>)>>() + NSRange, + ffi.Pointer)>>() .asFunction< - instancetype Function( + void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, int, - ffi.Pointer>)>(); -final _objc_msgSend_1unuoxw = objc.msgSendPointer + NSRange, + ffi.Pointer)>(); +final _objc_msgSend_19hbqky = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1upz917 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Bool)>>() .asFunction< ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, bool)>(); -final _objc_msgSend_1vnalux = objc.msgSendPointer + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_19lrthf = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Bool Function( @@ -14202,143 +11095,177 @@ final _objc_msgSend_1vnalux = objc.msgSendPointer ffi.Pointer>, ffi.Pointer)>>() .asFunction< - bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer)>(); -final _objc_msgSend_1wjxqnx = objc.msgSendPointer + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer)>(); +final _objc_msgSend_19qmeje = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +final _objc_msgSend_19v53ht = objc.msgSendPointer .cast< ffi.NativeFunction< - NSRange Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - NSRange)>>() + ffi.Bool, + ffi.Pointer)>>() .asFunction< - NSRange Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - int, - NSRange)>(); -final _objc_msgSend_1wjxqnxStret = objc.msgSendStretPointer + bool, + ffi.Pointer)>(); +final _objc_msgSend_1a0iyvk = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_1aoxlyn = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - NSRange)>>() + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() .asFunction< - void Function( - ffi.Pointer, + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - int, - NSRange)>(); -final _objc_msgSend_1wopcqf = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +final _objc_msgSend_1b5ysjl = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Long Function( + ffi.UnsignedLong Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, ffi.UnsignedLong)>>() .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_1x7hfdx = objc.msgSendPointer + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>(); +final _objc_msgSend_1bdmr5f = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer, + ffi.Bool)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_1xz4izt = objc.msgSendPointer + ffi.Pointer, + bool)>(); +final _objc_msgSend_1c7f48q = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer)>>() .asFunction< void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_1y425zh = objc.msgSendPointer + ffi.Pointer)>(); +final _objc_msgSend_1co9mn4 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedShort)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_1cqd8wl = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>>() + NSRange, + ffi.Bool)>>() .asFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_1yh9gk0 = objc.msgSendPointer + NSRange, + bool)>(); +final _objc_msgSend_1d9e4oe = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1deg8x = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedShort Function(ffi.Pointer, ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - ffi.Pointer Function(ffi.Pointer, + int Function(ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_1yjgs24 = objc.msgSendPointer +final _objc_msgSend_1e3pm0z = objc.msgSendPointer .cast< ffi.NativeFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSRange)>>() .asFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_1yjgs24Stret = objc.msgSendStretPointer + void Function(ffi.Pointer, + ffi.Pointer, NSRange)>(); +final _objc_msgSend_1efxbd8 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer)>>() .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_1ypnhm3 = objc.msgSendPointer + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1f4qa0h = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Float)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, double)>(); +final _objc_msgSend_1fuqfwb = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function(ffi.Pointer, @@ -14346,1264 +11273,1344 @@ final _objc_msgSend_1ypnhm3 = objc.msgSendPointer .asFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_1ywe6ev = objc.msgSendPointer +final _objc_msgSend_1ghpoap = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, + ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() .asFunction< - bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, + ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_2n95es = objc.msgSendPointer +final _objc_msgSend_1gxo8gv = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>>() + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>, - int)>(); -final _objc_msgSend_2x4dib = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +final _objc_msgSend_1h2q612 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>, - ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>() .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_5ns8s6 = objc.msgSendPointer + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1hz7y9r = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1i9r4xy = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_1ih2cte = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Long)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_1jdvcbf = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer)>>() .asFunction< void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_5r8xlx = objc.msgSendPointer + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1je1k7e = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong, - ffi.Pointer>, - ffi.Pointer>)>>() + ffi.Bool)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, - ffi.Pointer>, - ffi.Pointer>)>(); -final _objc_msgSend_6ka9sp = objc.msgSendPointer + bool)>(); +final _objc_msgSend_1jtxufi = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>, - ffi.UnsignedLong)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>, - int)>(); -final _objc_msgSend_6s6aog = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_1jwityx = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - NSRange)>>() + ffi.Short Function(ffi.Pointer, + ffi.Pointer)>>() .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - NSRange)>(); -final _objc_msgSend_6toz8x = objc.msgSendPointer + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1k101e3 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1ko4qka = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.UnsignedChar Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1kwndnw = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSRange Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() + ffi.UnsignedLong)>>() .asFunction< - bool Function( + NSRange Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_7zmbk4 = objc.msgSendPointer + int)>(); +final _objc_msgSend_1kwndnwStret = objc.msgSendStretPointer .cast< ffi.NativeFunction< ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_85e5ih = objc.msgSendPointer +final _objc_msgSend_1l3kbc1 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Bool)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, bool)>(); +final _objc_msgSend_1lqqdvl = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - NSRange, - ffi.Pointer)>>() + ffi.Pointer>, + ffi.UnsignedLong)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - NSRange, - ffi.Pointer)>(); -final _objc_msgSend_884p6v = objc.msgSendPointer + ffi.Pointer>, + int)>(); +final _objc_msgSend_1lqxdg3 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Long Function( + ffi.Bool Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - NSRange, ffi.Pointer)>>() .asFunction< - int Function( + bool Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - int, - NSRange, ffi.Pointer)>(); -final _objc_msgSend_8d7dvc = objc.msgSendPointer +final _objc_msgSend_1lv8yz3 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Bool Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_91rfyn = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong)>>() .asFunction< bool Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_91w5mk = objc.msgSendPointer + ffi.Pointer, ffi.Pointer, int, int)>(); +final _objc_msgSend_1okds6o = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() + ffi.Long, + ffi.Pointer>)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, int, - ffi.Pointer)>(); -final _objc_msgSend_9ijr00 = objc.msgSendPointer + ffi.Pointer>)>(); +final _objc_msgSend_1p4b7x4 = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.UnsignedLong Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>, - ffi.UnsignedLong)>>() + ffi.Pointer)>>() .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.Pointer>, - int)>(); -final _objc_msgSend_9trkjz = objc.msgSendPointer + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1p4gbjy = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1pa9f4m = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer> Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Pointer)>>() .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_9xf7uy = objc.msgSendPointer + ffi.Pointer> Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +final _objc_msgSend_1pl9qdv = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function(ffi.Pointer, - ffi.Pointer, NSRange)>>() + ffi.Pointer)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, NSRange)>(); -final _objc_msgSend_a26wyd = objc.msgSendPointer + void Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1qrcblu = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_1srf6wk = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Bool Function( ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1uj57oj = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( ffi.Pointer, - ffi.Bool, - ffi.Pointer)>>() + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, + int, ffi.Pointer, - bool, - ffi.Pointer)>(); -final _objc_msgSend_ajjpfe = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer>)>(); +final _objc_msgSend_1ukqyt8 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong, ffi.Long)>>() + ffi.Double Function(ffi.Pointer, + ffi.Pointer)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int, int)>(); -final _objc_msgSend_aud7dn = objc.msgSendPointer + double Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1ukqyt8Fpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1wlgx7q = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() .asFunction< - instancetype Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_brmmwn = objc.msgSendPointer +final _objc_msgSend_1wpduvy = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Long Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_cjm5ga = objc.msgSendPointer + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1wrs2o6 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Pointer, + ffi.UnsignedLong, + NSRange)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - int)>(); -final _objc_msgSend_crtxa9 = objc.msgSendPointer + ffi.Pointer, + int, + NSRange)>(); +final _objc_msgSend_1x359cv = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1x911p2 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Double)>>() .asFunction< ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_dzloj4 = objc.msgSendPointer + ffi.Pointer, double)>(); +final _objc_msgSend_2cgrxl = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedInt Function(ffi.Pointer, + ffi.Float Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - int Function( + double Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_e94jsr = objc.msgSendPointer +final _objc_msgSend_2cgrxlFpret = objc.msgSendFpretPointer .cast< ffi.NativeFunction< - ffi.LongLong Function(ffi.Pointer, + ffi.Float Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - int Function( + double Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_ehxl2g = objc.msgSendPointer +final _objc_msgSend_2izev6 = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_eldhrq = objc.msgSendPointer + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +final _objc_msgSend_3ems5q = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +final _objc_msgSend_3pyzne = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedInt Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_eymsul = objc.msgSendPointer + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_582s3n = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +final _objc_msgSend_5ty9km = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Long)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +final _objc_msgSend_62nh5j = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer)>>() .asFunction< - int Function(ffi.Pointer, + ffi.Pointer Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_fcilgx = objc.msgSendPointer +final _objc_msgSend_69e0x1 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, - ffi.Pointer)>>() + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() .asFunction< - double Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_fcilgxFpret = objc.msgSendFpretPointer + bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_6ex6p5 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, + ffi.Pointer Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - double Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_fnfvai = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.UnsignedShort Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - int Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_go6fex = objc.msgSendPointer +final _objc_msgSend_6h48uq = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Bool Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Bool, - ffi.UnsignedLong, + ffi.Pointer, ffi.Pointer>)>>() .asFunction< bool Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - bool, - int, + ffi.Pointer, ffi.Pointer>)>(); -final _objc_msgSend_gvd36k = objc.msgSendPointer +final _objc_msgSend_6peh6o = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>() + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_h7jsjv = objc.msgSendPointer + bool Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_7iv28v = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function( + ffi.Bool Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, + ffi.Pointer>, ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Pointer>)>>() .asFunction< - ffi.Pointer Function( + bool Function( ffi.Pointer, ffi.Pointer, - int, + ffi.Pointer>, ffi.Pointer, - int)>(); -final _objc_msgSend_h8mnav = objc.msgSendPointer + ffi.Pointer>)>(); +final _objc_msgSend_7ukip1 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(); -final _objc_msgSend_hepzs = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>() - .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_hgyece = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +final _objc_msgSend_83z673 = objc.msgSendPointer .cast< ffi.NativeFunction< - NSRange Function(ffi.Pointer, + ffi.Pointer Function(ffi.Pointer, ffi.Pointer, NSRange)>>() .asFunction< - NSRange Function(ffi.Pointer, + ffi.Pointer Function(ffi.Pointer, ffi.Pointer, NSRange)>(); -final _objc_msgSend_hgyeceStret = objc.msgSendStretPointer +final _objc_msgSend_898fog = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, ffi.Pointer, ffi.Pointer, + ffi.Pointer, NSRange)>>() .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, NSRange)>(); -final _objc_msgSend_hyhdx3 = objc.msgSendPointer + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSRange)>(); +final _objc_msgSend_89xgla = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.UnsignedLong Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - NSRange, - ffi.Bool)>>() + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer)>>() .asFunction< - instancetype Function( + int Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - NSRange, - bool)>(); -final _objc_msgSend_imc4v7 = objc.msgSendPointer + ffi.Pointer, + int, + ffi.Pointer)>(); +final _objc_msgSend_8cymbm = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +final _objc_msgSend_8o14b = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Long)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_91c9gi = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Long, - ffi.Pointer>, - ffi.Pointer>)>>() + ffi.Pointer, + ffi.Pointer)>>() .asFunction< void Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - int, - ffi.Pointer>, - ffi.Pointer>)>(); -final _objc_msgSend_iq11qg = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer)>(); +final _objc_msgSend_91o635 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + bool Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_94cet5 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.UnsignedLong, + ffi.Pointer>)>>() .asFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_j04r6g = objc.msgSendPointer + int, + ffi.Pointer>)>(); +final _objc_msgSend_94zdgv = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer<_NSZone> Function(ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.LongLong)>>() .asFunction< - ffi.Pointer<_NSZone> Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_j97tz8 = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_98pnic = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLongLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_a15xhc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, ffi.UnsignedLong)>>() .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int, int)>(); -final _objc_msgSend_juohf7 = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +final _objc_msgSend_ackzik = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function( + NSRange Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer, + ffi.UnsignedLong, + NSRange)>>() .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_k79o95 = objc.msgSendPointer + NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + NSRange)>(); +final _objc_msgSend_ackzikStret = objc.msgSendStretPointer .cast< ffi.NativeFunction< ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.UnsignedLong, + NSRange)>>() .asFunction< void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, - int)>(); -final _objc_msgSend_ke7qz2 = objc.msgSendPointer + int, + NSRange)>(); +final _objc_msgSend_blqzg8 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Long)>>() + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_ksby9f = objc.msgSendPointer + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +final _objc_msgSend_bo6ep4 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_l8a843 = objc.msgSendPointer + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +final _objc_msgSend_c0vg4w = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() + NSRange, + ffi.Pointer, + ffi.UnsignedLong)>>() .asFunction< void Function( ffi.Pointer, ffi.Pointer, + NSRange, + ffi.Pointer, + int)>(); +final _objc_msgSend_cfqbni = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function( ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); -final _objc_msgSend_l8lotg = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>, + int)>(); +final _objc_msgSend_cvzqr9 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Short)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_d3i1uy = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSRange Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + NSRange Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_d3i1uyStret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.UnsignedLong)>>() .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_laogel = objc.msgSendPointer + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_dcd68g = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() + ffi.UnsignedLong)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_lqq9l = objc.msgSendPointer + int)>(); +final _objc_msgSend_dnlotu = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - ffi.Pointer)>>() + ffi.Pointer, + ffi.UnsignedLong)>>() .asFunction< ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - int, - ffi.Pointer)>(); -final _objc_msgSend_lusc9 = objc.msgSendPointer + ffi.Pointer, + int)>(); +final _objc_msgSend_eeuxub = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Long Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, + ffi.UnsignedLong, NSRange)>>() .asFunction< - void Function( + int Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, + int, NSRange)>(); -final _objc_msgSend_m2il7s = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, NSRange)>>() - .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, NSRange)>(); -final _objc_msgSend_m6z6pt = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Pointer)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - double, - ffi.Pointer)>(); -final _objc_msgSend_m7jc8y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Double)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, double)>(); -final _objc_msgSend_ma10gr = objc.msgSendPointer +final _objc_msgSend_eh32gn = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>, + NSRange, ffi.Pointer)>>() .asFunction< - void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>, - ffi.Pointer)>(); -final _objc_msgSend_mhn4k = objc.msgSendPointer + void Function(ffi.Pointer, + ffi.Pointer, NSRange, ffi.Pointer)>(); +final _objc_msgSend_exgdqb = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Long Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong, - NSRange)>>() + ffi.Pointer, + ffi.UnsignedLong)>>() .asFunction< - int Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, int, - NSRange)>(); -final _objc_msgSend_n73nlr = objc.msgSendPointer + ffi.Pointer, + int)>(); +final _objc_msgSend_fcs5vo = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSRange)>>() + ffi.UnsignedLong)>>() .asFunction< - int Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - int, - NSRange)>(); -final _objc_msgSend_n9eq1n = objc.msgSendPointer + int)>(); +final _objc_msgSend_gerswc = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Int64)>>() + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Uint8)>>() .asFunction< - instancetype Function(ffi.Pointer, + bool Function(ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_nbaahq = objc.msgSendPointer +final _objc_msgSend_hglvhy = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer> Function( + ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer, + ffi.UnsignedLong)>>() .asFunction< - ffi.Pointer> Function( + void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_nr96mn = objc.msgSendPointer + ffi.Pointer, + int)>(); +final _objc_msgSend_hzlb60 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedShort)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>>() .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_oihbep = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>(); +final _objc_msgSend_i30zh3 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Bool Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong, - ffi.Pointer>)>>() + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong, + NSRange, + ffi.Pointer)>>() .asFunction< bool Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, + ffi.Pointer, int, - ffi.Pointer>)>(); -final _objc_msgSend_olxnu1 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - bool Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_om71r5 = objc.msgSendPointer + ffi.Pointer, + int, + int, + NSRange, + ffi.Pointer)>(); +final _objc_msgSend_i38ton = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Double Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong)>>() .asFunction< - double Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_om71r5Fpret = objc.msgSendFpretPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int, int)>(); +final _objc_msgSend_i4hdht = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Double Function( + ffi.Long Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>() - .asFunction< - double Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_ozgyxv = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool, + ffi.UnsignedLong, + NSRange, ffi.Pointer)>>() .asFunction< - instancetype Function( + int Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - bool, + ffi.Pointer, + int, + NSRange, ffi.Pointer)>(); -final _objc_msgSend_p02k6o = objc.msgSendPointer +final _objc_msgSend_i4ny2p = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>() + NSRange, + ffi.Pointer)>>() .asFunction< - bool Function( + void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); -final _objc_msgSend_pblopu = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() - .asFunction< - instancetype Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_pxgym4 = objc.msgSendPointer + NSRange, + ffi.Pointer)>(); +final _objc_msgSend_jsclrq = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, + ffi.Bool Function(ffi.Pointer, ffi.Pointer, ffi.UnsignedInt)>>() .asFunction< - ffi.Pointer Function(ffi.Pointer, + bool Function(ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_q12f7y = objc.msgSendPointer +final _objc_msgSend_kq0sbq = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function( + ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - ffi.UnsignedLong)>>() + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() .asFunction< - int Function( + void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer>, - int)>(); -final _objc_msgSend_q7zjde = objc.msgSendPointer + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +final _objc_msgSend_o2ktnn = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.UnsignedLong, - ffi.Pointer, - ffi.UnsignedLong, ffi.UnsignedLong, - NSRange, - ffi.Pointer)>>() + ffi.Bool)>>() .asFunction< - bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, int, - ffi.Pointer, - int, int, - NSRange, - ffi.Pointer)>(); -final _objc_msgSend_qqbb5y = objc.msgSendPointer - .cast< - ffi.NativeFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Bool)>>() - .asFunction< - instancetype Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, bool)>(); -final _objc_msgSend_req28e = objc.msgSendPointer +final _objc_msgSend_onx6bi = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedShort Function(ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedShort)>>() .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_rmij85 = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_otx1t4 = objc.msgSendPointer .cast< ffi.NativeFunction< - NSRange Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong, ffi.Long)>>() .asFunction< - NSRange Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_rmij85Stret = objc.msgSendStretPointer + void Function(ffi.Pointer, + ffi.Pointer, int, int)>(); +final _objc_msgSend_ourvf2 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSRange)>(); +final _objc_msgSend_p4nurx = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, NSRange)>>() .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_sk5ilc = objc.msgSendPointer + bool Function(ffi.Pointer, + ffi.Pointer, NSRange)>(); +final _objc_msgSend_p8i56h = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() + ffi.UnsignedLong, + ffi.Pointer>)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_svexbq = objc.msgSendPointer + int, + ffi.Pointer>)>(); +final _objc_msgSend_pdn1fa = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.UnsignedLong, ffi.Pointer>)>>() .asFunction< - bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, int, ffi.Pointer>)>(); -final _objc_msgSend_syhe4c = objc.msgSendPointer +final _objc_msgSend_pww1yj = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Pointer, + ffi.Long)>>() .asFunction< - instancetype Function( + void Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, int)>(); -final _objc_msgSend_tenbla = objc.msgSendPointer +final _objc_msgSend_qid8e9 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, + ffi.Pointer, + ffi.Bool, ffi.Pointer)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.Pointer, + ffi.Pointer, + bool, ffi.Pointer)>(); -final _objc_msgSend_uftsvh = objc.msgSendPointer +final _objc_msgSend_qm9f5w = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer, NSRange)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer, NSRange)>(); +final _objc_msgSend_qtxoq7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - NSRange, ffi.Pointer, - ffi.UnsignedLong)>>() + ffi.Pointer)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - NSRange, ffi.Pointer, - int)>(); -final _objc_msgSend_ujfhr = objc.msgSendPointer + ffi.Pointer)>(); +final _objc_msgSend_r25hnf = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int64)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_rqwdif = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_rsfdlh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, ffi.Pointer, ffi.Pointer)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - int, ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_ukcdfq = objc.msgSendPointer +final _objc_msgSend_rubz6a = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong, ffi.Bool)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_vi3lef = objc.msgSendPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int, bool)>(); +final _objc_msgSend_sz90oi = objc.msgSendPointer .cast< ffi.NativeFunction< - NSRange Function(ffi.Pointer, + ffi.Pointer<_NSZone> Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - NSRange Function( + ffi.Pointer<_NSZone> Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_vi3lefStret = objc.msgSendStretPointer +final _objc_msgSend_ud8gg = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, + ffi.UnsignedShort Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); -final _objc_msgSend_vzqe8w = objc.msgSendPointer + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_uimyc7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSRange Function(ffi.Pointer, + ffi.Pointer, NSRange)>>() + .asFunction< + NSRange Function(ffi.Pointer, + ffi.Pointer, NSRange)>(); +final _objc_msgSend_uimyc7Stret = objc.msgSendStretPointer .cast< ffi.NativeFunction< ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong)>>() + NSRange)>>() .asFunction< - void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); -final _objc_msgSend_w9wiqt = objc.msgSendPointer + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, NSRange)>(); +final _objc_msgSend_uzucl8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedChar)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_vdkl2d = objc.msgSendPointer .cast< ffi.NativeFunction< - instancetype Function( + ffi.Bool Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer>)>>() .asFunction< - instancetype Function( + bool Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, + int, ffi.Pointer>)>(); -final _objc_msgSend_ws2nkj = objc.msgSendPointer +final _objc_msgSend_vx1f2d = objc.msgSendPointer .cast< ffi.NativeFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSRange)>>() + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Char)>>() .asFunction< - NSRange Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - NSRange)>(); -final _objc_msgSend_ws2nkjStret = objc.msgSendStretPointer + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_wjvic9 = objc.msgSendPointer .cast< ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.UnsignedLong, - NSRange)>>() + ffi.Pointer)>>() .asFunction< void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int, - NSRange)>(); -final _objc_msgSend_x1q1g5 = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedLong, - NSRange)>>() - .asFunction< - ffi.Pointer Function( ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - int, - NSRange)>(); -final _objc_msgSend_x1r7wm = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_xnpl2w = objc.msgSendPointer + ffi.Pointer)>(); +final _objc_msgSend_x4muu7 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function( + NSRange Function( ffi.Pointer, ffi.Pointer, ffi.Pointer)>>() .asFunction< - int Function(ffi.Pointer, + NSRange Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_xwn22y = objc.msgSendPointer +final _objc_msgSend_x4muu7Stret = objc.msgSendStretPointer .cast< ffi.NativeFunction< - ffi.UnsignedLong Function( + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer, - NSRange)>>() + ffi.Pointer)>>() .asFunction< - int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - NSRange)>(); -final _objc_msgSend_y4z43q = objc.msgSendPointer + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_xh7c7e = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - NSRange, - ffi.Pointer>, - ffi.UnsignedLong)>>() + ffi.Double, + ffi.Pointer)>>() .asFunction< - void Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - NSRange, - ffi.Pointer>, - int)>(); -final _objc_msgSend_ybbscc = objc.msgSendPointer - .cast< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.UnsignedLongLong)>>() - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_yjzv9z = objc.msgSendPointer + double, + ffi.Pointer)>(); +final _objc_msgSend_xmlz1t = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.LongLong)>>() + ffi.Char Function(ffi.Pointer, + ffi.Pointer)>>() .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(); -final _objc_msgSend_z1fx1b = objc.msgSendPointer + int Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_xw2lbc = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, + ffi.UnsignedLong Function(ffi.Pointer, ffi.Pointer)>>() .asFunction< int Function( ffi.Pointer, ffi.Pointer)>(); -final _objc_msgSend_z1lin0 = objc.msgSendPointer +final _objc_msgSend_zsd8q9 = objc.msgSendPointer .cast< ffi.NativeFunction< - ffi.Bool Function( + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Bool)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + bool)>(); +final _objc_msgSend_zuf90e = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() .asFunction< - bool Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); late final _protocol_NSStreamDelegate = objc.getProtocol("NSStreamDelegate"); -late final _sel_URLByAppendingPathComponent_ = - objc.registerName("URLByAppendingPathComponent:"); -late final _sel_URLByAppendingPathComponent_isDirectory_ = - objc.registerName("URLByAppendingPathComponent:isDirectory:"); -late final _sel_URLByAppendingPathExtension_ = - objc.registerName("URLByAppendingPathExtension:"); -late final _sel_URLByDeletingLastPathComponent = - objc.registerName("URLByDeletingLastPathComponent"); -late final _sel_URLByDeletingPathExtension = - objc.registerName("URLByDeletingPathExtension"); late final _sel_URLByResolvingAliasFileAtURL_options_error_ = objc.registerName("URLByResolvingAliasFileAtURL:options:error:"); late final _sel_URLByResolvingBookmarkData_options_relativeToURL_bookmarkDataIsStale_error_ = objc.registerName( "URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:"); -late final _sel_URLByResolvingSymlinksInPath = - objc.registerName("URLByResolvingSymlinksInPath"); -late final _sel_URLByStandardizingPath = - objc.registerName("URLByStandardizingPath"); -late final _sel_URLFragmentAllowedCharacterSet = - objc.registerName("URLFragmentAllowedCharacterSet"); -late final _sel_URLHostAllowedCharacterSet = - objc.registerName("URLHostAllowedCharacterSet"); -late final _sel_URLPasswordAllowedCharacterSet = - objc.registerName("URLPasswordAllowedCharacterSet"); -late final _sel_URLPathAllowedCharacterSet = - objc.registerName("URLPathAllowedCharacterSet"); -late final _sel_URLQueryAllowedCharacterSet = - objc.registerName("URLQueryAllowedCharacterSet"); -late final _sel_URLUserAllowedCharacterSet = - objc.registerName("URLUserAllowedCharacterSet"); late final _sel_URLWithDataRepresentation_relativeToURL_ = objc.registerName("URLWithDataRepresentation:relativeToURL:"); late final _sel_URLWithString_ = objc.registerName("URLWithString:"); @@ -15617,73 +12624,26 @@ late final _sel_absoluteURL = objc.registerName("absoluteURL"); late final _sel_absoluteURLWithDataRepresentation_relativeToURL_ = objc.registerName("absoluteURLWithDataRepresentation:relativeToURL:"); late final _sel_addData_ = objc.registerName("addData:"); -late final _sel_addEntriesFromDictionary_ = - objc.registerName("addEntriesFromDictionary:"); late final _sel_addIndex_ = objc.registerName("addIndex:"); late final _sel_addIndexesInRange_ = objc.registerName("addIndexesInRange:"); late final _sel_addIndexes_ = objc.registerName("addIndexes:"); late final _sel_addObject_ = objc.registerName("addObject:"); -late final _sel_addObjectsFromArray_ = - objc.registerName("addObjectsFromArray:"); -late final _sel_addObjects_count_ = objc.registerName("addObjects:count:"); -late final _sel_addObserver_forKeyPath_options_context_ = - objc.registerName("addObserver:forKeyPath:options:context:"); -late final _sel_addObserver_toObjectsAtIndexes_forKeyPath_options_context_ = - objc.registerName( - "addObserver:toObjectsAtIndexes:forKeyPath:options:context:"); -late final _sel_allKeys = objc.registerName("allKeys"); -late final _sel_allKeysForObject_ = objc.registerName("allKeysForObject:"); -late final _sel_allObjects = objc.registerName("allObjects"); -late final _sel_allValues = objc.registerName("allValues"); late final _sel_alloc = objc.registerName("alloc"); late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); late final _sel_alphanumericCharacterSet = objc.registerName("alphanumericCharacterSet"); -late final _sel_anyObject = objc.registerName("anyObject"); late final _sel_appendBytes_length_ = objc.registerName("appendBytes:length:"); late final _sel_appendData_ = objc.registerName("appendData:"); -late final _sel_appendFormat_ = objc.registerName("appendFormat:"); -late final _sel_appendString_ = objc.registerName("appendString:"); -late final _sel_applyDifference_ = objc.registerName("applyDifference:"); -late final _sel_applyTransform_reverse_range_updatedRange_ = - objc.registerName("applyTransform:reverse:range:updatedRange:"); late final _sel_array = objc.registerName("array"); -late final _sel_arrayByAddingObject_ = - objc.registerName("arrayByAddingObject:"); -late final _sel_arrayByAddingObjectsFromArray_ = - objc.registerName("arrayByAddingObjectsFromArray:"); -late final _sel_arrayByApplyingDifference_ = - objc.registerName("arrayByApplyingDifference:"); late final _sel_arrayWithArray_ = objc.registerName("arrayWithArray:"); late final _sel_arrayWithCapacity_ = objc.registerName("arrayWithCapacity:"); -late final _sel_arrayWithContentsOfFile_ = - objc.registerName("arrayWithContentsOfFile:"); -late final _sel_arrayWithContentsOfURL_ = - objc.registerName("arrayWithContentsOfURL:"); -late final _sel_arrayWithContentsOfURL_error_ = - objc.registerName("arrayWithContentsOfURL:error:"); late final _sel_arrayWithObject_ = objc.registerName("arrayWithObject:"); late final _sel_arrayWithObjects_ = objc.registerName("arrayWithObjects:"); late final _sel_arrayWithObjects_count_ = objc.registerName("arrayWithObjects:count:"); -late final _sel_attemptRecoveryFromError_optionIndex_ = - objc.registerName("attemptRecoveryFromError:optionIndex:"); -late final _sel_attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo_ = - objc.registerName( - "attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:"); -late final _sel_autoContentAccessingProxy = - objc.registerName("autoContentAccessingProxy"); -late final _sel_automaticallyNotifiesObserversForKey_ = - objc.registerName("automaticallyNotifiesObserversForKey:"); late final _sel_autorelease = objc.registerName("autorelease"); late final _sel_availableStringEncodings = objc.registerName("availableStringEncodings"); -late final _sel_awakeAfterUsingCoder_ = - objc.registerName("awakeAfterUsingCoder:"); -late final _sel_base64EncodedDataWithOptions_ = - objc.registerName("base64EncodedDataWithOptions:"); -late final _sel_base64EncodedStringWithOptions_ = - objc.registerName("base64EncodedStringWithOptions:"); late final _sel_baseURL = objc.registerName("baseURL"); late final _sel_bitmapRepresentation = objc.registerName("bitmapRepresentation"); @@ -15718,12 +12678,7 @@ late final _sel_characterSetWithContentsOfFile_ = objc.registerName("characterSetWithContentsOfFile:"); late final _sel_characterSetWithRange_ = objc.registerName("characterSetWithRange:"); -late final _sel_checkPromisedItemIsReachableAndReturnError_ = - objc.registerName("checkPromisedItemIsReachableAndReturnError:"); -late final _sel_checkResourceIsReachableAndReturnError_ = - objc.registerName("checkResourceIsReachableAndReturnError:"); late final _sel_class = objc.registerName("class"); -late final _sel_classForCoder = objc.registerName("classForCoder"); late final _sel_close = objc.registerName("close"); late final _sel_code = objc.registerName("code"); late final _sel_commonPrefixWithString_options_ = @@ -15734,14 +12689,10 @@ late final _sel_compare_options_range_ = objc.registerName("compare:options:range:"); late final _sel_compare_options_range_locale_ = objc.registerName("compare:options:range:locale:"); -late final _sel_componentsJoinedByString_ = - objc.registerName("componentsJoinedByString:"); late final _sel_componentsSeparatedByCharactersInSet_ = objc.registerName("componentsSeparatedByCharactersInSet:"); late final _sel_componentsSeparatedByString_ = objc.registerName("componentsSeparatedByString:"); -late final _sel_compressUsingAlgorithm_error_ = - objc.registerName("compressUsingAlgorithm:error:"); late final _sel_compressedDataUsingAlgorithm_error_ = objc.registerName("compressedDataUsingAlgorithm:error:"); late final _sel_conformsToProtocol_ = objc.registerName("conformsToProtocol:"); @@ -15749,7 +12700,6 @@ late final _sel_containsIndex_ = objc.registerName("containsIndex:"); late final _sel_containsIndexesInRange_ = objc.registerName("containsIndexesInRange:"); late final _sel_containsIndexes_ = objc.registerName("containsIndexes:"); -late final _sel_containsObject_ = objc.registerName("containsObject:"); late final _sel_containsString_ = objc.registerName("containsString:"); late final _sel_controlCharacterSet = objc.registerName("controlCharacterSet"); late final _sel_copy = objc.registerName("copy"); @@ -15802,31 +12752,17 @@ late final _sel_decomposedStringWithCanonicalMapping = objc.registerName("decomposedStringWithCanonicalMapping"); late final _sel_decomposedStringWithCompatibilityMapping = objc.registerName("decomposedStringWithCompatibilityMapping"); -late final _sel_decompressUsingAlgorithm_error_ = - objc.registerName("decompressUsingAlgorithm:error:"); late final _sel_decompressedDataUsingAlgorithm_error_ = objc.registerName("decompressedDataUsingAlgorithm:error:"); late final _sel_defaultCStringEncoding = objc.registerName("defaultCStringEncoding"); late final _sel_delegate = objc.registerName("delegate"); -late final _sel_deleteCharactersInRange_ = - objc.registerName("deleteCharactersInRange:"); late final _sel_description = objc.registerName("description"); -late final _sel_descriptionInStringsFileFormat = - objc.registerName("descriptionInStringsFileFormat"); late final _sel_descriptionWithLocale_ = objc.registerName("descriptionWithLocale:"); -late final _sel_descriptionWithLocale_indent_ = - objc.registerName("descriptionWithLocale:indent:"); late final _sel_dictionary = objc.registerName("dictionary"); late final _sel_dictionaryWithCapacity_ = objc.registerName("dictionaryWithCapacity:"); -late final _sel_dictionaryWithContentsOfFile_ = - objc.registerName("dictionaryWithContentsOfFile:"); -late final _sel_dictionaryWithContentsOfURL_ = - objc.registerName("dictionaryWithContentsOfURL:"); -late final _sel_dictionaryWithContentsOfURL_error_ = - objc.registerName("dictionaryWithContentsOfURL:error:"); late final _sel_dictionaryWithDictionary_ = objc.registerName("dictionaryWithDictionary:"); late final _sel_dictionaryWithObject_forKey_ = @@ -15837,34 +12773,13 @@ late final _sel_dictionaryWithObjects_forKeys_ = objc.registerName("dictionaryWithObjects:forKeys:"); late final _sel_dictionaryWithObjects_forKeys_count_ = objc.registerName("dictionaryWithObjects:forKeys:count:"); -late final _sel_dictionaryWithSharedKeySet_ = - objc.registerName("dictionaryWithSharedKeySet:"); -late final _sel_didChangeValueForKey_ = - objc.registerName("didChangeValueForKey:"); -late final _sel_didChangeValueForKey_withSetMutation_usingObjects_ = - objc.registerName("didChangeValueForKey:withSetMutation:usingObjects:"); -late final _sel_didChange_valuesAtIndexes_forKey_ = - objc.registerName("didChange:valuesAtIndexes:forKey:"); -late final _sel_differenceFromArray_ = - objc.registerName("differenceFromArray:"); -late final _sel_differenceFromArray_withOptions_ = - objc.registerName("differenceFromArray:withOptions:"); -late final _sel_differenceFromOrderedSet_ = - objc.registerName("differenceFromOrderedSet:"); -late final _sel_differenceFromOrderedSet_withOptions_ = - objc.registerName("differenceFromOrderedSet:withOptions:"); -late final _sel_distantFuture = objc.registerName("distantFuture"); -late final _sel_distantPast = objc.registerName("distantPast"); late final _sel_doesNotRecognizeSelector_ = objc.registerName("doesNotRecognizeSelector:"); late final _sel_domain = objc.registerName("domain"); late final _sel_doubleValue = objc.registerName("doubleValue"); -late final _sel_earlierDate_ = objc.registerName("earlierDate:"); late final _sel_encodeWithCoder_ = objc.registerName("encodeWithCoder:"); late final _sel_errorWithDomain_code_userInfo_ = objc.registerName("errorWithDomain:code:userInfo:"); -late final _sel_exchangeObjectAtIndex_withObjectAtIndex_ = - objc.registerName("exchangeObjectAtIndex:withObjectAtIndex:"); late final _sel_fastestEncoding = objc.registerName("fastestEncoding"); late final _sel_filePathURL = objc.registerName("filePathURL"); late final _sel_fileReferenceURL = objc.registerName("fileReferenceURL"); @@ -15873,8 +12788,6 @@ late final _sel_fileSystemRepresentation = late final _sel_fileURLWithFileSystemRepresentation_isDirectory_relativeToURL_ = objc.registerName( "fileURLWithFileSystemRepresentation:isDirectory:relativeToURL:"); -late final _sel_fileURLWithPathComponents_ = - objc.registerName("fileURLWithPathComponents:"); late final _sel_fileURLWithPath_ = objc.registerName("fileURLWithPath:"); late final _sel_fileURLWithPath_isDirectory_ = objc.registerName("fileURLWithPath:isDirectory:"); @@ -15884,9 +12797,6 @@ late final _sel_fileURLWithPath_relativeToURL_ = objc.registerName("fileURLWithPath:relativeToURL:"); late final _sel_finalize = objc.registerName("finalize"); late final _sel_firstIndex = objc.registerName("firstIndex"); -late final _sel_firstObject = objc.registerName("firstObject"); -late final _sel_firstObjectCommonWithArray_ = - objc.registerName("firstObjectCommonWithArray:"); late final _sel_floatValue = objc.registerName("floatValue"); late final _sel_forwardInvocation_ = objc.registerName("forwardInvocation:"); late final _sel_forwardingTargetForSelector_ = @@ -15895,17 +12805,12 @@ late final _sel_fragment = objc.registerName("fragment"); late final _sel_frameLength = objc.registerName("frameLength"); late final _sel_getArgumentTypeAtIndex_ = objc.registerName("getArgumentTypeAtIndex:"); -late final _sel_getBoundStreamsWithBufferSize_inputStream_outputStream_ = objc - .registerName("getBoundStreamsWithBufferSize:inputStream:outputStream:"); late final _sel_getBuffer_length_ = objc.registerName("getBuffer:length:"); -late final _sel_getBytes_length_ = objc.registerName("getBytes:length:"); late final _sel_getBytes_maxLength_usedLength_encoding_options_range_remainingRange_ = objc.registerName( "getBytes:maxLength:usedLength:encoding:options:range:remainingRange:"); -late final _sel_getBytes_range_ = objc.registerName("getBytes:range:"); late final _sel_getCString_maxLength_encoding_ = objc.registerName("getCString:maxLength:encoding:"); -late final _sel_getCharacters_ = objc.registerName("getCharacters:"); late final _sel_getCharacters_range_ = objc.registerName("getCharacters:range:"); late final _sel_getFileSystemRepresentation_maxLength_ = @@ -15914,20 +12819,13 @@ late final _sel_getIndexes_maxCount_inIndexRange_ = objc.registerName("getIndexes:maxCount:inIndexRange:"); late final _sel_getLineStart_end_contentsEnd_forRange_ = objc.registerName("getLineStart:end:contentsEnd:forRange:"); -late final _sel_getObjects_andKeys_count_ = - objc.registerName("getObjects:andKeys:count:"); -late final _sel_getObjects_range_ = objc.registerName("getObjects:range:"); late final _sel_getParagraphStart_end_contentsEnd_forRange_ = objc.registerName("getParagraphStart:end:contentsEnd:forRange:"); -late final _sel_getPromisedItemResourceValue_forKey_error_ = - objc.registerName("getPromisedItemResourceValue:forKey:error:"); late final _sel_getResourceValue_forKey_error_ = objc.registerName("getResourceValue:forKey:error:"); -late final _sel_getStreamsToHostWithName_port_inputStream_outputStream_ = objc - .registerName("getStreamsToHostWithName:port:inputStream:outputStream:"); -late final _sel_getValue_ = objc.registerName("getValue:"); late final _sel_getValue_size_ = objc.registerName("getValue:size:"); late final _sel_hasBytesAvailable = objc.registerName("hasBytesAvailable"); +late final _sel_hasChanges = objc.registerName("hasChanges"); late final _sel_hasDirectoryPath = objc.registerName("hasDirectoryPath"); late final _sel_hasItemConformingToTypeIdentifier_ = objc.registerName("hasItemConformingToTypeIdentifier:"); @@ -15951,13 +12849,7 @@ late final _sel_indexGreaterThanOrEqualToIndex_ = late final _sel_indexLessThanIndex_ = objc.registerName("indexLessThanIndex:"); late final _sel_indexLessThanOrEqualToIndex_ = objc.registerName("indexLessThanOrEqualToIndex:"); -late final _sel_indexOfObjectIdenticalTo_ = - objc.registerName("indexOfObjectIdenticalTo:"); -late final _sel_indexOfObjectIdenticalTo_inRange_ = - objc.registerName("indexOfObjectIdenticalTo:inRange:"); late final _sel_indexOfObject_ = objc.registerName("indexOfObject:"); -late final _sel_indexOfObject_inRange_ = - objc.registerName("indexOfObject:inRange:"); late final _sel_indexSet = objc.registerName("indexSet"); late final _sel_indexSetWithIndex_ = objc.registerName("indexSetWithIndex:"); late final _sel_indexSetWithIndexesInRange_ = @@ -16010,6 +12902,7 @@ late final _sel_initWithBytes_objCType_ = late final _sel_initWithCString_encoding_ = objc.registerName("initWithCString:encoding:"); late final _sel_initWithCapacity_ = objc.registerName("initWithCapacity:"); +late final _sel_initWithChanges_ = objc.registerName("initWithChanges:"); late final _sel_initWithChar_ = objc.registerName("initWithChar:"); late final _sel_initWithCharactersNoCopy_length_freeWhenDone_ = objc.registerName("initWithCharactersNoCopy:length:freeWhenDone:"); @@ -16028,8 +12921,6 @@ late final _sel_initWithContentsOfURL_ = objc.registerName("initWithContentsOfURL:"); late final _sel_initWithContentsOfURL_encoding_error_ = objc.registerName("initWithContentsOfURL:encoding:error:"); -late final _sel_initWithContentsOfURL_error_ = - objc.registerName("initWithContentsOfURL:error:"); late final _sel_initWithContentsOfURL_options_error_ = objc.registerName("initWithContentsOfURL:options:error:"); late final _sel_initWithContentsOfURL_usedEncoding_error_ = @@ -16054,6 +12945,12 @@ late final _sel_initWithIndexSet_ = objc.registerName("initWithIndexSet:"); late final _sel_initWithIndex_ = objc.registerName("initWithIndex:"); late final _sel_initWithIndexesInRange_ = objc.registerName("initWithIndexesInRange:"); +late final _sel_initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_ = + objc.registerName( + "initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:"); +late final _sel_initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_additionalChanges_ = + objc.registerName( + "initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:additionalChanges:"); late final _sel_initWithInt_ = objc.registerName("initWithInt:"); late final _sel_initWithInteger_ = objc.registerName("initWithInteger:"); late final _sel_initWithItem_typeIdentifier_ = @@ -16125,10 +13022,7 @@ late final _sel_inputStreamWithPort_ = late final _sel_inputStreamWithURL_ = objc.registerName("inputStreamWithURL:"); late final _sel_insertObject_atIndex_ = objc.registerName("insertObject:atIndex:"); -late final _sel_insertObjects_atIndexes_ = - objc.registerName("insertObjects:atIndexes:"); -late final _sel_insertString_atIndex_ = - objc.registerName("insertString:atIndex:"); +late final _sel_insertions = objc.registerName("insertions"); late final _sel_instanceMethodForSelector_ = objc.registerName("instanceMethodForSelector:"); late final _sel_instanceMethodSignatureForSelector_ = @@ -16137,27 +13031,13 @@ late final _sel_instancesRespondToSelector_ = objc.registerName("instancesRespondToSelector:"); late final _sel_intValue = objc.registerName("intValue"); late final _sel_integerValue = objc.registerName("integerValue"); -late final _sel_intersectOrderedSet_ = - objc.registerName("intersectOrderedSet:"); -late final _sel_intersectSet_ = objc.registerName("intersectSet:"); late final _sel_intersectsIndexesInRange_ = objc.registerName("intersectsIndexesInRange:"); -late final _sel_intersectsOrderedSet_ = - objc.registerName("intersectsOrderedSet:"); -late final _sel_intersectsSet_ = objc.registerName("intersectsSet:"); +late final _sel_inverseDifference = objc.registerName("inverseDifference"); late final _sel_invertedSet = objc.registerName("invertedSet"); -late final _sel_isEqualToArray_ = objc.registerName("isEqualToArray:"); -late final _sel_isEqualToData_ = objc.registerName("isEqualToData:"); -late final _sel_isEqualToDate_ = objc.registerName("isEqualToDate:"); -late final _sel_isEqualToDictionary_ = - objc.registerName("isEqualToDictionary:"); late final _sel_isEqualToIndexSet_ = objc.registerName("isEqualToIndexSet:"); late final _sel_isEqualToNumber_ = objc.registerName("isEqualToNumber:"); -late final _sel_isEqualToOrderedSet_ = - objc.registerName("isEqualToOrderedSet:"); -late final _sel_isEqualToSet_ = objc.registerName("isEqualToSet:"); late final _sel_isEqualToString_ = objc.registerName("isEqualToString:"); -late final _sel_isEqualToValue_ = objc.registerName("isEqualToValue:"); late final _sel_isEqual_ = objc.registerName("isEqual:"); late final _sel_isFileReferenceURL = objc.registerName("isFileReferenceURL"); late final _sel_isFileURL = objc.registerName("isFileURL"); @@ -16166,28 +13046,17 @@ late final _sel_isMemberOfClass_ = objc.registerName("isMemberOfClass:"); late final _sel_isOneway = objc.registerName("isOneway"); late final _sel_isProxy = objc.registerName("isProxy"); late final _sel_isSubclassOfClass_ = objc.registerName("isSubclassOfClass:"); -late final _sel_isSubsetOfOrderedSet_ = - objc.registerName("isSubsetOfOrderedSet:"); -late final _sel_isSubsetOfSet_ = objc.registerName("isSubsetOfSet:"); late final _sel_isSupersetOfSet_ = objc.registerName("isSupersetOfSet:"); -late final _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_ = - objc.registerName( - "itemProviderVisibilityForRepresentationWithTypeIdentifier:"); late final _sel_keyEnumerator = objc.registerName("keyEnumerator"); -late final _sel_keyPathsForValuesAffectingValueForKey_ = - objc.registerName("keyPathsForValuesAffectingValueForKey:"); -late final _sel_keysSortedByValueUsingSelector_ = - objc.registerName("keysSortedByValueUsingSelector:"); late final _sel_lastIndex = objc.registerName("lastIndex"); -late final _sel_lastObject = objc.registerName("lastObject"); -late final _sel_lastPathComponent = objc.registerName("lastPathComponent"); -late final _sel_laterDate_ = objc.registerName("laterDate:"); late final _sel_length = objc.registerName("length"); late final _sel_lengthOfBytesUsingEncoding_ = objc.registerName("lengthOfBytesUsingEncoding:"); late final _sel_letterCharacterSet = objc.registerName("letterCharacterSet"); late final _sel_lineRangeForRange_ = objc.registerName("lineRangeForRange:"); late final _sel_load = objc.registerName("load"); +late final _sel_loadItemForTypeIdentifier_options_completionHandler_ = + objc.registerName("loadItemForTypeIdentifier:options:completionHandler:"); late final _sel_localizedCapitalizedString = objc.registerName("localizedCapitalizedString"); late final _sel_localizedCaseInsensitiveCompare_ = @@ -16229,10 +13098,6 @@ late final _sel_lowercaseLetterCharacterSet = late final _sel_lowercaseString = objc.registerName("lowercaseString"); late final _sel_lowercaseStringWithLocale_ = objc.registerName("lowercaseStringWithLocale:"); -late final _sel_makeObjectsPerformSelector_ = - objc.registerName("makeObjectsPerformSelector:"); -late final _sel_makeObjectsPerformSelector_withObject_ = - objc.registerName("makeObjectsPerformSelector:withObject:"); late final _sel_maximumLengthOfBytesUsingEncoding_ = objc.registerName("maximumLengthOfBytesUsingEncoding:"); late final _sel_member_ = objc.registerName("member:"); @@ -16241,10 +13106,6 @@ late final _sel_methodReturnLength = objc.registerName("methodReturnLength"); late final _sel_methodReturnType = objc.registerName("methodReturnType"); late final _sel_methodSignatureForSelector_ = objc.registerName("methodSignatureForSelector:"); -late final _sel_minusOrderedSet_ = objc.registerName("minusOrderedSet:"); -late final _sel_minusSet_ = objc.registerName("minusSet:"); -late final _sel_moveObjectsAtIndexes_toIndex_ = - objc.registerName("moveObjectsAtIndexes:toIndex:"); late final _sel_mutableBytes = objc.registerName("mutableBytes"); late final _sel_mutableCopy = objc.registerName("mutableCopy"); late final _sel_mutableCopyWithZone_ = @@ -16255,13 +13116,10 @@ late final _sel_newFromBuilder_ = objc.registerName("newFromBuilder:"); late final _sel_newlineCharacterSet = objc.registerName("newlineCharacterSet"); late final _sel_nextObject = objc.registerName("nextObject"); late final _sel_nonBaseCharacterSet = objc.registerName("nonBaseCharacterSet"); -late final _sel_nonretainedObjectValue = - objc.registerName("nonretainedObjectValue"); late final _sel_notificationWithName_object_ = objc.registerName("notificationWithName:object:"); late final _sel_notificationWithName_object_userInfo_ = objc.registerName("notificationWithName:object:userInfo:"); -late final _sel_now = objc.registerName("now"); late final _sel_numberOfArguments = objc.registerName("numberOfArguments"); late final _sel_numberWithBool_ = objc.registerName("numberWithBool:"); late final _sel_numberWithChar_ = objc.registerName("numberWithChar:"); @@ -16287,24 +13145,12 @@ late final _sel_numberWithUnsignedShort_ = late final _sel_objCType = objc.registerName("objCType"); late final _sel_object = objc.registerName("object"); late final _sel_objectAtIndex_ = objc.registerName("objectAtIndex:"); -late final _sel_objectAtIndexedSubscript_ = - objc.registerName("objectAtIndexedSubscript:"); late final _sel_objectEnumerator = objc.registerName("objectEnumerator"); late final _sel_objectForKey_ = objc.registerName("objectForKey:"); -late final _sel_objectForKeyedSubscript_ = - objc.registerName("objectForKeyedSubscript:"); late final _sel_objectWithItemProviderData_typeIdentifier_error_ = objc.registerName("objectWithItemProviderData:typeIdentifier:error:"); -late final _sel_objectsAtIndexes_ = objc.registerName("objectsAtIndexes:"); -late final _sel_objectsForKeys_notFoundMarker_ = - objc.registerName("objectsForKeys:notFoundMarker:"); -late final _sel_observationInfo = objc.registerName("observationInfo"); -late final _sel_observeValueForKeyPath_ofObject_change_context_ = - objc.registerName("observeValueForKeyPath:ofObject:change:context:"); late final _sel_open = objc.registerName("open"); late final _sel_orderedSet = objc.registerName("orderedSet"); -late final _sel_orderedSetByApplyingDifference_ = - objc.registerName("orderedSetByApplyingDifference:"); late final _sel_orderedSetWithArray_ = objc.registerName("orderedSetWithArray:"); late final _sel_orderedSetWithArray_range_copyItems_ = @@ -16337,25 +13183,17 @@ late final _sel_paragraphRangeForRange_ = late final _sel_parameterString = objc.registerName("parameterString"); late final _sel_password = objc.registerName("password"); late final _sel_path = objc.registerName("path"); -late final _sel_pathComponents = objc.registerName("pathComponents"); -late final _sel_pathExtension = objc.registerName("pathExtension"); late final _sel_performSelector_ = objc.registerName("performSelector:"); late final _sel_performSelector_withObject_ = objc.registerName("performSelector:withObject:"); late final _sel_performSelector_withObject_withObject_ = objc.registerName("performSelector:withObject:withObject:"); -late final _sel_pointerValue = objc.registerName("pointerValue"); late final _sel_port = objc.registerName("port"); late final _sel_precomposedStringWithCanonicalMapping = objc.registerName("precomposedStringWithCanonicalMapping"); late final _sel_precomposedStringWithCompatibilityMapping = objc.registerName("precomposedStringWithCompatibilityMapping"); -late final _sel_promisedItemResourceValuesForKeys_error_ = - objc.registerName("promisedItemResourceValuesForKeys:error:"); late final _sel_propertyForKey_ = objc.registerName("propertyForKey:"); -late final _sel_propertyList = objc.registerName("propertyList"); -late final _sel_propertyListFromStringsFileFormat = - objc.registerName("propertyListFromStringsFileFormat"); late final _sel_punctuationCharacterSet = objc.registerName("punctuationCharacterSet"); late final _sel_query = objc.registerName("query"); @@ -16369,8 +13207,6 @@ late final _sel_rangeOfComposedCharacterSequenceAtIndex_ = objc.registerName("rangeOfComposedCharacterSequenceAtIndex:"); late final _sel_rangeOfComposedCharacterSequencesForRange_ = objc.registerName("rangeOfComposedCharacterSequencesForRange:"); -late final _sel_rangeOfData_options_range_ = - objc.registerName("rangeOfData:options:range:"); late final _sel_rangeOfString_ = objc.registerName("rangeOfString:"); late final _sel_rangeOfString_options_ = objc.registerName("rangeOfString:options:"); @@ -16378,10 +13214,7 @@ late final _sel_rangeOfString_options_range_ = objc.registerName("rangeOfString:options:range:"); late final _sel_rangeOfString_options_range_locale_ = objc.registerName("rangeOfString:options:range:locale:"); -late final _sel_rangeValue = objc.registerName("rangeValue"); late final _sel_read_maxLength_ = objc.registerName("read:maxLength:"); -late final _sel_readableTypeIdentifiersForItemProvider = - objc.registerName("readableTypeIdentifiersForItemProvider"); late final _sel_recoveryAttempter = objc.registerName("recoveryAttempter"); late final _sel_registerObject_visibility_ = objc.registerName("registerObject:visibility:"); @@ -16392,10 +13225,10 @@ late final _sel_registeredTypeIdentifiersWithFileOptions_ = late final _sel_relativePath = objc.registerName("relativePath"); late final _sel_relativeString = objc.registerName("relativeString"); late final _sel_release = objc.registerName("release"); +late final _sel_removals = objc.registerName("removals"); late final _sel_removeAllCachedResourceValues = objc.registerName("removeAllCachedResourceValues"); late final _sel_removeAllIndexes = objc.registerName("removeAllIndexes"); -late final _sel_removeAllObjects = objc.registerName("removeAllObjects"); late final _sel_removeCachedResourceValueForKey_ = objc.registerName("removeCachedResourceValueForKey:"); late final _sel_removeFromRunLoop_forMode_ = @@ -16408,29 +13241,7 @@ late final _sel_removeLastObject = objc.registerName("removeLastObject"); late final _sel_removeObjectAtIndex_ = objc.registerName("removeObjectAtIndex:"); late final _sel_removeObjectForKey_ = objc.registerName("removeObjectForKey:"); -late final _sel_removeObjectIdenticalTo_ = - objc.registerName("removeObjectIdenticalTo:"); -late final _sel_removeObjectIdenticalTo_inRange_ = - objc.registerName("removeObjectIdenticalTo:inRange:"); late final _sel_removeObject_ = objc.registerName("removeObject:"); -late final _sel_removeObject_inRange_ = - objc.registerName("removeObject:inRange:"); -late final _sel_removeObjectsAtIndexes_ = - objc.registerName("removeObjectsAtIndexes:"); -late final _sel_removeObjectsForKeys_ = - objc.registerName("removeObjectsForKeys:"); -late final _sel_removeObjectsInArray_ = - objc.registerName("removeObjectsInArray:"); -late final _sel_removeObjectsInRange_ = - objc.registerName("removeObjectsInRange:"); -late final _sel_removeObserver_forKeyPath_ = - objc.registerName("removeObserver:forKeyPath:"); -late final _sel_removeObserver_forKeyPath_context_ = - objc.registerName("removeObserver:forKeyPath:context:"); -late final _sel_removeObserver_fromObjectsAtIndexes_forKeyPath_ = - objc.registerName("removeObserver:fromObjectsAtIndexes:forKeyPath:"); -late final _sel_removeObserver_fromObjectsAtIndexes_forKeyPath_context_ = objc - .registerName("removeObserver:fromObjectsAtIndexes:forKeyPath:context:"); late final _sel_replaceBytesInRange_withBytes_ = objc.registerName("replaceBytesInRange:withBytes:"); late final _sel_replaceBytesInRange_withBytes_length_ = @@ -16439,18 +13250,6 @@ late final _sel_replaceCharactersInRange_withString_ = objc.registerName("replaceCharactersInRange:withString:"); late final _sel_replaceObjectAtIndex_withObject_ = objc.registerName("replaceObjectAtIndex:withObject:"); -late final _sel_replaceObjectsAtIndexes_withObjects_ = - objc.registerName("replaceObjectsAtIndexes:withObjects:"); -late final _sel_replaceObjectsInRange_withObjectsFromArray_ = - objc.registerName("replaceObjectsInRange:withObjectsFromArray:"); -late final _sel_replaceObjectsInRange_withObjectsFromArray_range_ = - objc.registerName("replaceObjectsInRange:withObjectsFromArray:range:"); -late final _sel_replaceObjectsInRange_withObjects_count_ = - objc.registerName("replaceObjectsInRange:withObjects:count:"); -late final _sel_replaceOccurrencesOfString_withString_options_range_ = - objc.registerName("replaceOccurrencesOfString:withString:options:range:"); -late final _sel_replacementObjectForCoder_ = - objc.registerName("replacementObjectForCoder:"); late final _sel_resetBytesInRange_ = objc.registerName("resetBytesInRange:"); late final _sel_resolveClassMethod_ = objc.registerName("resolveClassMethod:"); late final _sel_resolveInstanceMethod_ = @@ -16463,44 +13262,25 @@ late final _sel_resourceValuesForKeys_fromBookmarkData_ = late final _sel_respondsToSelector_ = objc.registerName("respondsToSelector:"); late final _sel_retain = objc.registerName("retain"); late final _sel_retainCount = objc.registerName("retainCount"); -late final _sel_reverseObjectEnumerator = - objc.registerName("reverseObjectEnumerator"); -late final _sel_reversedOrderedSet = objc.registerName("reversedOrderedSet"); late final _sel_scheduleInRunLoop_forMode_ = objc.registerName("scheduleInRunLoop:forMode:"); late final _sel_scheme = objc.registerName("scheme"); late final _sel_self = objc.registerName("self"); late final _sel_set = objc.registerName("set"); -late final _sel_setArray_ = objc.registerName("setArray:"); -late final _sel_setByAddingObject_ = objc.registerName("setByAddingObject:"); -late final _sel_setByAddingObjectsFromArray_ = - objc.registerName("setByAddingObjectsFromArray:"); -late final _sel_setByAddingObjectsFromSet_ = - objc.registerName("setByAddingObjectsFromSet:"); late final _sel_setData_ = objc.registerName("setData:"); late final _sel_setDelegate_ = objc.registerName("setDelegate:"); -late final _sel_setDictionary_ = objc.registerName("setDictionary:"); late final _sel_setDone = objc.registerName("setDone"); late final _sel_setError_ = objc.registerName("setError:"); late final _sel_setLength_ = objc.registerName("setLength:"); -late final _sel_setObject_atIndex_ = objc.registerName("setObject:atIndex:"); -late final _sel_setObject_atIndexedSubscript_ = - objc.registerName("setObject:atIndexedSubscript:"); late final _sel_setObject_forKey_ = objc.registerName("setObject:forKey:"); -late final _sel_setObject_forKeyedSubscript_ = - objc.registerName("setObject:forKeyedSubscript:"); -late final _sel_setObservationInfo_ = objc.registerName("setObservationInfo:"); late final _sel_setProperty_forKey_ = objc.registerName("setProperty:forKey:"); late final _sel_setResourceValue_forKey_error_ = objc.registerName("setResourceValue:forKey:error:"); late final _sel_setResourceValues_error_ = objc.registerName("setResourceValues:error:"); -late final _sel_setSet_ = objc.registerName("setSet:"); -late final _sel_setString_ = objc.registerName("setString:"); late final _sel_setSuggestedName_ = objc.registerName("setSuggestedName:"); late final _sel_setTemporaryResourceValue_forKey_ = objc.registerName("setTemporaryResourceValue:forKey:"); -late final _sel_setVersion_ = objc.registerName("setVersion:"); late final _sel_setWithArray_ = objc.registerName("setWithArray:"); late final _sel_setWithCapacity_ = objc.registerName("setWithCapacity:"); late final _sel_setWithObject_ = objc.registerName("setWithObject:"); @@ -16508,24 +13288,12 @@ late final _sel_setWithObjects_ = objc.registerName("setWithObjects:"); late final _sel_setWithObjects_count_ = objc.registerName("setWithObjects:count:"); late final _sel_setWithSet_ = objc.registerName("setWithSet:"); -late final _sel_sharedKeySetForKeys_ = - objc.registerName("sharedKeySetForKeys:"); late final _sel_shiftIndexesStartingAtIndex_by_ = objc.registerName("shiftIndexesStartingAtIndex:by:"); late final _sel_shortValue = objc.registerName("shortValue"); late final _sel_signatureWithObjCTypes_ = objc.registerName("signatureWithObjCTypes:"); late final _sel_smallestEncoding = objc.registerName("smallestEncoding"); -late final _sel_sortUsingFunction_context_ = - objc.registerName("sortUsingFunction:context:"); -late final _sel_sortUsingSelector_ = objc.registerName("sortUsingSelector:"); -late final _sel_sortedArrayHint = objc.registerName("sortedArrayHint"); -late final _sel_sortedArrayUsingFunction_context_ = - objc.registerName("sortedArrayUsingFunction:context:"); -late final _sel_sortedArrayUsingFunction_context_hint_ = - objc.registerName("sortedArrayUsingFunction:context:hint:"); -late final _sel_sortedArrayUsingSelector_ = - objc.registerName("sortedArrayUsingSelector:"); late final _sel_standardizedURL = objc.registerName("standardizedURL"); late final _sel_startAccessingSecurityScopedResource = objc.registerName("startAccessingSecurityScopedResource"); @@ -16535,8 +13303,6 @@ late final _sel_streamError = objc.registerName("streamError"); late final _sel_streamStatus = objc.registerName("streamStatus"); late final _sel_stream_handleEvent_ = objc.registerName("stream:handleEvent:"); late final _sel_string = objc.registerName("string"); -late final _sel_stringByAddingPercentEncodingWithAllowedCharacters_ = - objc.registerName("stringByAddingPercentEncodingWithAllowedCharacters:"); late final _sel_stringByAppendingFormat_ = objc.registerName("stringByAppendingFormat:"); late final _sel_stringByAppendingString_ = @@ -16547,8 +13313,6 @@ late final _sel_stringByFoldingWithOptions_locale_ = objc.registerName("stringByFoldingWithOptions:locale:"); late final _sel_stringByPaddingToLength_withString_startingAtIndex_ = objc.registerName("stringByPaddingToLength:withString:startingAtIndex:"); -late final _sel_stringByRemovingPercentEncoding = - objc.registerName("stringByRemovingPercentEncoding"); late final _sel_stringByReplacingCharactersInRange_withString_ = objc.registerName("stringByReplacingCharactersInRange:withString:"); late final _sel_stringByReplacingOccurrencesOfString_withString_ = @@ -16558,13 +13322,9 @@ late final _sel_stringByReplacingOccurrencesOfString_withString_options_range_ = "stringByReplacingOccurrencesOfString:withString:options:range:"); late final _sel_stringByTrimmingCharactersInSet_ = objc.registerName("stringByTrimmingCharactersInSet:"); -late final _sel_stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_ = - objc.registerName( - "stringEncodingForData:encodingOptions:convertedString:usedLossyConversion:"); late final _sel_stringValue = objc.registerName("stringValue"); late final _sel_stringWithCString_encoding_ = objc.registerName("stringWithCString:encoding:"); -late final _sel_stringWithCapacity_ = objc.registerName("stringWithCapacity:"); late final _sel_stringWithCharacters_length_ = objc.registerName("stringWithCharacters:length:"); late final _sel_stringWithContentsOfFile_encoding_error_ = @@ -16581,8 +13341,6 @@ late final _sel_stringWithUTF8String_ = objc.registerName("stringWithUTF8String:"); late final _sel_stringWithValidatedFormat_validFormatSpecifiers_error_ = objc.registerName("stringWithValidatedFormat:validFormatSpecifiers:error:"); -late final _sel_subarrayWithRange_ = objc.registerName("subarrayWithRange:"); -late final _sel_subdataWithRange_ = objc.registerName("subdataWithRange:"); late final _sel_substringFromIndex_ = objc.registerName("substringFromIndex:"); late final _sel_substringToIndex_ = objc.registerName("substringToIndex:"); late final _sel_substringWithRange_ = objc.registerName("substringWithRange:"); @@ -16591,17 +13349,9 @@ late final _sel_superclass = objc.registerName("superclass"); late final _sel_supportsSecureCoding = objc.registerName("supportsSecureCoding"); late final _sel_symbolCharacterSet = objc.registerName("symbolCharacterSet"); -late final _sel_timeIntervalSince1970 = - objc.registerName("timeIntervalSince1970"); -late final _sel_timeIntervalSinceDate_ = - objc.registerName("timeIntervalSinceDate:"); -late final _sel_timeIntervalSinceNow = - objc.registerName("timeIntervalSinceNow"); late final _sel_timeIntervalSinceReferenceDate = objc.registerName("timeIntervalSinceReferenceDate"); late final _sel_underlyingErrors = objc.registerName("underlyingErrors"); -late final _sel_unionOrderedSet_ = objc.registerName("unionOrderedSet:"); -late final _sel_unionSet_ = objc.registerName("unionSet:"); late final _sel_unsignedCharValue = objc.registerName("unsignedCharValue"); late final _sel_unsignedIntValue = objc.registerName("unsignedIntValue"); late final _sel_unsignedIntegerValue = @@ -16617,41 +13367,16 @@ late final _sel_uppercaseStringWithLocale_ = objc.registerName("uppercaseStringWithLocale:"); late final _sel_user = objc.registerName("user"); late final _sel_userInfo = objc.registerName("userInfo"); -late final _sel_valueWithBytes_objCType_ = - objc.registerName("valueWithBytes:objCType:"); -late final _sel_valueWithNonretainedObject_ = - objc.registerName("valueWithNonretainedObject:"); -late final _sel_valueWithPointer_ = objc.registerName("valueWithPointer:"); -late final _sel_valueWithRange_ = objc.registerName("valueWithRange:"); -late final _sel_value_withObjCType_ = objc.registerName("value:withObjCType:"); -late final _sel_version = objc.registerName("version"); late final _sel_whitespaceAndNewlineCharacterSet = objc.registerName("whitespaceAndNewlineCharacterSet"); late final _sel_whitespaceCharacterSet = objc.registerName("whitespaceCharacterSet"); -late final _sel_willChangeValueForKey_ = - objc.registerName("willChangeValueForKey:"); -late final _sel_willChangeValueForKey_withSetMutation_usingObjects_ = - objc.registerName("willChangeValueForKey:withSetMutation:usingObjects:"); -late final _sel_willChange_valuesAtIndexes_forKey_ = - objc.registerName("willChange:valuesAtIndexes:forKey:"); -late final _sel_writableTypeIdentifiersForItemProvider = - objc.registerName("writableTypeIdentifiersForItemProvider"); late final _sel_writeBookmarkData_toURL_options_error_ = objc.registerName("writeBookmarkData:toURL:options:error:"); -late final _sel_writeToFile_atomically_ = - objc.registerName("writeToFile:atomically:"); late final _sel_writeToFile_atomically_encoding_error_ = objc.registerName("writeToFile:atomically:encoding:error:"); -late final _sel_writeToFile_options_error_ = - objc.registerName("writeToFile:options:error:"); -late final _sel_writeToURL_atomically_ = - objc.registerName("writeToURL:atomically:"); late final _sel_writeToURL_atomically_encoding_error_ = objc.registerName("writeToURL:atomically:encoding:error:"); -late final _sel_writeToURL_error_ = objc.registerName("writeToURL:error:"); -late final _sel_writeToURL_options_error_ = - objc.registerName("writeToURL:options:error:"); late final _sel_write_maxLength_ = objc.registerName("write:maxLength:"); late final _sel_zone = objc.registerName("zone"); typedef instancetype = ffi.Pointer; diff --git a/pkgs/objective_c/lib/src/protocol_builder.dart b/pkgs/objective_c/lib/src/protocol_builder.dart index 65079e694..c70a12b8f 100644 --- a/pkgs/objective_c/lib/src/protocol_builder.dart +++ b/pkgs/objective_c/lib/src/protocol_builder.dart @@ -5,8 +5,10 @@ import 'dart:ffi'; import 'c_bindings_generated.dart' as c; -import 'internal.dart' show ObjCBlockBase; +import 'internal.dart' + show FailedToLoadProtocolMethodException, GetProtocolName, ObjCBlockBase; import 'objective_c_bindings_generated.dart' as objc; +import 'selector.dart'; /// Helper class for building Objective C objects that implement protocols. class ObjCProtocolBuilder { @@ -35,12 +37,14 @@ class ObjCProtocolBuilder { /// want to implement. The generated bindings will include a /// [ObjCProtocolMethod] for each method of the protocol. class ObjCProtocolMethod { + final Pointer _proto; final Pointer _sel; - final objc.NSMethodSignature _signature; + final objc.NSMethodSignature? _signature; final ObjCBlockBase Function(T) _createBlock; /// Only for use by ffigen bindings. - ObjCProtocolMethod(this._sel, this._signature, this._createBlock); + ObjCProtocolMethod( + this._proto, this._sel, this._signature, this._createBlock); /// Implement this method on the protocol [builder] using a Dart [function]. /// @@ -49,9 +53,17 @@ class ObjCProtocolMethod { /// the wrong thread will result in a crash. void implement(ObjCProtocolBuilder builder, T? function) { if (function != null) { - builder.implementMethod(_sel, _signature, _createBlock(function)); + builder.implementMethod(_sel, _sig, _createBlock(function)); } } + + bool get isAvailable => _signature != null; + + objc.NSMethodSignature get _sig { + final sig = _signature; + if (sig != null) return sig; + throw FailedToLoadProtocolMethodException(_proto.name, _sel.toDartString()); + } } /// A method in an ObjC protocol that can be implemented as a listener. @@ -65,8 +77,8 @@ class ObjCProtocolListenableMethod final ObjCBlockBase Function(T) _createListenerBlock; /// Only for use by ffigen bindings. - ObjCProtocolListenableMethod(super._sel, super._signature, super._createBlock, - this._createListenerBlock); + ObjCProtocolListenableMethod(super._proto, super._sel, super._signature, + super._createBlock, this._createListenerBlock); /// Implement this method on the protocol [builder] as a listener using a Dart /// [function]. @@ -77,7 +89,7 @@ class ObjCProtocolListenableMethod /// See NativeCallable.listener for more details. void implementAsListener(ObjCProtocolBuilder builder, T? function) { if (function != null) { - builder.implementMethod(_sel, _signature, _createListenerBlock(function)); + builder.implementMethod(_sel, _sig, _createListenerBlock(function)); } } } diff --git a/pkgs/objective_c/pubspec.yaml b/pkgs/objective_c/pubspec.yaml index d57036fe3..3889e91a4 100644 --- a/pkgs/objective_c/pubspec.yaml +++ b/pkgs/objective_c/pubspec.yaml @@ -4,8 +4,9 @@ name: objective_c description: 'A library to access Objective C from Flutter that acts as a support library for package:ffigen.' -version: 3.1.0-wip +version: 4.0.1-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/objective_c +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aobjective_c topics: - interop @@ -21,18 +22,17 @@ dependencies: ffi: ^2.1.0 flutter: sdk: flutter - plugin_platform_interface: ^2.0.2 - yaml: ^3.1.0 dev_dependencies: - args: ^2.0.0 - coverage: ^1.10.0 + args: ^2.6.0 + coverage: ^1.11.0 dart_flutter_team_lints: ^2.0.0 - ffigen: ^15.1.0 + ffigen: ^16.0.0 flutter_lints: ^3.0.0 flutter_test: sdk: flutter test: ^1.21.1 + yaml: ^3.1.0 dependency_overrides: ffigen: diff --git a/pkgs/objective_c/src/ffi.h b/pkgs/objective_c/src/ffi.h new file mode 100644 index 000000000..716965763 --- /dev/null +++ b/pkgs/objective_c/src/ffi.h @@ -0,0 +1,12 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#ifndef OBJECTIVE_C_SRC_FFI_H_ +#define OBJECTIVE_C_SRC_FFI_H_ + +// Ensure that an FFI function, that will appear unused by the linker, will +// not be removed. +#define FFI_EXPORT __attribute__((visibility("default"))) __attribute__((used)) + +#endif // OBJECTIVE_C_SRC_FFI_H_ diff --git a/pkgs/objective_c/src/input_stream_adapter.h b/pkgs/objective_c/src/input_stream_adapter.h index 77f9e42ce..6322fb94f 100644 --- a/pkgs/objective_c/src/input_stream_adapter.h +++ b/pkgs/objective_c/src/input_stream_adapter.h @@ -2,16 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#ifndef INPUT_STREAM_ADAPTER_H_ -#define INPUT_STREAM_ADAPTER_H_ - #include "include/dart_api_dl.h" #import #import /// Helper class to adapt a Dart stream into a `NSInputStream`. -@interface DartInputStreamAdapter : NSInputStream +@interface DOBJCDartInputStreamAdapter : NSInputStream /// Creates the adapter. /// @param sendPort A port to that is will receive two types of messages: @@ -23,5 +20,3 @@ - (void)setDone; - (void)setError:(NSError *)error; @end - -#endif // INPUT_STREAM_ADAPTER_H_ diff --git a/pkgs/objective_c/src/input_stream_adapter.m b/pkgs/objective_c/src/input_stream_adapter.m index 4ccabdfd1..1dbc386a1 100644 --- a/pkgs/objective_c/src/input_stream_adapter.m +++ b/pkgs/objective_c/src/input_stream_adapter.m @@ -7,7 +7,7 @@ #import #include -@implementation DartInputStreamAdapter { +@implementation DOBJCDartInputStreamAdapter { Dart_Port _sendPort; NSCondition *_dataCondition; NSMutableData *_data; @@ -18,7 +18,7 @@ @implementation DartInputStreamAdapter { } + (instancetype)inputStreamWithPort:(Dart_Port)sendPort { - DartInputStreamAdapter *stream = [[DartInputStreamAdapter alloc] init]; + DOBJCDartInputStreamAdapter *stream = [[DOBJCDartInputStreamAdapter alloc] init]; if (stream != nil) { stream->_sendPort = sendPort; stream->_dataCondition = [[NSCondition alloc] init]; @@ -73,7 +73,7 @@ - (void)close { [_dataCondition lock]; _status = NSStreamStatusClosed; if (!_done && _error == nil) { - const bool success = Dart_PostInteger_DL(_sendPort, -1); + __unused const bool success = Dart_PostInteger_DL(_sendPort, -1); NSCAssert(success, @"DartInputStreamAdapter: Dart_PostCObject_DL failed."); } [_dataCondition unlock]; @@ -122,7 +122,7 @@ - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len { [_dataCondition lock]; while (([_data length] == 0) && !_done && _error == nil) { - const bool success = Dart_PostInteger_DL(_sendPort, len); + __unused const bool success = Dart_PostInteger_DL(_sendPort, len); NSCAssert(success, @"DartInputStreamAdapter: Dart_PostCObject_DL failed."); [_dataCondition wait]; diff --git a/pkgs/objective_c/src/objective_c.c b/pkgs/objective_c/src/objective_c.c index f46e823bf..29ccd3244 100644 --- a/pkgs/objective_c/src/objective_c.c +++ b/pkgs/objective_c/src/objective_c.c @@ -4,6 +4,7 @@ #include "objective_c.h" +#include #include #include "include/dart_api_dl.h" @@ -11,11 +12,11 @@ // Dispose helper for ObjC blocks that wrap a Dart closure. For these blocks, // the target is an int ID, and the dispose_port is listening for these IDs. -void disposeObjCBlockWithClosure(ObjCBlockImpl* block) { +void DOBJC_disposeObjCBlockWithClosure(ObjCBlockImpl* block) { Dart_PostInteger_DL(block->dispose_port, (int64_t)block->target); } -bool isValidBlock(ObjCBlockImpl* block) { +bool DOBJC_isValidBlock(ObjCBlockImpl* block) { if (block == NULL) return false; void* isa = block->isa; return isa == &_NSConcreteStackBlock || isa == &_NSConcreteMallocBlock || @@ -23,23 +24,23 @@ bool isValidBlock(ObjCBlockImpl* block) { isa == &_NSConcreteGlobalBlock || isa == &_NSConcreteWeakBlockVariable; } -void finalizeObject(void* isolate_callback_data, void* peer) { +void DOBJC_finalizeObject(void* isolate_callback_data, void* peer) { // objc_release works for Objects and Blocks. - runOnMainThread((void (*)(void*))objc_release, peer); + DOBJC_runOnMainThread((void (*)(void*))objc_release, peer); } -Dart_FinalizableHandle newFinalizableHandle(Dart_Handle owner, +Dart_FinalizableHandle DOBJC_newFinalizableHandle(Dart_Handle owner, ObjCObject* object) { - return Dart_NewFinalizableHandle_DL(owner, object, 0, finalizeObject); + return Dart_NewFinalizableHandle_DL(owner, object, 0, DOBJC_finalizeObject); } -void deleteFinalizableHandle(Dart_FinalizableHandle handle, Dart_Handle owner) { +void DOBJC_deleteFinalizableHandle(Dart_FinalizableHandle handle, Dart_Handle owner) { Dart_DeleteFinalizableHandle_DL(handle, owner); } -void finalizeMalloc(void* isolate_callback_data, void* peer) { free(peer); } +static void finalizeMalloc(void* isolate_callback_data, void* peer) { free(peer); } -bool* newFinalizableBool(Dart_Handle owner) { +bool* DOBJC_newFinalizableBool(Dart_Handle owner) { bool* pointer = (bool*)malloc(1); *pointer = false; Dart_NewFinalizableHandle_DL(owner, pointer, 1, finalizeMalloc); diff --git a/pkgs/objective_c/src/objective_c.h b/pkgs/objective_c/src/objective_c.h index 8f66066b0..c2fefcb10 100644 --- a/pkgs/objective_c/src/objective_c.h +++ b/pkgs/objective_c/src/objective_c.h @@ -5,28 +5,30 @@ #ifndef OBJECTIVE_C_SRC_OBJECTIVE_C_H_ #define OBJECTIVE_C_SRC_OBJECTIVE_C_H_ +#include "ffi.h" #include "include/dart_api_dl.h" #include "objective_c_runtime.h" // Dispose helper for ObjC blocks that wrap a Dart closure. -void disposeObjCBlockWithClosure(ObjCBlockImpl* block); +FFI_EXPORT void DOBJC_disposeObjCBlockWithClosure(ObjCBlockImpl *block); // Returns whether the block is valid and live. The pointer must point to // readable memory, or be null. May (rarely) return false positives. -bool isValidBlock(ObjCBlockImpl* block); +FFI_EXPORT bool DOBJC_isValidBlock(ObjCBlockImpl *block); // Returns a new Dart_FinalizableHandle that will clean up the object when the // Dart owner is garbage collected. -Dart_FinalizableHandle newFinalizableHandle( - Dart_Handle owner, ObjCObject *object); +FFI_EXPORT Dart_FinalizableHandle +DOBJC_newFinalizableHandle(Dart_Handle owner, ObjCObject *object); // Delete a finalizable handle. Doesn't run the finalization callback, so // doesn't clean up the assocated pointer. -void deleteFinalizableHandle(Dart_FinalizableHandle handle, Dart_Handle owner); +FFI_EXPORT void DOBJC_deleteFinalizableHandle(Dart_FinalizableHandle handle, + Dart_Handle owner); // Returns a newly allocated bool* (initialized to false) that will be deleted // by a Dart_FinalizableHandle when the owner is garbage collected. -bool* newFinalizableBool(Dart_Handle owner); +FFI_EXPORT bool *DOBJC_newFinalizableBool(Dart_Handle owner); // Runs fn(arg) on the main thread. If runOnMainThread is already running on the // main thread, fn(arg) is invoked synchronously. Otherwise it is dispatched to @@ -35,6 +37,6 @@ bool* newFinalizableBool(Dart_Handle owner); // This assumes that the main thread is executing its queue. If not, #define // NO_MAIN_THREAD_DISPATCH to disable this, and run fn(arg) synchronously. The // flutter runner does execute the main dispatch queue, but the Dart VM doesn't. -void runOnMainThread(void (*fn)(void*), void* arg); +FFI_EXPORT void DOBJC_runOnMainThread(void (*fn)(void *), void *arg); -#endif // OBJECTIVE_C_SRC_OBJECTIVE_C_H_ +#endif // OBJECTIVE_C_SRC_OBJECTIVE_C_H_ diff --git a/pkgs/objective_c/src/objective_c.m b/pkgs/objective_c/src/objective_c.m index 5cf87fe48..ca3035c5a 100644 --- a/pkgs/objective_c/src/objective_c.m +++ b/pkgs/objective_c/src/objective_c.m @@ -5,7 +5,9 @@ #import #import -void runOnMainThread(void (*fn)(void*), void* arg) { +#include "ffi.h" + +FFI_EXPORT void DOBJC_runOnMainThread(void (*fn)(void *), void *arg) { #ifdef NO_MAIN_THREAD_DISPATCH fn(arg); #else diff --git a/pkgs/objective_c/src/objective_c_bindings_generated.m b/pkgs/objective_c/src/objective_c_bindings_generated.m index 510ed9cdc..80ce85af1 100644 --- a/pkgs/objective_c/src/objective_c_bindings_generated.m +++ b/pkgs/objective_c/src/objective_c_bindings_generated.m @@ -12,26 +12,47 @@ Protocol* _ObjectiveCBindings_NSStreamDelegate() { return @protocol(NSStreamDelegate); } -typedef void (^_ListenerTrampoline)(void * arg0); -_ListenerTrampoline _ObjectiveCBindings_wrapListenerBlock_hepzs(_ListenerTrampoline block) NS_RETURNS_RETAINED { +typedef void (^_ListenerTrampoline)(id arg0, id arg1, id arg2); +__attribute__((visibility("default"))) __attribute__((used)) +_ListenerTrampoline _ObjectiveCBindings_wrapListenerBlock_1j2nt86(_ListenerTrampoline block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1, id arg2) { + objc_retainBlock(block); + block(objc_retainBlock(arg0), objc_retain(arg1), objc_retain(arg2)); + }; +} + +typedef void (^_ListenerTrampoline1)(void * arg0); +__attribute__((visibility("default"))) __attribute__((used)) +_ListenerTrampoline1 _ObjectiveCBindings_wrapListenerBlock_ovsamd(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { return ^void(void * arg0) { objc_retainBlock(block); block(arg0); }; } -typedef void (^_ListenerTrampoline1)(void * arg0, id arg1); -_ListenerTrampoline1 _ObjectiveCBindings_wrapListenerBlock_sjfpmz(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { +typedef void (^_ListenerTrampoline2)(void * arg0, id arg1); +__attribute__((visibility("default"))) __attribute__((used)) +_ListenerTrampoline2 _ObjectiveCBindings_wrapListenerBlock_wjovn7(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { return ^void(void * arg0, id arg1) { objc_retainBlock(block); block(arg0, objc_retain(arg1)); }; } -typedef void (^_ListenerTrampoline2)(void * arg0, id arg1, NSStreamEvent arg2); -_ListenerTrampoline2 _ObjectiveCBindings_wrapListenerBlock_m1viep(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { +typedef void (^_ListenerTrampoline3)(void * arg0, id arg1, NSStreamEvent arg2); +__attribute__((visibility("default"))) __attribute__((used)) +_ListenerTrampoline3 _ObjectiveCBindings_wrapListenerBlock_18d6mda(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { return ^void(void * arg0, id arg1, NSStreamEvent arg2) { objc_retainBlock(block); block(arg0, objc_retain(arg1), arg2); }; } + +typedef void (^_ListenerTrampoline4)(id arg0, id arg1); +__attribute__((visibility("default"))) __attribute__((used)) +_ListenerTrampoline4 _ObjectiveCBindings_wrapListenerBlock_wjvic9(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retain(arg1)); + }; +} diff --git a/pkgs/objective_c/src/objective_c_runtime.h b/pkgs/objective_c/src/objective_c_runtime.h index e4a248560..3849ccd55 100644 --- a/pkgs/objective_c/src/objective_c_runtime.h +++ b/pkgs/objective_c/src/objective_c_runtime.h @@ -69,5 +69,6 @@ ObjCProtocol* objc_getProtocol(const char* name); ObjCMethodDesc protocol_getMethodDescription( ObjCProtocol* protocol, ObjCSelector* sel, bool isRequiredMethod, bool isInstanceMethod); +const char *protocol_getName(ObjCProtocol *proto); #endif // OBJECTIVE_C_SRC_OBJECTIVE_C_RUNTIME_H_ diff --git a/pkgs/objective_c/src/proxy.h b/pkgs/objective_c/src/proxy.h index adb2955be..2857172b1 100644 --- a/pkgs/objective_c/src/proxy.h +++ b/pkgs/objective_c/src/proxy.h @@ -7,7 +7,7 @@ #import -@interface DartProxyBuilder : NSObject +@interface DOBJCDartProxyBuilder : NSObject + (instancetype)new; - (instancetype)init; - (void)implementMethod:(SEL) sel @@ -15,9 +15,9 @@ andBlock:(void*)block; @end -@interface DartProxy : NSProxy -+ (instancetype)newFromBuilder:(__strong DartProxyBuilder*)builder; -- (instancetype)initFromBuilder:(__strong DartProxyBuilder*)builder; +@interface DOBJCDartProxy : NSProxy ++ (instancetype)newFromBuilder:(__strong DOBJCDartProxyBuilder*)builder; +- (instancetype)initFromBuilder:(__strong DOBJCDartProxyBuilder*)builder; - (BOOL)respondsToSelector:(SEL)sel; - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel; - (void)forwardInvocation:(__strong NSInvocation *)invocation; diff --git a/pkgs/objective_c/src/proxy.m b/pkgs/objective_c/src/proxy.m index 570ccfa20..3307f3e28 100644 --- a/pkgs/objective_c/src/proxy.m +++ b/pkgs/objective_c/src/proxy.m @@ -13,14 +13,14 @@ #error "This file must be compiled with ARC enabled" #endif -@interface ProxyMethod : NSObject +@interface DOBJCProxyMethod : NSObject @property(strong) NSMethodSignature *signature; @property(strong) id block; @end -@implementation ProxyMethod +@implementation DOBJCProxyMethod @end -@implementation DartProxyBuilder { +@implementation DOBJCDartProxyBuilder { NSMutableDictionary *methods; } @@ -35,7 +35,7 @@ - (instancetype)init { return self; } -- (void)implement:(SEL)sel withMethod:(ProxyMethod*)m { +- (void)implement:(SEL)sel withMethod:(DOBJCProxyMethod*)m { @synchronized(methods) { [methods setObject:m forKey:[NSValue valueWithPointer:sel]]; } @@ -44,7 +44,7 @@ - (void)implement:(SEL)sel withMethod:(ProxyMethod*)m { - (void)implementMethod:(SEL)sel withSignature:(NSMethodSignature *)signature andBlock:(void*)block { - ProxyMethod *m = [ProxyMethod new]; + DOBJCProxyMethod *m = [DOBJCProxyMethod new]; m.signature = signature; m.block = (__bridge id)block; [self implement:sel withMethod:m]; @@ -55,19 +55,19 @@ - (NSDictionary*)copyMethods NS_RETURNS_RETAINED { } @end -@implementation DartProxy { +@implementation DOBJCDartProxy { NSDictionary *methods; } -- (ProxyMethod*)getMethod:(SEL)sel { +- (DOBJCProxyMethod*)getMethod:(SEL)sel { return [methods objectForKey:[NSValue valueWithPointer:sel]]; } -+ (instancetype)newFromBuilder:(DartProxyBuilder*)builder { ++ (instancetype)newFromBuilder:(DOBJCDartProxyBuilder*)builder { return [[self alloc] initFromBuilder:builder]; } -- (instancetype)initFromBuilder:(DartProxyBuilder*)builder { +- (instancetype)initFromBuilder:(DOBJCDartProxyBuilder*)builder { if (self) { methods = [builder copyMethods]; } @@ -79,13 +79,13 @@ - (BOOL)respondsToSelector:(SEL)sel { } - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { - ProxyMethod *m = [self getMethod:sel]; + DOBJCProxyMethod *m = [self getMethod:sel]; return m != nil ? m.signature : nil; } - (void)forwardInvocation:(NSInvocation *)invocation { [invocation retainArguments]; - ProxyMethod *m = [self getMethod:invocation.selector]; + DOBJCProxyMethod *m = [self getMethod:invocation.selector]; if (m != nil) { [invocation invokeWithTarget:m.block]; } diff --git a/pkgs/objective_c/test/interface_lists_test.dart b/pkgs/objective_c/test/interface_lists_test.dart index 094eabb59..410697890 100644 --- a/pkgs/objective_c/test/interface_lists_test.dart +++ b/pkgs/objective_c/test/interface_lists_test.dart @@ -24,9 +24,12 @@ void main() { setUpAll(() { final yaml = loadYaml(File('ffigen_objc.yaml').readAsStringSync()) as YamlMap; + final interfaceRenames = + (yaml['objc-interfaces'] as YamlMap)['rename'] as YamlMap; yamlInterfaces = ((yaml['objc-interfaces'] as YamlMap)['include'] as YamlList) - .map((dynamic i) => i as String) + .map( + (dynamic name) => (interfaceRenames[name] ?? name) as String) .toList() ..sort(); final structRenames = (yaml['structs'] as YamlMap)['rename'] as YamlMap; @@ -66,7 +69,7 @@ void main() { final exportFile = File('lib/objective_c.dart').readAsStringSync(); for (final intf in yamlInterfaces) { if (!privateObjectiveCClasses.contains(intf)) { - expect(exportFile, contains(intf)); + expect(exportFile, contains(RegExp('\\W$intf\\W'))); } } }); @@ -74,21 +77,21 @@ void main() { test('package:objective_c exports all the structs', () { final exportFile = File('lib/objective_c.dart').readAsStringSync(); for (final struct in yamlStructs) { - expect(exportFile, contains(struct)); + expect(exportFile, contains(RegExp('\\W$struct\\W'))); } }); test('package:objective_c exports all the enums', () { final exportFile = File('lib/objective_c.dart').readAsStringSync(); for (final enum_ in yamlEnums) { - expect(exportFile, contains(enum_)); + expect(exportFile, contains(RegExp('\\W$enum_\\W'))); } }); test('package:objective_c exports all the protocols', () { final exportFile = File('lib/objective_c.dart').readAsStringSync(); for (final protocol in yamlProtocols) { - expect(exportFile, contains(protocol)); + expect(exportFile, contains(RegExp('\\W$protocol\\W'))); } }); @@ -99,10 +102,7 @@ void main() { .readAsLinesSync()) { final match = classNameRegExp.firstMatch(line); if (match != null) { - final className = match[1]!; - if (!className.startsWith('ObjCBlock')) { - allClassNames.add(className); - } + allClassNames.add(match[1]!); } } allClassNames.sort(); diff --git a/pkgs/objective_c/test/main.c b/pkgs/objective_c/test/main.c new file mode 100644 index 000000000..88bd241be --- /dev/null +++ b/pkgs/objective_c/test/main.c @@ -0,0 +1,27 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Verify that the required symbols were not stripped from the binary. + +#include +#include +#include + +#define ASSERT_SYMBOL(s) \ + if (dlsym(RTLD_DEFAULT, s) == 0) { \ + fprintf(stderr, "Missing symbol: %s\n", s); \ + exit(1); \ + } + +int main() { + ASSERT_SYMBOL("DOBJC_disposeObjCBlockWithClosure"); // objective_c.c + ASSERT_SYMBOL("DOBJC_runOnMainThread"); + + ASSERT_SYMBOL("DOBJC_disposeObjCBlockWithClosure"); // objective_c.c + ASSERT_SYMBOL("DOBJC_runOnMainThread"); // objective_c.m + ASSERT_SYMBOL("OBJC_CLASS_$_DOBJCDartProxy"); // proxy.m + // objective_c_bindings_generated.m + ASSERT_SYMBOL("_ObjectiveCBindings_wrapListenerBlock_ovsamd"); + return 0; +} diff --git a/pkgs/objective_c/test/setup.dart b/pkgs/objective_c/test/setup.dart index 564b314c5..4c63b4d6f 100644 --- a/pkgs/objective_c/test/setup.dart +++ b/pkgs/objective_c/test/setup.dart @@ -14,17 +14,18 @@ import 'dart:io'; import 'package:args/args.dart'; -const cFiles = [ +final cFiles = [ 'src/objective_c.c', 'src/include/dart_api_dl.c', 'test/util.c', -]; -const objCFiles = [ +].map(_resolve); +final cMain = _resolve('test/main.c'); +final objCFiles = [ 'src/input_stream_adapter.m', 'src/objective_c.m', 'src/objective_c_bindings_generated.m', 'src/proxy.m', -]; +].map(_resolve); const objCFlags = [ '-x', 'objective-c', @@ -32,7 +33,20 @@ const objCFlags = [ '-framework', 'Foundation' ]; -const outputFile = 'test/objective_c.dylib'; +final outputFile = _resolve('test/objective_c.dylib'); + +final _repoDir = () { + var path = Platform.script; + while (path.pathSegments.isNotEmpty) { + path = path.resolve('..'); + if (Directory(path.resolve('.git').toFilePath()).existsSync()) { + return path; + } + } + throw Exception("Can't find .git dir above ${Platform.script}"); +}(); +final _pkgDir = _repoDir.resolve('pkgs/objective_c/'); +String _resolve(String file) => _pkgDir.resolve(file).toFilePath(); void _runClang(List flags, String output) { final args = [ @@ -61,6 +75,9 @@ String _buildObject(String input, List flags) { void _linkLib(List inputs, String output) => _runClang(['-shared', '-undefined', 'dynamic_lookup', ...inputs], output); +void _linkMain(List inputs, String output) => + _runClang(['-dead_strip', '-fobjc-arc', ...inputs], output); + void main(List arguments) { final parser = ArgParser(); parser.addFlag('main-thread-dispatcher'); @@ -69,7 +86,6 @@ void main(List arguments) { final flags = [ if (!args.flag('main-thread-dispatcher')) '-DNO_MAIN_THREAD_DISPATCH', ]; - Directory.current = Platform.script.resolve('..').path; final objFiles = [ for (final src in cFiles) _buildObject(src, flags), for (final src in objCFiles) _buildObject(src, [...objCFlags, ...flags]), @@ -78,10 +94,17 @@ void main(List arguments) { // Sanity check that the dylib was created correctly. final lib = DynamicLibrary.open(outputFile); - lib.lookup('disposeObjCBlockWithClosure'); // objective_c.c - lib.lookup('runOnMainThread'); // objective_c.m + lib.lookup('DOBJC_disposeObjCBlockWithClosure'); // objective_c.c + lib.lookup('DOBJC_runOnMainThread'); // objective_c.m lib.lookup('Dart_InitializeApiDL'); // dart_api_dl.c - lib.lookup('OBJC_CLASS_\$_DartProxy'); // proxy.m + lib.lookup('OBJC_CLASS_\$_DOBJCDartProxy'); // proxy.m // objective_c_bindings_generated.m - lib.lookup('_ObjectiveCBindings_wrapListenerBlock_hepzs'); + lib.lookup('_ObjectiveCBindings_wrapListenerBlock_ovsamd'); + + // Sanity check that the executable can find FFI symbols. + _linkMain([...objFiles, cMain], '$cMain.exe'); + final result = Process.runSync('$cMain.exe', []); + if (result.exitCode != 0) { + throw Exception('Missing symbols from executable:\n${result.stderr}'); + } } diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/can_async.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/can_async.dart new file mode 100644 index 000000000..1479d7a96 --- /dev/null +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/can_async.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An interface to describe a Swift entity's ability to be annotated +/// with `async`. +abstract interface class CanAsync { + abstract final bool async; +} diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/can_throw.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/can_throw.dart new file mode 100644 index 000000000..a7ef31385 --- /dev/null +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/can_throw.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An interface to describe a Swift entity's ability to be annotated +/// with `throws`. +abstract interface class CanThrow { + abstract final bool throws; +} diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/compound_declaration.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/compound_declaration.dart index 07a18b4f3..cd2bca599 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/interfaces/compound_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/compound_declaration.dart @@ -6,6 +6,7 @@ import '../../declarations/compounds/members/initializer_declaration.dart'; import '../../declarations/compounds/members/method_declaration.dart'; import '../../declarations/compounds/members/property_declaration.dart'; import 'declaration.dart'; +import 'nestable_declaration.dart'; import 'protocol_conformable.dart'; import 'type_parameterizable.dart'; @@ -13,7 +14,11 @@ import 'type_parameterizable.dart'; /// See `ClassDeclaration`, `StructDeclaration` and `ProtocolDeclaration` /// for concrete implementations. abstract interface class CompoundDeclaration - implements Declaration, TypeParameterizable, ProtocolConformable { + implements + Declaration, + TypeParameterizable, + ProtocolConformable, + NestableDeclaration { abstract List properties; abstract List methods; abstract List initializers; diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/declaration.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/declaration.dart index a0c8f5efa..4c237c8ba 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/interfaces/declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/declaration.dart @@ -10,6 +10,6 @@ abstract interface class Declaration { abstract final String name; } -extension AstDeclaredType on T { +extension AsDeclaredType on T { DeclaredType get asDeclaredType => DeclaredType(id: id, declaration: this); } diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/enum_declaration.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/enum_declaration.dart index 28c1e9cd6..33e3bf263 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/interfaces/enum_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/enum_declaration.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'declaration.dart'; +import 'nestable_declaration.dart'; import 'protocol_conformable.dart'; import 'type_parameterizable.dart'; @@ -10,7 +11,11 @@ import 'type_parameterizable.dart'; /// See `NormalEnumDeclaration`, `AssociatedValueEnumDeclaration` and /// `RawValueEnumDeclaration` for concrete implementations. abstract interface class EnumDeclaration - implements Declaration, TypeParameterizable, ProtocolConformable { + implements + Declaration, + TypeParameterizable, + ProtocolConformable, + NestableDeclaration { abstract List cases; } diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/function_declaration.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/function_declaration.dart index 140ed9695..5ee39604b 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/interfaces/function_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/function_declaration.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. import '../shared/referred_type.dart'; +import 'can_async.dart'; +import 'can_throw.dart'; import 'declaration.dart'; import 'executable.dart'; import 'parameterizable.dart'; @@ -10,6 +12,12 @@ import 'type_parameterizable.dart'; /// Describes a function-like entity. abstract interface class FunctionDeclaration - implements Declaration, Parameterizable, Executable, TypeParameterizable { - abstract final ReferredType? returnType; + implements + Declaration, + Parameterizable, + Executable, + TypeParameterizable, + CanThrow, + CanAsync { + abstract final ReferredType returnType; } diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/nestable_declaration.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/nestable_declaration.dart new file mode 100644 index 000000000..b857a3b68 --- /dev/null +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/nestable_declaration.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'declaration.dart'; + +/// A Swift entity that can be nested inside other declarations. +abstract interface class NestableDeclaration implements Declaration { + abstract NestableDeclaration? nestingParent; + abstract final List nestedDeclarations; +} + +extension FillNestingParents on List { + void fillNestingParents(NestableDeclaration parent) { + for (final nested in this) { + assert(nested.nestingParent == null); + nested.nestingParent = parent; + } + } +} diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/overridable.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/overridable.dart new file mode 100644 index 000000000..2ec2d385a --- /dev/null +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/overridable.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An interface to describe a Swift entity's ability to be annotated +/// with `override`. +abstract interface class Overridable { + abstract final bool isOverriding; +} diff --git a/pkgs/swift2objc/lib/src/ast/_core/interfaces/variable_declaration.dart b/pkgs/swift2objc/lib/src/ast/_core/interfaces/variable_declaration.dart index 1f024735b..cf15229cf 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/interfaces/variable_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/interfaces/variable_declaration.dart @@ -3,10 +3,17 @@ // BSD-style license that can be found in the LICENSE file. import '../shared/referred_type.dart'; +import 'can_async.dart'; +import 'can_throw.dart'; import 'declaration.dart'; /// Describes a variable-like entity. -abstract interface class VariableDeclaration implements Declaration { +/// +/// This declaration implements [CanThrow] and [CanAsync] because Swift +/// variables can have explicit getters, which can be marked with `throws` and +/// `async`. Such variables may not have a setter. +abstract interface class VariableDeclaration + implements Declaration, CanThrow, CanAsync { abstract final bool isConstant; abstract final ReferredType type; } diff --git a/pkgs/swift2objc/lib/src/ast/_core/shared/parameter.dart b/pkgs/swift2objc/lib/src/ast/_core/shared/parameter.dart index 0d82bb7b1..19b4421fc 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/shared/parameter.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/shared/parameter.dart @@ -15,4 +15,7 @@ class Parameter { this.internalName, required this.type, }); + + @override + String toString() => '$name $internalName: $type'; } diff --git a/pkgs/swift2objc/lib/src/ast/_core/shared/referred_type.dart b/pkgs/swift2objc/lib/src/ast/_core/shared/referred_type.dart index 2c8b0a6f3..56f50b72d 100644 --- a/pkgs/swift2objc/lib/src/ast/_core/shared/referred_type.dart +++ b/pkgs/swift2objc/lib/src/ast/_core/shared/referred_type.dart @@ -3,26 +3,32 @@ // BSD-style license that can be found in the LICENSE file. import '../interfaces/declaration.dart'; +import '../interfaces/nestable_declaration.dart'; import '../interfaces/objc_annotatable.dart'; /// Describes a type reference in declaration of Swift /// entities (e.g a method return type). /// See `DeclaredType` and `GenericType` for concrete implementation. sealed class ReferredType { - final String id; - final String name; abstract final bool isObjCRepresentable; - const ReferredType(this.name, {required this.id}); + abstract final String swiftType; + + bool sameAs(ReferredType other); + + const ReferredType(); } /// Describes a reference of a declared type (user-defined or built-in). class DeclaredType implements ReferredType { - @override final String id; - @override - String get name => declaration.name; + String get name { + final decl = declaration; + final parent = decl is NestableDeclaration ? decl.nestingParent : null; + final nesting = parent != null ? '${parent.name}.' : ''; + return '$nesting${declaration.name}'; + } final T declaration; final List typeParams; @@ -32,27 +38,63 @@ class DeclaredType implements ReferredType { declaration is ObjCAnnotatable && (declaration as ObjCAnnotatable).hasObjCAnnotation; + @override + String get swiftType => name; + + @override + bool sameAs(ReferredType other) => other is DeclaredType && other.id == id; + const DeclaredType({ required this.id, required this.declaration, this.typeParams = const [], }); + + @override + String toString() => name; } /// Describes a reference of a generic type /// (e.g a method return type `T` within a generic class). class GenericType implements ReferredType { - @override final String id; - @override final String name; @override bool get isObjCRepresentable => false; + @override + String get swiftType => name; + + @override + bool sameAs(ReferredType other) => other is GenericType && other.id == id; + const GenericType({ required this.id, required this.name, }); + + @override + String toString() => name; +} + +/// An optional type, like Dart's nullable types. Eg `String?`. +class OptionalType implements ReferredType { + final ReferredType child; + + @override + bool get isObjCRepresentable => child.isObjCRepresentable; + + @override + String get swiftType => '$child?'; + + @override + bool sameAs(ReferredType other) => + other is OptionalType && child.sameAs(other.child); + + OptionalType(this.child); + + @override + String toString() => swiftType; } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/built_in/built_in_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/built_in/built_in_declaration.dart index 8ccd8f355..9c75ba42f 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/built_in/built_in_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/built_in/built_in_declaration.dart @@ -10,7 +10,9 @@ enum BuiltInDeclaration implements Declaration, ObjCAnnotatable { swiftNSObject(id: 'c:objc(cs)NSObject', name: 'NSObject'), swiftString(id: 's:SS', name: 'String'), swiftInt(id: 's:Si', name: 'Int'), + swiftFloat(id: 's:Sf', name: 'Float'), swiftDouble(id: 's:Sd', name: 'Double'), + swiftBool(id: 's:Sb', name: 'Bool'), swiftVoid(id: 's:s4Voida', name: 'Void'); @override @@ -27,3 +29,11 @@ enum BuiltInDeclaration implements Declaration, ObjCAnnotatable { required this.name, }); } + +final objectType = BuiltInDeclaration.swiftNSObject.asDeclaredType; +final stringType = BuiltInDeclaration.swiftString.asDeclaredType; +final intType = BuiltInDeclaration.swiftInt.asDeclaredType; +final floatType = BuiltInDeclaration.swiftFloat.asDeclaredType; +final doubleType = BuiltInDeclaration.swiftDouble.asDeclaredType; +final boolType = BuiltInDeclaration.swiftBool.asDeclaredType; +final voidType = BuiltInDeclaration.swiftVoid.asDeclaredType; diff --git a/pkgs/swift2objc/lib/src/ast/declarations/compounds/class_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/compounds/class_declaration.dart index 960cbc7ca..9bf875b91 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/compounds/class_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/compounds/class_declaration.dart @@ -4,6 +4,7 @@ import '../../_core/interfaces/compound_declaration.dart'; import '../../_core/interfaces/declaration.dart'; +import '../../_core/interfaces/nestable_declaration.dart'; import '../../_core/interfaces/objc_annotatable.dart'; import '../../_core/shared/referred_type.dart'; import '../built_in/built_in_declaration.dart'; @@ -51,11 +52,19 @@ class ClassDeclaration implements CompoundDeclaration, ObjCAnnotatable { @override List initializers; + @override + NestableDeclaration? nestingParent; + + @override + List nestedDeclarations; + ClassDeclaration({ required this.id, required this.name, this.properties = const [], this.methods = const [], + this.nestingParent, + this.nestedDeclarations = const [], this.conformedProtocols = const [], this.typeParams = const [], this.hasObjCAnnotation = false, diff --git a/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/initializer_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/initializer_declaration.dart index 99088ec71..d7c5431b3 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/initializer_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/initializer_declaration.dart @@ -2,34 +2,64 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../../../_core/interfaces/can_async.dart'; +import '../../../_core/interfaces/can_throw.dart'; import '../../../_core/interfaces/declaration.dart'; import '../../../_core/interfaces/executable.dart'; import '../../../_core/interfaces/objc_annotatable.dart'; +import '../../../_core/interfaces/overridable.dart'; import '../../../_core/interfaces/parameterizable.dart'; import '../../../_core/shared/parameter.dart'; /// Describes an initializer for a Swift compound entity (e.g, class, structs) class InitializerDeclaration - implements Declaration, Executable, Parameterizable, ObjCAnnotatable { + implements + Declaration, + Executable, + Parameterizable, + ObjCAnnotatable, + Overridable, + CanThrow, + CanAsync { + @override + String id; + + @override + String get name => 'init'; + + @override + bool hasObjCAnnotation; + + @override + bool isOverriding; + + @override + bool throws; + + @override + bool async; + + bool isFailable; + @override List params; @override List statements; + String get fullName => [ + name, + for (final p in params) p.name, + ].join(':'); + InitializerDeclaration({ required this.id, required this.params, this.statements = const [], required this.hasObjCAnnotation, + required this.isOverriding, + required this.throws, + required this.async, + required this.isFailable, }); - - @override - String id; - - @override - String get name => 'init'; - - @override - bool hasObjCAnnotation; } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/method_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/method_declaration.dart index ac4298ff9..c7567fe9c 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/method_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/method_declaration.dart @@ -4,12 +4,14 @@ import '../../../_core/interfaces/function_declaration.dart'; import '../../../_core/interfaces/objc_annotatable.dart'; +import '../../../_core/interfaces/overridable.dart'; import '../../../_core/shared/parameter.dart'; import '../../../_core/shared/referred_type.dart'; /// Describes a method declaration for a Swift compound entity /// (e.g, class, structs) -class MethodDeclaration implements FunctionDeclaration, ObjCAnnotatable { +class MethodDeclaration + implements FunctionDeclaration, ObjCAnnotatable, Overridable { @override String id; @@ -25,14 +27,28 @@ class MethodDeclaration implements FunctionDeclaration, ObjCAnnotatable { @override bool hasObjCAnnotation; + @override + bool isOverriding; + + @override + bool throws; + + @override + bool async; + @override List statements; @override - ReferredType? returnType; + ReferredType returnType; bool isStatic; + String get fullName => [ + name, + for (final p in params) p.name, + ].join(':'); + MethodDeclaration({ required this.id, required this.name, @@ -42,5 +58,8 @@ class MethodDeclaration implements FunctionDeclaration, ObjCAnnotatable { this.hasObjCAnnotation = false, this.statements = const [], this.isStatic = false, - }); + this.isOverriding = false, + this.throws = false, + this.async = false, + }) : assert(!isStatic || !isOverriding); } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/property_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/property_declaration.dart index 536edf414..6bcced2d9 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/property_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/compounds/members/property_declaration.dart @@ -25,6 +25,12 @@ class PropertyDeclaration implements VariableDeclaration, ObjCAnnotatable { @override bool isConstant; + @override + bool throws; + + @override + bool async; + bool hasSetter; PropertyStatements? getter; @@ -42,7 +48,10 @@ class PropertyDeclaration implements VariableDeclaration, ObjCAnnotatable { this.getter, this.setter, this.isStatic = false, - }) : assert(!isConstant || !hasSetter); + this.throws = false, + this.async = false, + }) : assert(!(isConstant && hasSetter)), + assert(!(hasSetter && throws)); } class PropertyStatements implements Executable { diff --git a/pkgs/swift2objc/lib/src/ast/declarations/compounds/protocol_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/compounds/protocol_declaration.dart index 643131308..197b5ee6d 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/compounds/protocol_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/compounds/protocol_declaration.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import '../../_core/interfaces/compound_declaration.dart'; +import '../../_core/interfaces/nestable_declaration.dart'; import '../../_core/shared/referred_type.dart'; import 'members/initializer_declaration.dart'; import 'members/method_declaration.dart'; @@ -31,6 +32,12 @@ class ProtocolDeclaration implements CompoundDeclaration { @override List initializers; + @override + NestableDeclaration? nestingParent; + + @override + List nestedDeclarations; + ProtocolDeclaration({ required this.id, required this.name, @@ -39,5 +46,7 @@ class ProtocolDeclaration implements CompoundDeclaration { required this.initializers, required this.conformedProtocols, required this.typeParams, + this.nestingParent, + this.nestedDeclarations = const [], }); } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/compounds/struct_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/compounds/struct_declaration.dart index 54958caeb..ba157ff29 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/compounds/struct_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/compounds/struct_declaration.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import '../../_core/interfaces/compound_declaration.dart'; +import '../../_core/interfaces/nestable_declaration.dart'; import '../../_core/shared/referred_type.dart'; import 'members/initializer_declaration.dart'; import 'members/method_declaration.dart'; @@ -32,6 +33,12 @@ class StructDeclaration implements CompoundDeclaration { @override List initializers; + @override + NestableDeclaration? nestingParent; + + @override + List nestedDeclarations; + StructDeclaration({ required this.id, required this.name, @@ -40,5 +47,7 @@ class StructDeclaration implements CompoundDeclaration { this.initializers = const [], this.conformedProtocols = const [], this.typeParams = const [], + this.nestingParent, + this.nestedDeclarations = const [], }); } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/enums/associated_value_enum_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/enums/associated_value_enum_declaration.dart index a56e44f88..d8f374354 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/enums/associated_value_enum_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/enums/associated_value_enum_declaration.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import '../../_core/interfaces/enum_declaration.dart'; +import '../../_core/interfaces/nestable_declaration.dart'; import '../../_core/interfaces/parameterizable.dart'; import '../../_core/shared/parameter.dart'; import '../../_core/shared/referred_type.dart'; @@ -25,12 +26,20 @@ class AssociatedValueEnumDeclaration implements EnumDeclaration { @override List> conformedProtocols; + @override + NestableDeclaration? nestingParent; + + @override + List nestedDeclarations; + AssociatedValueEnumDeclaration({ required this.id, required this.name, required this.cases, required this.typeParams, required this.conformedProtocols, + this.nestingParent, + this.nestedDeclarations = const [], }); } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/enums/normal_enum_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/enums/normal_enum_declaration.dart index 97532d36d..cd4e05b70 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/enums/normal_enum_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/enums/normal_enum_declaration.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import '../../_core/interfaces/enum_declaration.dart'; +import '../../_core/interfaces/nestable_declaration.dart'; import '../../_core/shared/referred_type.dart'; import '../compounds/protocol_declaration.dart'; @@ -24,12 +25,20 @@ class NormalEnumDeclaration implements EnumDeclaration { @override List> conformedProtocols; + @override + NestableDeclaration? nestingParent; + + @override + List nestedDeclarations; + NormalEnumDeclaration({ required this.id, required this.name, required this.cases, required this.typeParams, required this.conformedProtocols, + this.nestingParent, + this.nestedDeclarations = const [], }); } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/enums/raw_value_enum_declaration.dart b/pkgs/swift2objc/lib/src/ast/declarations/enums/raw_value_enum_declaration.dart index 75d8e158a..7774a02d8 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/enums/raw_value_enum_declaration.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/enums/raw_value_enum_declaration.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import '../../_core/interfaces/enum_declaration.dart'; +import '../../_core/interfaces/nestable_declaration.dart'; import '../../_core/interfaces/objc_annotatable.dart'; import '../../_core/shared/referred_type.dart'; import '../compounds/protocol_declaration.dart'; @@ -27,6 +28,12 @@ class RawValueEnumDeclaration implements EnumDeclaration, ObjCAnnotatable { @override bool hasObjCAnnotation; + @override + NestableDeclaration? nestingParent; + + @override + List nestedDeclarations; + ReferredType rawValueType; RawValueEnumDeclaration({ @@ -37,6 +44,8 @@ class RawValueEnumDeclaration implements EnumDeclaration, ObjCAnnotatable { required this.conformedProtocols, required this.hasObjCAnnotation, required this.rawValueType, + this.nestingParent, + this.nestedDeclarations = const [], }); } diff --git a/pkgs/swift2objc/lib/src/ast/declarations/globals/globals.dart b/pkgs/swift2objc/lib/src/ast/declarations/globals/globals.dart index 774e35ffb..c06cc5077 100644 --- a/pkgs/swift2objc/lib/src/ast/declarations/globals/globals.dart +++ b/pkgs/swift2objc/lib/src/ast/declarations/globals/globals.dart @@ -34,7 +34,13 @@ class GlobalFunctionDeclaration implements FunctionDeclaration { List typeParams; @override - ReferredType? returnType; + bool throws; + + @override + bool async; + + @override + ReferredType returnType; @override List statements; @@ -46,6 +52,8 @@ class GlobalFunctionDeclaration implements FunctionDeclaration { required this.returnType, this.typeParams = const [], this.statements = const [], + this.throws = false, + this.async = false, }); } @@ -63,10 +71,18 @@ class GlobalVariableDeclaration implements VariableDeclaration { @override bool isConstant; + @override + bool throws; + + @override + bool async; + GlobalVariableDeclaration({ required this.id, required this.name, required this.type, required this.isConstant, - }); + required this.throws, + required this.async, + }) : assert(!(throws && !isConstant)); } diff --git a/pkgs/swift2objc/lib/src/config.dart b/pkgs/swift2objc/lib/src/config.dart index effff1d27..30847e745 100644 --- a/pkgs/swift2objc/lib/src/config.dart +++ b/pkgs/swift2objc/lib/src/config.dart @@ -1,5 +1,7 @@ import 'package:path/path.dart' as path; +import 'ast/_core/interfaces/declaration.dart'; + const defaultTempDirPrefix = 'swift2objc_temp_'; const symbolgraphFileSuffix = '.symbols.json'; @@ -22,36 +24,45 @@ class Config { /// Specify where the wrapper swift file will be output. final Uri outputFile; - /// Specify where the wrapper swift file will be output. + /// Text inserted into the [outputFile] before the generated output. final String? preamble; /// Specify where to output the intermidiate files (i.g the symbolgraph json). /// If this is null, a teemp directory will be generated in the system temp /// directory (using `Directory.systemTemp`) and then deleted. /// Specifying a temp directory would prevent the tool from deleting the - /// intermediate files after generating the wrapper + /// intermediate files after generating the wrapper. final Uri? tempDir; - const Config({ - required this.input, - required this.outputFile, - this.tempDir, - this.preamble, - }); + /// Filter function to filter APIs + /// + /// APIs can be filtered by name + /// + /// Includes all declarations by default + final bool Function(Declaration declaration) include; + + static bool _defaultInclude(_) => true; + + const Config( + {required this.input, + required this.outputFile, + this.tempDir, + this.preamble, + this.include = Config._defaultInclude}); } /// Used to specify the inputs in the `config` object. /// See `FilesInputConfig` and `ModuleInputConfig` for concrete implementation; sealed class InputConfig { - Command get symbolgraphCommand; + Command? get symbolgraphCommand; } -/// Used to generate a objc wrapper for one or more swift files +/// Used to generate a objc wrapper for one or more swift files. class FilesInputConfig implements InputConfig { - /// The swift file(s) to generate a wrapper for + /// The swift file(s) to generate a wrapper for. final List files; - /// The name of the module files generated by `swiftc in `tempDir` + /// The name of the module files generated by `swiftc in `tempDir`. final String generatedModuleName; FilesInputConfig({ @@ -60,7 +71,7 @@ class FilesInputConfig implements InputConfig { }); @override - Command get symbolgraphCommand => Command( + Command? get symbolgraphCommand => Command( executable: 'swiftc', args: [ ...files.map((uri) => path.absolute(uri.path)), @@ -74,17 +85,17 @@ class FilesInputConfig implements InputConfig { ); } -/// Used to generate a objc wrapper for a built-in swift module +/// Used to generate a objc wrapper for a built-in swift module. /// (e.g, AVFoundation) class ModuleInputConfig implements InputConfig { - /// The swift module to generate a wrapper for + /// The swift module to generate a wrapper for. final String module; - /// The target to generate code for + /// The target to generate code for. /// (e.g `x86_64-apple-ios17.0-simulator`) final String target; - /// The sdk to compile against + /// The sdk to compile against. /// (e.g `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sd`) final Uri sdk; @@ -95,8 +106,8 @@ class ModuleInputConfig implements InputConfig { }); @override - Command get symbolgraphCommand => Command( - executable: 'swiftc', + Command? get symbolgraphCommand => Command( + executable: 'swift', args: [ 'symbolgraph-extract', '-module-name', @@ -110,3 +121,14 @@ class ModuleInputConfig implements InputConfig { ], ); } + +/// Used to generate wrappers directly from a JSON symbolgraph, for debugging. +class JsonFileInputConfig implements InputConfig { + /// The JSON symbolgraph file. + final Uri jsonFile; + + JsonFileInputConfig({required this.jsonFile}); + + @override + Command? get symbolgraphCommand => null; +} diff --git a/pkgs/swift2objc/lib/src/generate_wrapper.dart b/pkgs/swift2objc/lib/src/generate_wrapper.dart index 2cc9f0380..bfe84aa70 100644 --- a/pkgs/swift2objc/lib/src/generate_wrapper.dart +++ b/pkgs/swift2objc/lib/src/generate_wrapper.dart @@ -4,6 +4,7 @@ import 'package:path/path.dart' as path; import 'config.dart'; import 'generator/generator.dart'; +import 'parser/_core/utils.dart'; import 'parser/parser.dart'; import 'transformer/transform.dart'; @@ -22,20 +23,36 @@ Future generateWrapper(Config config) async { final input = config.input; - await _generateSymbolgraphJson( - input.symbolgraphCommand, - tempDir, - ); + final symbolgraphCommand = input.symbolgraphCommand; + if (symbolgraphCommand != null) { + await _generateSymbolgraphJson( + symbolgraphCommand, + tempDir, + ); + } final symbolgraphFileName = switch (input) { FilesInputConfig() => '${input.generatedModuleName}$symbolgraphFileSuffix', ModuleInputConfig() => '${input.module}$symbolgraphFileSuffix', + JsonFileInputConfig() => path.absolute(input.jsonFile.path), }; final symbolgraphJsonPath = path.join(tempDir.path, symbolgraphFileName); + final symbolgraphJson = readJsonFile(symbolgraphJsonPath); - final declarations = parseAst(symbolgraphJsonPath); - final transformedDeclarations = transform(declarations); - final wrapperCode = generate(transformedDeclarations, config.preamble); + final sourceModule = switch (input) { + FilesInputConfig() => null, + ModuleInputConfig() => input.module, + JsonFileInputConfig() => parseModuleName(symbolgraphJson), + }; + + final declarations = parseAst(symbolgraphJson); + final transformedDeclarations = + transform(declarations, filter: config.include); + final wrapperCode = generate( + transformedDeclarations, + moduleName: sourceModule, + preamble: config.preamble, + ); File.fromUri(config.outputFile).writeAsStringSync(wrapperCode); diff --git a/pkgs/swift2objc/lib/src/generator/_core/utils.dart b/pkgs/swift2objc/lib/src/generator/_core/utils.dart index 63c9450d7..83dc01a3b 100644 --- a/pkgs/swift2objc/lib/src/generator/_core/utils.dart +++ b/pkgs/swift2objc/lib/src/generator/_core/utils.dart @@ -1,5 +1,8 @@ import 'dart:io'; import 'package:path/path.dart' as path; +import '../../ast/_core/interfaces/can_async.dart'; +import '../../ast/_core/interfaces/can_throw.dart'; +import '../../ast/_core/interfaces/declaration.dart'; import '../../ast/_core/shared/parameter.dart'; String generateParameters(List params) { @@ -11,16 +14,15 @@ String generateParameters(List params) { labels = param.name; } - return '$labels: ${param.type.name}'; + return '$labels: ${param.type.swiftType}'; }).join(', '); } -extension Indentation on String { - String indent([int count = 1]) { - assert(count > 0); - final lines = split('\n'); - final indentation = List.filled(count, ' ').join(); - return lines.map((line) => '$indentation$line').join('\n'); +extension Indentation on Iterable { + Iterable indent([int count = 1]) { + assert(count >= 0); + final indentation = ' ' * count; + return map((line) => line.isEmpty ? '' : '$indentation$line'); } } @@ -35,3 +37,14 @@ void outputNextToFile({ File(outputPath).writeAsStringSync(content); } + +String generateAnnotations(Declaration decl) { + final annotations = StringBuffer(); + if (decl is CanAsync && (decl as CanAsync).async) { + annotations.write('async '); + } + if (decl is CanThrow && (decl as CanThrow).throws) { + annotations.write('throws '); + } + return annotations.toString(); +} diff --git a/pkgs/swift2objc/lib/src/generator/generator.dart b/pkgs/swift2objc/lib/src/generator/generator.dart index b5e06faed..86f6a5454 100644 --- a/pkgs/swift2objc/lib/src/generator/generator.dart +++ b/pkgs/swift2objc/lib/src/generator/generator.dart @@ -2,15 +2,21 @@ import '../ast/_core/interfaces/declaration.dart'; import '../ast/declarations/compounds/class_declaration.dart'; import 'generators/class_generator.dart'; -String generate(List declarations, [String? preamble]) { +String generate( + List declarations, { + String? moduleName, + String? preamble, +}) { return '${[ preamble, - 'import Foundation', - ...declarations.map(generateDeclaration), - ].nonNulls.join('\n\n')}\n'; + '', + if (moduleName != null) 'import $moduleName', + 'import Foundation\n', + ...declarations.map((decl) => generateDeclaration(decl).join('\n')), + ].nonNulls.join('\n')}\n'; } -String generateDeclaration(Declaration declaration) { +List generateDeclaration(Declaration declaration) { return switch (declaration) { ClassDeclaration() => generateClass(declaration), _ => throw UnimplementedError( diff --git a/pkgs/swift2objc/lib/src/generator/generators/class_generator.dart b/pkgs/swift2objc/lib/src/generator/generators/class_generator.dart index 274cc170c..b5161bfb2 100644 --- a/pkgs/swift2objc/lib/src/generator/generators/class_generator.dart +++ b/pkgs/swift2objc/lib/src/generator/generators/class_generator.dart @@ -1,18 +1,28 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import '../../ast/_core/shared/referred_type.dart'; +import '../../ast/declarations/built_in/built_in_declaration.dart'; import '../../ast/declarations/compounds/class_declaration.dart'; +import '../../ast/declarations/compounds/members/initializer_declaration.dart'; +import '../../ast/declarations/compounds/members/method_declaration.dart'; +import '../../ast/declarations/compounds/members/property_declaration.dart'; import '../_core/utils.dart'; +import '../generator.dart'; -String generateClass(ClassDeclaration declaration) { +List generateClass(ClassDeclaration declaration) { return [ '${_generateClassHeader(declaration)} {', - [ + ...[ _generateClassWrappedInstance(declaration), ..._generateClassProperties(declaration), ..._generateInitializers(declaration), ..._generateClassMethods(declaration), - ].nonNulls.join('\n\n').indent(), - '}', - ].join('\n'); + ..._generateNestedDeclarations(declaration), + ].nonNulls.indent(), + '}\n', + ]; } String _generateClassHeader(ClassDeclaration declaration) { @@ -47,7 +57,7 @@ String? _generateClassWrappedInstance(ClassDeclaration declaration) { "Wrapped instance can't have a generic type", ); - return 'var ${property.name}: ${property.type.name}'; + return 'var ${property.name}: ${property.type.swiftType}\n'; } List _generateInitializers(ClassDeclaration declaration) { @@ -55,84 +65,109 @@ List _generateInitializers(ClassDeclaration declaration) { declaration.wrapperInitializer, ...declaration.initializers, ].nonNulls; + return [for (final init in initializers) ..._generateInitializer(init)]; +} + +List _generateInitializer(InitializerDeclaration initializer) { + final header = StringBuffer(); + + if (initializer.hasObjCAnnotation) { + header.write('@objc '); + } + + if (initializer.isOverriding) { + header.write('override '); + } - return initializers.map( - (initializer) { - final header = StringBuffer(); + header.write('init'); - if (initializer.hasObjCAnnotation) { - header.write('@objc '); - } + if (initializer.isFailable) { + header.write('?'); + } - header.write('init(${generateParameters(initializer.params)})'); + header.write('(${generateParameters(initializer.params)})'); - return ['$header {', initializer.statements.join('\n').indent(), '}'] - .join('\n'); - }, - ).toList(); + return [ + '$header ${generateAnnotations(initializer)}{', + ...initializer.statements.indent(), + '}\n', + ]; } -List _generateClassMethods(ClassDeclaration declaration) { - return declaration.methods.map((method) { - final header = StringBuffer(); +List _generateClassMethods(ClassDeclaration declaration) => + [for (final method in declaration.methods) ..._generateClassMethod(method)]; - if (method.hasObjCAnnotation) { - header.write('@objc '); - } +List _generateClassMethod(MethodDeclaration method) { + final header = StringBuffer(); - if (method.isStatic) { - header.write('static '); - } + if (method.hasObjCAnnotation) { + header.write('@objc '); + } - header.write( - 'public func ${method.name}(${generateParameters(method.params)})', - ); + if (method.isStatic) { + header.write('static '); + } + + if (method.isOverriding) { + header.write('override '); + } - if (method.returnType != null) { - header.write(' -> ${method.returnType!.name}'); - } + header.write( + 'public func ${method.name}(${generateParameters(method.params)}) ', + ); - return [ - '$header {', - method.statements.join('\n').indent(), - '}', - ].join('\n'); - }).toList(); + header.write(generateAnnotations(method)); + + if (!method.returnType.sameAs(voidType)) { + header.write('-> ${method.returnType.swiftType} '); + } + + return [ + '$header{', + ...method.statements.indent(), + '}\n', + ]; } -List _generateClassProperties(ClassDeclaration declaration) { - return declaration.properties.map( - (property) { - final header = StringBuffer(); - - if (property.hasObjCAnnotation) { - header.write('@objc '); - } - - if (property.isStatic) { - header.write('static '); - } - - header.write('public var ${property.name}: ${property.type.name} {'); - - final getterLines = [ - 'get {', - property.getter?.statements.join('\n').indent(), - '}' - ]; - - final setterLines = [ - 'set {', - property.setter?.statements.join('\n').indent(), - '}' - ]; - - return [ - header, - getterLines.join('\n').indent(), - if (property.hasSetter) setterLines.join('\n').indent(), - '}', - ].join('\n'); - }, - ).toList(); +List _generateClassProperties(ClassDeclaration declaration) => [ + for (final property in declaration.properties) + ..._generateClassProperty(property), + ]; + +List _generateClassProperty(PropertyDeclaration property) { + final header = StringBuffer(); + + if (property.hasObjCAnnotation) { + header.write('@objc '); + } + + if (property.isStatic) { + header.write('static '); + } + + header.write('public var ${property.name}: ${property.type.swiftType} {'); + + final getterLines = [ + 'get ${generateAnnotations(property)}{', + ...(property.getter?.statements.indent() ?? []), + '}' + ]; + + final setterLines = [ + 'set {', + ...(property.setter?.statements.indent() ?? []), + '}' + ]; + + return [ + header.toString(), + ...getterLines.indent(), + if (property.hasSetter) ...setterLines.indent(), + '}\n', + ]; } + +List _generateNestedDeclarations(ClassDeclaration declaration) => [ + for (final nested in declaration.nestedDeclarations) + ...generateDeclaration(nested), + ]; diff --git a/pkgs/swift2objc/lib/src/parser/_core/json.dart b/pkgs/swift2objc/lib/src/parser/_core/json.dart index c2b7b711e..aa0d1a0f5 100644 --- a/pkgs/swift2objc/lib/src/parser/_core/json.dart +++ b/pkgs/swift2objc/lib/src/parser/_core/json.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:collection'; +import 'dart:convert'; /// This is a helper class that helps with parsing Json values. It supports /// accessing the json content using the subscript syntax similar to `List` @@ -17,13 +17,13 @@ import 'dart:collection'; /// The class is also an `Iterable` so if the json is an array, you can directly /// iterate over it with a `for` loop. If the json isn't an array, attempting to /// iterate over it will throw an error. -class Json extends IterableBase { - final List _pathSegments; +class Json extends Iterable { + final List pathSegments; final dynamic _json; - String get path => _pathSegments.join('/'); + String get path => pathSegments.join('/'); - Json(this._json, [this._pathSegments = const []]); + Json(this._json, [this.pathSegments = const []]); /// The subscript syntax is intended to access a value at a field of a map or /// at an index if an array, and thus, the `index` parameter here can either @@ -36,7 +36,7 @@ class Json extends IterableBase { 'Expected a map at "$path", found a ${_json.runtimeType}', ); } - return Json(_json[index], [..._pathSegments, index]); + return Json(_json[index], [...pathSegments, index]); } if (index is int) { @@ -56,7 +56,7 @@ class Json extends IterableBase { 'Invalid negative index at "$path" (supplied index: $index)', ); } - return Json(_json[index], [..._pathSegments, '$index']); + return Json(_json[index], [...pathSegments, '$index']); } throw Exception( @@ -101,6 +101,9 @@ class Json extends IterableBase { ), ); } + + @override + String toString() => jsonEncode(_json); } class _JsonIterator implements Iterator { @@ -111,7 +114,7 @@ class _JsonIterator implements Iterator { _JsonIterator(this._json) : _list = _json.get(); @override - Json get current => Json(_list[_index], [..._json._pathSegments, '$_index']); + Json get current => Json(_list[_index], [..._json.pathSegments, '$_index']); @override bool moveNext() { diff --git a/pkgs/swift2objc/lib/src/parser/_core/token_list.dart b/pkgs/swift2objc/lib/src/parser/_core/token_list.dart new file mode 100644 index 000000000..46b7d3c44 --- /dev/null +++ b/pkgs/swift2objc/lib/src/parser/_core/token_list.dart @@ -0,0 +1,108 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:meta/meta.dart'; + +import 'json.dart'; +import 'utils.dart'; + +/// A slicable list of json tokens from the symbolgraph. +/// +/// These token lists appear in the symbolgraph json under keys like +/// 'declarationFragments'. They represent things like argument lists, or +/// variable declarations. +/// +/// We have to do a little bit of preprocessing on the raw json list before we +/// can pass it to parseType, because certain tokens get concatenated by the +/// swift compiler. This class performs that preprocessing, as well as providing +/// convenience methods for parsing, like slicing. +class TokenList extends Iterable { + final List _list; + final int _start; + final int _end; + + TokenList._(this._list, this._start, this._end) + : assert(0 <= _start && _start <= _end && _end <= _list.length); + + factory TokenList(Json fragments) { + final list = [for (final token in fragments) ...splitToken(token)]; + return TokenList._(list, 0, list.length); + } + + @visibleForTesting + static Iterable splitToken(Json token) sync* { + const splittables = ['(', ')', '?', ',', '->']; + Json textToken(String text) => + Json({'kind': 'text', 'spelling': text}, token.pathSegments); + + final text = getSpellingForKind(token, 'text')?.trim(); + if (text == null) { + // Not a text token. Pass it though unchanged. + yield token; + return; + } + + if (text.isEmpty) { + // Input text token was nothing but whitespace. The loop below would yield + // nothing, but we still need it as a separator. + yield textToken(text); + return; + } + + var suffix = text; + while (true) { + var any = false; + for (final prefix in splittables) { + if (suffix.startsWith(prefix)) { + yield textToken(prefix); + suffix = suffix.substring(prefix.length).trim(); + any = true; + break; + } + } + if (!any) { + // Remaining text isn't splittable. + if (suffix.isNotEmpty) yield textToken(suffix); + break; + } + } + } + + @override + int get length => _end - _start; + + @override + Iterator get iterator => _TokenListIterator(this); + + Json operator [](int index) => _list[index + _start]; + + int indexWhere(bool Function(Json element) test) { + for (var i = _start; i < _end; ++i) { + if (test(_list[i])) return i - _start; + } + return -1; + } + + TokenList slice(int startIndex, [int? endIndex]) => TokenList._( + _list, startIndex + _start, endIndex != null ? endIndex + _start : _end); + + @override + String toString() => _list.getRange(_start, _end).toString(); +} + +class _TokenListIterator implements Iterator { + final TokenList _list; + var _index = -1; + + _TokenListIterator(this._list); + + @override + Json get current => _list[_index]; + + @override + bool moveNext() { + _index++; + return _index < _list.length; + } +} diff --git a/pkgs/swift2objc/lib/src/parser/_core/utils.dart b/pkgs/swift2objc/lib/src/parser/_core/utils.dart index e61eb8059..7c42046f0 100644 --- a/pkgs/swift2objc/lib/src/parser/_core/utils.dart +++ b/pkgs/swift2objc/lib/src/parser/_core/utils.dart @@ -5,14 +5,14 @@ import 'dart:convert'; import 'dart:io'; -import '../../ast/_core/interfaces/compound_declaration.dart'; import '../../ast/_core/interfaces/declaration.dart'; -import '../../ast/_core/interfaces/enum_declaration.dart'; +import '../../ast/_core/interfaces/nestable_declaration.dart'; import '../../ast/_core/shared/referred_type.dart'; import '../../ast/declarations/globals/globals.dart'; -import '../parsers/parse_declarations.dart'; +import '../parsers/parse_type.dart'; import 'json.dart'; import 'parsed_symbolgraph.dart'; +import 'token_list.dart'; typedef ParsedSymbolsMap = Map; typedef ParsedRelationsMap = Map>; @@ -22,6 +22,7 @@ Json readJsonFile(String jsonFilePath) { return Json(jsonDecode(jsonStr)); } +// Valid ID characters seen in symbolgraphs: 0-9A-Za-z_():@ const idDelim = '-'; extension AddIdSuffix on String { @@ -29,15 +30,26 @@ extension AddIdSuffix on String { } extension TopLevelOnly on List { - List get topLevelOnly => where( - (declaration) => - declaration is CompoundDeclaration || - declaration is EnumDeclaration || - declaration is GlobalVariableDeclaration || - declaration is GlobalFunctionDeclaration, - ).toList(); + List get topLevelOnly => where((declaration) { + if (declaration is NestableDeclaration) { + return declaration.nestingParent == null; + } + return declaration is GlobalVariableDeclaration || + declaration is GlobalFunctionDeclaration; + }).toList(); } +/// If `fragment['kind'] == kind`, returns `fragment['spelling']`. Otherwise +/// returns null. +String? getSpellingForKind(Json fragment, String kind) => + fragment['kind'].get() == kind + ? fragment['spelling'].get() + : null; + +/// Matches fragments, which look like `{"kind": "foo", "spelling": "bar"}`. +bool matchFragment(Json fragment, String kind, String spelling) => + getSpellingForKind(fragment, kind) == spelling; + String parseSymbolId(Json symbolJson) { final idJson = symbolJson['identifier']['precise']; final id = idJson.get(); @@ -56,25 +68,48 @@ String parseSymbolName(Json symbolJson) { } bool parseSymbolHasObjcAnnotation(Json symbolJson) { - return symbolJson['declarationFragments'].any( - (json) => - json['kind'].exists && - json['kind'].get() == 'attribute' && - json['spelling'].exists && - json['spelling'].get() == '@objc', - ); + return symbolJson['declarationFragments'] + .any((json) => matchFragment(json, 'attribute', '@objc')); } -ReferredType parseTypeFromId(String typeId, ParsedSymbolgraph symbolgraph) { - final paramTypeSymbol = symbolgraph.symbols[typeId]; +bool parseIsOverriding(Json symbolJson) { + return symbolJson['declarationFragments'] + .any((json) => matchFragment(json, 'keyword', 'override')); +} - if (paramTypeSymbol == null) { - throw Exception( - 'Type with id "$typeId" does not exist among parsed symbols.', - ); +final class ObsoleteException implements Exception { + final String symbol; + ObsoleteException(this.symbol); + + @override + String toString() => '$runtimeType: Symbol is obsolete: $symbol'; +} + +bool isObsoleted(Json symbolJson) { + final availability = symbolJson['availability']; + if (!availability.exists) return false; + for (final entry in availability) { + if (entry['domain'].get() == 'Swift' && entry['obsoleted'].exists) { + return true; + } } + return false; +} - final paramTypeDeclaration = parseDeclaration(paramTypeSymbol, symbolgraph); +extension Deduper on Iterable { + Iterable dedupeBy(K Function(T) id) => + {for (final t in this) id(t): t}.values; +} - return paramTypeDeclaration.asDeclaredType; +ReferredType parseTypeAfterSeparator( + TokenList fragments, + ParsedSymbolgraph symbolgraph, +) { + // fragments = [..., ': ', type tokens...] + final separatorIndex = + fragments.indexWhere((token) => matchFragment(token, 'text', ':')); + final (type, suffix) = + parseType(symbolgraph, fragments.slice(separatorIndex + 1)); + assert(suffix.isEmpty, '$suffix'); + return type; } diff --git a/pkgs/swift2objc/lib/src/parser/parser.dart b/pkgs/swift2objc/lib/src/parser/parser.dart index 0f4712614..6e61c1faf 100644 --- a/pkgs/swift2objc/lib/src/parser/parser.dart +++ b/pkgs/swift2objc/lib/src/parser/parser.dart @@ -3,16 +3,14 @@ // BSD-style license that can be found in the LICENSE file. import '../ast/_core/interfaces/declaration.dart'; +import '_core/json.dart'; import '_core/parsed_symbolgraph.dart'; -import '_core/utils.dart'; import 'parsers/parse_declarations.dart'; import 'parsers/parse_relations_map.dart'; import 'parsers/parse_symbols_map.dart'; -List parseAst(String symbolgraphJsonPath) { - final symbolgraphJson = readJsonFile(symbolgraphJsonPath); - +List parseAst(Json symbolgraphJson) { final symbolgraph = ParsedSymbolgraph( parseSymbolsMap(symbolgraphJson), parseRelationsMap(symbolgraphJson), @@ -20,3 +18,6 @@ List parseAst(String symbolgraphJsonPath) { return parseDeclarations(symbolgraph); } + +String? parseModuleName(Json symbolgraphJson) => + symbolgraphJson['module']['name'].get(); diff --git a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_compound_declaration.dart b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_compound_declaration.dart index 5a736585c..cf3e9a27a 100644 --- a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_compound_declaration.dart +++ b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_compound_declaration.dart @@ -3,12 +3,12 @@ // BSD-style license that can be found in the LICENSE file. import '../../../ast/_core/interfaces/compound_declaration.dart'; +import '../../../ast/_core/interfaces/nestable_declaration.dart'; import '../../../ast/declarations/compounds/class_declaration.dart'; import '../../../ast/declarations/compounds/members/initializer_declaration.dart'; import '../../../ast/declarations/compounds/members/method_declaration.dart'; import '../../../ast/declarations/compounds/members/property_declaration.dart'; import '../../../ast/declarations/compounds/struct_declaration.dart'; -import '../../_core/json.dart'; import '../../_core/parsed_symbolgraph.dart'; import '../../_core/utils.dart'; import '../parse_declarations.dart'; @@ -16,66 +16,93 @@ import '../parse_declarations.dart'; typedef CompoundTearOff = T Function({ required String id, required String name, - required List methods, required List properties, + required List methods, required List initializers, + required List nestedDeclarations, }); -T parseCompoundDeclaration( - Json compoundSymbolJson, +T _parseCompoundDeclaration( + ParsedSymbol compoundSymbol, CompoundTearOff tearoffConstructor, ParsedSymbolgraph symbolgraph, ) { - final compoundId = parseSymbolId(compoundSymbolJson); + final compoundId = parseSymbolId(compoundSymbol.json); final compoundRelations = symbolgraph.relations[compoundId] ?? []; - final memberDeclarations = compoundRelations.where( - (relation) { - final isMembershipRelation = relation.kind == ParsedRelationKind.memberOf; - final isMemeberOfCompound = relation.targetId == compoundId; - return isMembershipRelation && isMemeberOfCompound; - }, - ).map( - (relation) { - final memberSymbol = symbolgraph.symbols[relation.sourceId]; - if (memberSymbol == null) { - throw Exception( - 'Symbol of id "${relation.sourceId}" exist in a relation at path ' - '"${relation.json.path}" but does not exist among parsed symbols.', - ); - } - return parseDeclaration(memberSymbol, symbolgraph); - }, + final compound = tearoffConstructor( + id: compoundId, + name: parseSymbolName(compoundSymbol.json), + methods: [], + properties: [], + initializers: [], + nestedDeclarations: [], ); - return tearoffConstructor( - id: compoundId, - name: parseSymbolName(compoundSymbolJson), - methods: memberDeclarations.whereType().toList(), - properties: memberDeclarations.whereType().toList(), - initializers: - memberDeclarations.whereType().toList(), + compoundSymbol.declaration = compound; + + final memberDeclarations = compoundRelations + .where( + (relation) { + final isMembershipRelation = + relation.kind == ParsedRelationKind.memberOf; + final isMemeberOfCompound = relation.targetId == compoundId; + return isMembershipRelation && isMemeberOfCompound; + }, + ) + .map( + (relation) { + final memberSymbol = symbolgraph.symbols[relation.sourceId]; + if (memberSymbol == null) { + return null; + } + return tryParseDeclaration(memberSymbol, symbolgraph); + }, + ) + .nonNulls + .dedupeBy((decl) => decl.id) + .toList(); + + compound.methods.addAll( + memberDeclarations + .whereType() + .dedupeBy((m) => m.fullName), ); + compound.properties.addAll( + memberDeclarations.whereType(), + ); + compound.initializers.addAll( + memberDeclarations + .whereType() + .dedupeBy((m) => m.fullName), + ); + compound.nestedDeclarations.addAll( + memberDeclarations.whereType(), + ); + + compound.nestedDeclarations.fillNestingParents(compound); + + return compound; } ClassDeclaration parseClassDeclaration( - Json classSymbolJson, + ParsedSymbol classSymbol, ParsedSymbolgraph symbolgraph, ) { - return parseCompoundDeclaration( - classSymbolJson, + return _parseCompoundDeclaration( + classSymbol, ClassDeclaration.new, symbolgraph, ); } StructDeclaration parseStructDeclaration( - Json classSymbolJson, + ParsedSymbol classSymbol, ParsedSymbolgraph symbolgraph, ) { - return parseCompoundDeclaration( - classSymbolJson, + return _parseCompoundDeclaration( + classSymbol, StructDeclaration.new, symbolgraph, ); diff --git a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_function_declaration.dart b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_function_declaration.dart new file mode 100644 index 000000000..02d705d22 --- /dev/null +++ b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_function_declaration.dart @@ -0,0 +1,154 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../../../ast/_core/shared/parameter.dart'; +import '../../../ast/_core/shared/referred_type.dart'; +import '../../../ast/declarations/compounds/members/method_declaration.dart'; +import '../../../ast/declarations/globals/globals.dart'; +import '../../_core/json.dart'; +import '../../_core/parsed_symbolgraph.dart'; +import '../../_core/token_list.dart'; +import '../../_core/utils.dart'; +import '../parse_type.dart'; + +GlobalFunctionDeclaration parseGlobalFunctionDeclaration( + Json globalFunctionSymbolJson, + ParsedSymbolgraph symbolgraph, +) { + final info = parseFunctionInfo( + globalFunctionSymbolJson['declarationFragments'], symbolgraph); + return GlobalFunctionDeclaration( + id: parseSymbolId(globalFunctionSymbolJson), + name: parseSymbolName(globalFunctionSymbolJson), + returnType: _parseFunctionReturnType(globalFunctionSymbolJson, symbolgraph), + params: info.params, + throws: info.throws, + async: info.async, + ); +} + +MethodDeclaration parseMethodDeclaration( + Json methodSymbolJson, + ParsedSymbolgraph symbolgraph, { + bool isStatic = false, +}) { + final info = + parseFunctionInfo(methodSymbolJson['declarationFragments'], symbolgraph); + return MethodDeclaration( + id: parseSymbolId(methodSymbolJson), + name: parseSymbolName(methodSymbolJson), + returnType: _parseFunctionReturnType(methodSymbolJson, symbolgraph), + params: info.params, + hasObjCAnnotation: parseSymbolHasObjcAnnotation(methodSymbolJson), + isStatic: isStatic, + throws: info.throws, + async: info.async, + ); +} + +typedef ParsedFunctionInfo = ({ + List params, + bool throws, + bool async, +}); + +ParsedFunctionInfo parseFunctionInfo( + Json declarationFragments, + ParsedSymbolgraph symbolgraph, +) { + // `declarationFragments` describes each part of the function declaration, + // things like the `func` keyword, brackets, spaces, etc. We only care about + // the parameter fragments and annotations here, and they always appear in + // this order: + // [ + // ..., '(', + // externalParam, ' ', internalParam, ': ', type..., ', ' + // externalParam, ': ', type..., ', ' + // externalParam, ' ', internalParam, ': ', type..., ')' + // annotations..., '->', returnType... + // ] + // Note: `internalParam` may or may not exist. + // + // The following loop attempts to extract parameters from this flat array + // while making sure the parameter fragments have the expected order. + + final parameters = []; + final malformedInitializerException = Exception( + 'Malformed parameter list at ${declarationFragments.path}: ' + '$declarationFragments', + ); + + var tokens = TokenList(declarationFragments); + String? maybeConsume(String kind) { + if (tokens.isEmpty) return null; + final spelling = getSpellingForKind(tokens[0], kind); + if (spelling != null) tokens = tokens.slice(1); + return spelling; + } + + final openParen = tokens.indexWhere((tok) => matchFragment(tok, 'text', '(')); + if (openParen == -1) throw malformedInitializerException; + tokens = tokens.slice(openParen + 1); + + // Parse parameters until we find a ')'. + if (maybeConsume('text') == ')') { + // Empty param list. + } else { + while (true) { + final externalParam = maybeConsume('externalParam'); + if (externalParam == null) throw malformedInitializerException; + + var sep = maybeConsume('text'); + String? internalParam; + if (sep == '') { + internalParam = maybeConsume('internalParam'); + if (internalParam == null) throw malformedInitializerException; + sep = maybeConsume('text'); + } + + if (sep != ':') throw malformedInitializerException; + final (type, remainingTokens) = parseType(symbolgraph, tokens); + tokens = remainingTokens; + + parameters.add(Parameter( + name: externalParam, + internalName: internalParam, + type: type, + )); + + final end = maybeConsume('text'); + if (end == ')') break; + if (end != ',') throw malformedInitializerException; + } + } + + // Parse annotations until we run out. The annotations are keywords separated + // by whitespace tokens. + final annotations = {}; + while (true) { + final keyword = maybeConsume('keyword'); + if (keyword == null) { + if (maybeConsume('text') != '') break; + } else { + annotations.add(keyword); + } + } + + return ( + params: parameters, + throws: annotations.contains('throws'), + async: annotations.contains('async'), + ); +} + +ReferredType _parseFunctionReturnType( + Json methodSymbolJson, + ParsedSymbolgraph symbolgraph, +) { + final returnJson = + TokenList(methodSymbolJson['functionSignature']['returns']); + final (returnType, unparsed) = parseType(symbolgraph, returnJson); + assert(unparsed.isEmpty, '$returnJson\n\n$returnType\n\n$unparsed\n'); + return returnType; +} diff --git a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_initializer_declaration.dart b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_initializer_declaration.dart index 11c0904c0..74583e447 100644 --- a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_initializer_declaration.dart +++ b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_initializer_declaration.dart @@ -1,101 +1,43 @@ -import '../../../ast/_core/shared/parameter.dart'; import '../../../ast/declarations/compounds/members/initializer_declaration.dart'; import '../../_core/json.dart'; import '../../_core/parsed_symbolgraph.dart'; import '../../_core/utils.dart'; +import 'parse_function_declaration.dart'; InitializerDeclaration parseInitializerDeclaration( Json initializerSymbolJson, ParsedSymbolgraph symbolgraph, ) { - return InitializerDeclaration( - id: parseSymbolId(initializerSymbolJson), - params: parseInitializerParams(initializerSymbolJson, symbolgraph), - hasObjCAnnotation: parseSymbolHasObjcAnnotation(initializerSymbolJson), - ); -} + final id = parseSymbolId(initializerSymbolJson); -List parseInitializerParams( - Json initializerSymbolJson, - ParsedSymbolgraph symbolgraph, -) { // Initializers don't have `functionSignature` field in symbolgraph like // methods do, so we have our only option is to use `declarationFragments`. - final fragments = initializerSymbolJson['declarationFragments']; - - // `declarationFragments` describes each part of the initializer declaration, - // things like `init` keyword, brackets, spaces, etc. We only care about the - // parameter fragments here, and they always appear in this order: - // [ - // 'externalParam', - // ..., - // `internalParam`, - // ..., - // `typeIdentifier`, - // ... - // 'externalParam', - // ..., - // `internalParam`, - // ..., - // `typeIdentifier` - // ] - // Note: `internalParam` may or may not exist. - // - // The following loop attempts to extract parameters from this flat array - // while making sure the parameter fragments have the expected order. - - String? externalParam; - String? internalParam; - String? typeId; + final declarationFragments = initializerSymbolJson['declarationFragments']; - final parameters = []; - - for (final fragmentJson in fragments) { - final kind = fragmentJson['kind'].get(); - final invalidOrderException = Exception( - 'Invalid fragments order at ${fragmentJson.path}', - ); - - switch (kind) { - case 'externalParam': - if (externalParam != null || internalParam != null || typeId != null) { - throw invalidOrderException; - } - externalParam = fragmentJson['spelling'].get(); - break; - case 'internalParam': - if (externalParam == null || internalParam != null || typeId != null) { - throw invalidOrderException; - } - internalParam = fragmentJson['spelling'].get(); - break; - case 'typeIdentifier': - if (externalParam == null || typeId != null) { - throw invalidOrderException; - } - typeId = fragmentJson['preciseIdentifier'].get(); - } - - if (externalParam != null && typeId != null) { - parameters.add(Parameter( - name: externalParam, - internalName: internalParam, - type: parseTypeFromId(typeId, symbolgraph), - )); - - internalParam = null; - externalParam = null; - typeId = null; - } + // All initializers should start with an `init` keyword. + if (!matchFragment(declarationFragments[0], 'keyword', 'init')) { + throw Exception('Invalid initializer at ${declarationFragments.path}: $id'); } - // This ensures there's no half-described parameter at the end - // of `declarationFragments` array. - if (externalParam != null || internalParam != null || typeId != null) { - throw Exception( - 'Missing parameter fragments at the end of ${fragments.path}', - ); + final info = parseFunctionInfo(declarationFragments, symbolgraph); + + if (info.async) { + // TODO(https://github.com/dart-lang/native/issues/1778): Support async + // initializerse. + throw Exception("Async initializers aren't supported yet, at " + '${initializerSymbolJson.path}'); } - return parameters; + return InitializerDeclaration( + id: id, + params: info.params, + hasObjCAnnotation: parseSymbolHasObjcAnnotation(initializerSymbolJson), + isOverriding: parseIsOverriding(initializerSymbolJson), + isFailable: parseIsFailableInit(id, declarationFragments), + throws: info.throws, + async: info.async, + ); } + +bool parseIsFailableInit(String id, Json declarationFragments) => + matchFragment(declarationFragments[1], 'text', '?('); diff --git a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_variable_declaration.dart b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_variable_declaration.dart index 783c6bb48..1877af6c1 100644 --- a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_variable_declaration.dart +++ b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_variable_declaration.dart @@ -1,11 +1,14 @@ -import '../../../ast/_core/interfaces/declaration.dart'; +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import '../../../ast/_core/shared/referred_type.dart'; import '../../../ast/declarations/compounds/members/property_declaration.dart'; import '../../../ast/declarations/globals/globals.dart'; import '../../_core/json.dart'; import '../../_core/parsed_symbolgraph.dart'; +import '../../_core/token_list.dart'; import '../../_core/utils.dart'; -import '../parse_declarations.dart'; PropertyDeclaration parsePropertyDeclaration( Json propertySymbolJson, @@ -21,6 +24,8 @@ PropertyDeclaration parsePropertyDeclaration( isConstant: isConstant, hasSetter: isConstant ? false : _parsePropertyHasSetter(propertySymbolJson), isStatic: isStatic, + throws: _parseVariableThrows(propertySymbolJson), + async: _parseVariableAsync(propertySymbolJson), ); } @@ -29,73 +34,70 @@ GlobalVariableDeclaration parseGlobalVariableDeclaration( ParsedSymbolgraph symbolgraph, { bool isStatic = false, }) { + final isConstant = _parseVariableIsConstant(variableSymbolJson); + final hasSetter = _parsePropertyHasSetter(variableSymbolJson); return GlobalVariableDeclaration( id: parseSymbolId(variableSymbolJson), name: parseSymbolName(variableSymbolJson), type: _parseVariableType(variableSymbolJson, symbolgraph), - isConstant: _parseVariableIsConstant(variableSymbolJson), + isConstant: isConstant || !hasSetter, + throws: _parseVariableThrows(variableSymbolJson), + async: _parseVariableAsync(variableSymbolJson), ); } ReferredType _parseVariableType( Json propertySymbolJson, ParsedSymbolgraph symbolgraph, -) { - final subHeadings = propertySymbolJson['names']['subHeading']; - - final typeSymbolJson = - subHeadings.firstJsonWhereKey('kind', 'typeIdentifier'); - final typeSymbolId = typeSymbolJson['preciseIdentifier'].get(); - final typeSymbol = symbolgraph.symbols[typeSymbolId]; - - if (typeSymbol == null) { - throw Exception( - 'The property at path "${propertySymbolJson.path}" has a return type ' - 'that does not exist among parsed symbols.', - ); - } - - final typeDeclaration = parseDeclaration( - typeSymbol, - symbolgraph, - ); - - return typeDeclaration.asDeclaredType; -} +) => + parseTypeAfterSeparator( + TokenList(propertySymbolJson['names']['subHeading']), symbolgraph); bool _parseVariableIsConstant(Json variableSymbolJson) { final fragmentsJson = variableSymbolJson['declarationFragments']; - final declarationKeywordJson = fragmentsJson.firstWhere( - (json) { - if (json['kind'].get() != 'keyword') return false; - - final keyword = json['spelling'].get(); - if (keyword != 'var' && keyword != 'let') return false; - - return true; - }, + final declarationKeyword = fragmentsJson.firstWhere( + (json) => + matchFragment(json, 'keyword', 'var') || + matchFragment(json, 'keyword', 'let'), orElse: () => throw ArgumentError( 'Invalid property declaration fragments at path: ${fragmentsJson.path}. ' 'Expected to find "var" or "let" as a keyword, found none', ), ); - final declarationKeyword = declarationKeywordJson['spelling'].get(); + return matchFragment(declarationKeyword, 'keyword', 'let'); +} - return declarationKeyword == 'let'; +bool _parseVariableThrows(Json json) { + final throws = json['declarationFragments'] + .any((frag) => matchFragment(frag, 'keyword', 'throws')); + if (throws) { + // TODO(https://github.com/dart-lang/native/issues/1765): Support throwing + // getters. + throw Exception("Throwing getters aren't supported yet, at ${json.path}"); + } + return throws; +} + +bool _parseVariableAsync(Json json) { + final async = json['declarationFragments'] + .any((frag) => matchFragment(frag, 'keyword', 'async')); + if (async) { + // TODO(https://github.com/dart-lang/native/issues/1778): Support async + // getters. + throw Exception("Async getters aren't supported yet, at ${json.path}"); + } + return async; } bool _parsePropertyHasSetter(Json propertySymbolJson) { final fragmentsJson = propertySymbolJson['declarationFragments']; - final hasExplicitSetter = fragmentsJson.any( - (json) => json['spelling'].get() == 'set', - ); - - final hasExplicitGetter = fragmentsJson.any( - (json) => json['spelling'].get() == 'get', - ); + final hasExplicitSetter = + fragmentsJson.any((frag) => matchFragment(frag, 'keyword', 'set')); + final hasExplicitGetter = + fragmentsJson.any((frag) => matchFragment(frag, 'keyword', 'get')); if (hasExplicitGetter) { if (hasExplicitSetter) { diff --git a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/pase_function_declaration.dart b/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/pase_function_declaration.dart deleted file mode 100644 index bdff14992..000000000 --- a/pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/pase_function_declaration.dart +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../../../ast/_core/interfaces/declaration.dart'; -import '../../../ast/_core/shared/parameter.dart'; -import '../../../ast/_core/shared/referred_type.dart'; -import '../../../ast/declarations/compounds/members/method_declaration.dart'; -import '../../../ast/declarations/globals/globals.dart'; -import '../../_core/json.dart'; -import '../../_core/parsed_symbolgraph.dart'; -import '../../_core/utils.dart'; -import '../parse_declarations.dart'; - -GlobalFunctionDeclaration parseGlobalFunctionDeclaration( - Json globalFunctionSymbolJson, - ParsedSymbolgraph symbolgraph, -) { - return GlobalFunctionDeclaration( - id: parseSymbolId(globalFunctionSymbolJson), - name: parseSymbolName(globalFunctionSymbolJson), - returnType: _parseFunctionReturnType(globalFunctionSymbolJson, symbolgraph), - params: _parseFunctionParams(globalFunctionSymbolJson, symbolgraph), - ); -} - -MethodDeclaration parseMethodDeclaration( - Json methodSymbolJson, - ParsedSymbolgraph symbolgraph, { - bool isStatic = false, -}) { - return MethodDeclaration( - id: parseSymbolId(methodSymbolJson), - name: parseSymbolName(methodSymbolJson), - returnType: _parseFunctionReturnType(methodSymbolJson, symbolgraph), - params: _parseFunctionParams(methodSymbolJson, symbolgraph), - hasObjCAnnotation: parseSymbolHasObjcAnnotation(methodSymbolJson), - isStatic: isStatic, - ); -} - -ReferredType? _parseFunctionReturnType( - Json methodSymbolJson, - ParsedSymbolgraph symbolgraph, -) { - final returnJson = methodSymbolJson['functionSignature']['returns'][0]; - - // This means there's no return type - if (returnJson['spelling'].get() == '()') { - return null; - } - - final returnTypeId = returnJson['preciseIdentifier'].get(); - - final returnTypeSymbol = symbolgraph.symbols[returnTypeId]; - - if (returnTypeSymbol == null) { - throw Exception( - 'The method at path "${methodSymbolJson.path}" has a return type that ' - 'does not exist among parsed symbols.', - ); - } - - final returnTypeDeclaration = parseDeclaration( - returnTypeSymbol, - symbolgraph, - ); - - return returnTypeDeclaration.asDeclaredType; -} - -List _parseFunctionParams( - Json methodSymbolJson, - ParsedSymbolgraph symbolgraph, -) { - final paramList = methodSymbolJson['functionSignature']['parameters']; - - if (!paramList.exists) return []; - - return paramList - .map( - (param) => Parameter( - name: param['name'].get(), - internalName: param['internalName'].get(), - type: _parseParamType(param, symbolgraph), - ), - ) - .toList(); -} - -ReferredType _parseParamType( - Json paramSymbolJson, - ParsedSymbolgraph symbolgraph, -) { - final fragments = paramSymbolJson['declarationFragments']; - - final paramTypeId = fragments - .firstJsonWhereKey('kind', 'typeIdentifier')['preciseIdentifier'] - .get(); - - return parseTypeFromId(paramTypeId, symbolgraph); -} diff --git a/pkgs/swift2objc/lib/src/parser/parsers/parse_declarations.dart b/pkgs/swift2objc/lib/src/parser/parsers/parse_declarations.dart index 48d800901..36b74c4f4 100644 --- a/pkgs/swift2objc/lib/src/parser/parsers/parse_declarations.dart +++ b/pkgs/swift2objc/lib/src/parser/parsers/parse_declarations.dart @@ -2,31 +2,30 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:developer'; +import 'package:logging/logging.dart'; import '../../ast/_core/interfaces/declaration.dart'; import '../_core/parsed_symbolgraph.dart'; import '../_core/utils.dart'; import 'declaration_parsers/parse_compound_declaration.dart'; +import 'declaration_parsers/parse_function_declaration.dart'; import 'declaration_parsers/parse_initializer_declaration.dart'; import 'declaration_parsers/parse_variable_declaration.dart'; -import 'declaration_parsers/pase_function_declaration.dart'; List parseDeclarations(ParsedSymbolgraph symbolgraph) { final declarations = []; for (final symbol in symbolgraph.symbols.values) { - try { - final declaration = parseDeclaration(symbol, symbolgraph); + final declaration = tryParseDeclaration(symbol, symbolgraph); + if (declaration != null) { declarations.add(declaration); - } catch (e) { - log('$e'); } } return declarations.topLevelOnly; } +// TODO(https://github.com/dart-lang/native/issues/1815): Support for extensions Declaration parseDeclaration( ParsedSymbol parsedSymbol, ParsedSymbolgraph symbolgraph, @@ -37,11 +36,15 @@ Declaration parseDeclaration( final symbolJson = parsedSymbol.json; + if (isObsoleted(symbolJson)) { + throw ObsoleteException(parseSymbolId(symbolJson)); + } + final symbolType = symbolJson['kind']['identifier'].get(); parsedSymbol.declaration = switch (symbolType) { - 'swift.class' => parseClassDeclaration(symbolJson, symbolgraph), - 'swift.struct' => parseStructDeclaration(symbolJson, symbolgraph), + 'swift.class' => parseClassDeclaration(parsedSymbol, symbolgraph), + 'swift.struct' => parseStructDeclaration(parsedSymbol, symbolgraph), 'swift.method' => parseMethodDeclaration(symbolJson, symbolgraph, isStatic: false), 'swift.type.method' => @@ -60,3 +63,15 @@ Declaration parseDeclaration( return parsedSymbol.declaration!; } + +Declaration? tryParseDeclaration( + ParsedSymbol parsedSymbol, + ParsedSymbolgraph symbolgraph, +) { + try { + return parseDeclaration(parsedSymbol, symbolgraph); + } catch (e) { + Logger.root.severe('$e'); + } + return null; +} diff --git a/pkgs/swift2objc/lib/src/parser/parsers/parse_relations_map.dart b/pkgs/swift2objc/lib/src/parser/parsers/parse_relations_map.dart index 6a9c061dc..93019bbb6 100644 --- a/pkgs/swift2objc/lib/src/parser/parsers/parse_relations_map.dart +++ b/pkgs/swift2objc/lib/src/parser/parsers/parse_relations_map.dart @@ -32,7 +32,7 @@ ParsedRelationsMap parseRelationsMap(Json symbolgraphJson) { json: relationJson, ); - for (var id in [sourceId, targetId]) { + for (final id in [sourceId, targetId]) { (relationsMap[id] ??= []).add(relation); } } diff --git a/pkgs/swift2objc/lib/src/parser/parsers/parse_type.dart b/pkgs/swift2objc/lib/src/parser/parsers/parse_type.dart new file mode 100644 index 000000000..6e7a4231f --- /dev/null +++ b/pkgs/swift2objc/lib/src/parser/parsers/parse_type.dart @@ -0,0 +1,122 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../../ast/_core/interfaces/declaration.dart'; +import '../../ast/_core/shared/referred_type.dart'; +import '../../ast/declarations/built_in/built_in_declaration.dart'; +import '../_core/json.dart'; +import '../_core/parsed_symbolgraph.dart'; +import '../_core/token_list.dart'; +import 'parse_declarations.dart'; + +/// Parse a type from a list of Json fragments. +/// +/// Returns the parsed type, and a Json slice of the remaining fragments that +/// weren't part of the type. +(ReferredType, TokenList) parseType( + ParsedSymbolgraph symbolgraph, TokenList fragments) { + var (type, suffix) = _parsePrefixTypeExpression(symbolgraph, fragments); + while (true) { + final (nextType, nextSuffix) = + _maybeParseSuffixTypeExpression(symbolgraph, type, suffix); + if (nextType == null) break; + type = nextType; + suffix = nextSuffix; + } + return (type, suffix); +} + +// Prefix expressions are literals or prefix operators (stuff that can appear +// at the beginning of the list of fragments). If we were parsing a programming +// language, these would be things like `123` or `-x`. +(ReferredType, TokenList) _parsePrefixTypeExpression( + ParsedSymbolgraph symbolgraph, TokenList fragments) { + final token = fragments[0]; + final parselet = _prefixParsets[_tokenId(token)]; + if (parselet == null) throw Exception('Invalid type at "${token.path}"'); + return parselet(symbolgraph, token, fragments.slice(1)); +} + +// Suffix expressions are infix operators or suffix operators (basically +// anything that isn't a prefix). If we were parsing a programming language, +// these would be things like `x + y`, `z!`, or even `x ? y : z`. +(ReferredType?, TokenList) _maybeParseSuffixTypeExpression( + ParsedSymbolgraph symbolgraph, + ReferredType prefixType, + TokenList fragments) { + if (fragments.isEmpty) return (null, fragments); + final token = fragments[0]; + final parselet = _suffixParsets[_tokenId(token)]; + if (parselet == null) return (null, fragments); + return parselet(symbolgraph, prefixType, token, fragments.slice(1)); +} + +// For most tokens, we only care about the kind. But some tokens just have a +// kind of 'text', and the spelling is what distinguishes them. +String _tokenId(Json token) { + final kind = token['kind'].get(); + return kind == 'text' ? 'text: ${token['spelling'].get()}' : kind; +} + +// ======================== +// === Prefix parselets === +// ======================== + +typedef PrefixParselet = (ReferredType, TokenList) Function( + ParsedSymbolgraph symbolgraph, Json token, TokenList fragments); + +(ReferredType, TokenList) _typeIdentifierParselet( + ParsedSymbolgraph symbolgraph, Json token, TokenList fragments) { + final id = token['preciseIdentifier'].get(); + final symbol = symbolgraph.symbols[id]; + + if (symbol == null) { + throw Exception( + 'The type at "${token.path}" does not exist among parsed symbols.'); + } + + final type = parseDeclaration(symbol, symbolgraph).asDeclaredType; + return (type, fragments); +} + +(ReferredType, TokenList) _tupleParselet( + ParsedSymbolgraph symbolgraph, Json token, TokenList fragments) { + final nextToken = fragments[0]; + if (_tokenId(nextToken) != 'text: )') { + throw Exception('Tuples not supported yet, at ${token.path}'); + } + return (voidType, fragments.slice(1)); +} + +Map _prefixParsets = { + 'typeIdentifier': _typeIdentifierParselet, + 'text: (': _tupleParselet, +}; + +// ======================== +// === Suffix parselets === +// ======================== + +typedef SuffixParselet = (ReferredType, TokenList) Function( + ParsedSymbolgraph symbolgraph, + ReferredType prefixType, + Json token, + TokenList fragments); + +(ReferredType, TokenList) _optionalParselet(ParsedSymbolgraph symbolgraph, + ReferredType prefixType, Json token, TokenList fragments) => + (OptionalType(prefixType), fragments); + +(ReferredType, TokenList) _nestedTypeParselet(ParsedSymbolgraph symbolgraph, + ReferredType prefixType, Json token, TokenList fragments) { + // Parsing Foo.Bar. Foo is in prefixType, and the token is ".". Bar's ID + // is a globally uniquely identifier. We don't need to use Foo as a namespace. + // So we can actually completely discard Foo and just parse Bar. + return parseType(symbolgraph, fragments); +} + +Map _suffixParsets = { + 'text: ?': _optionalParselet, + 'text: .': _nestedTypeParselet, +}; diff --git a/pkgs/swift2objc/lib/src/transformer/_core/dependencies.dart b/pkgs/swift2objc/lib/src/transformer/_core/dependencies.dart new file mode 100644 index 000000000..30e693d88 --- /dev/null +++ b/pkgs/swift2objc/lib/src/transformer/_core/dependencies.dart @@ -0,0 +1,259 @@ +import '../../ast/_core/interfaces/declaration.dart'; +import '../../ast/_core/interfaces/enum_declaration.dart'; +import '../../ast/_core/interfaces/function_declaration.dart'; +import '../../ast/_core/interfaces/variable_declaration.dart'; +import '../../ast/_core/shared/parameter.dart'; +import '../../ast/_core/shared/referred_type.dart'; +import '../../ast/declarations/compounds/class_declaration.dart'; +import '../../ast/declarations/compounds/members/initializer_declaration.dart'; +import '../../ast/declarations/compounds/protocol_declaration.dart'; +import '../../ast/declarations/compounds/struct_declaration.dart'; + +// TODO(https://github.com/dart-lang/native/issues/1814): Type restrictions have not yet been implemented in system +class DependencyVisitor { + final Iterable declarations; + Set visitedDeclarations = {}; + + DependencyVisitor(this.declarations); + + Set visit(Declaration dec) { + final dependencies = {}; + + Iterable d = [dec]; + + while (true) { + final deps = d.fold>( + {}, (previous, element) => previous.union(visitDeclaration(element))); + final depDecls = declarations.where((d) => deps.contains(d.id)); + if (depDecls.isEmpty || + (dependencies.union(depDecls.toSet()).length) == + dependencies.length) { + break; + } else { + dependencies.addAll(depDecls); + d = depDecls; + } + } + + visitedDeclarations.addAll(dependencies); + + return dependencies; + } + + Set visitDeclaration(Declaration decl, [Set? context]) { + final cont = context ??= {}; + + // switch between declarations + if (decl is ClassDeclaration) { + visitClass(decl, cont); + } else if (decl is ProtocolDeclaration) { + visitProtocol(decl, cont); + } else if (decl is StructDeclaration) { + visitStruct(decl, cont); + } else if (decl is FunctionDeclaration) { + visitFunction(decl, cont); + } else if (decl is VariableDeclaration) { + visitVariable(decl, cont); + } else if (decl is EnumDeclaration) { + visitEnum(decl, cont); + } + + return cont; + } + + Set visitEnum(EnumDeclaration decl, [Set? context]) { + final cont = context ??= {}; + + // visit nested declarations + for (var n in decl.nestedDeclarations) { + visitDeclaration(n, cont); + } + + // visit protocols + for (var p in decl.conformedProtocols) { + visitProtocol(p.declaration, cont); + } + + // ensure generic types do not enter + cont.removeWhere( + (t) => decl.typeParams.map((type) => type.name).contains(t)); + + return cont; + } + + Set visitStruct(StructDeclaration decl, [Set? context]) { + final cont = context ??= {}; + + // visit variables + for (var d in decl.properties) { + visitVariable(d, cont); + } + + // visit methods + for (var m in decl.methods) { + visitFunction(m, cont); + } + + // visit initializers + for (var i in decl.initializers) { + visitInitializer(i, cont); + } + + // visit nested declarations + for (var n in decl.nestedDeclarations) { + visitDeclaration(n, cont); + } + + // visit protocols + for (var p in decl.conformedProtocols) { + visitProtocol(p.declaration, cont); + } + + // ensure generic types do not enter + cont.removeWhere( + (t) => decl.typeParams.map((type) => type.name).contains(t)); + + return cont; + } + + Set visitClass(ClassDeclaration decl, [Set? context]) { + final cont = context ??= {}; + + // visit variables + for (var d in decl.properties) { + visitVariable(d, cont); + } + + // visit methods + for (var m in decl.methods) { + visitFunction(m, cont); + } + + // visit initializers + for (var i in decl.initializers) { + visitInitializer(i, cont); + } + + // visit super if any + if (decl.superClass != null) { + visitDeclaration(decl.superClass!.declaration, cont); + } + + // visit nested declarations + for (var n in decl.nestedDeclarations) { + visitDeclaration(n, cont); + } + + // visit protocols + for (var p in decl.conformedProtocols) { + visitProtocol(p.declaration, cont); + } + + // ensure generic types do not enter + cont.removeWhere( + (t) => decl.typeParams.map((type) => type.name).contains(t)); + + return cont; + } + + Set visitProtocol(ProtocolDeclaration decl, [Set? context]) { + final cont = context ??= {}; + + // visit variables + for (var d in decl.properties) { + visitVariable(d, cont); + } + + // visit methods + for (var m in decl.methods) { + visitFunction(m, cont); + } + + // visit initializers + for (var i in decl.initializers) { + visitInitializer(i, cont); + } + + // visit nested declarations + for (var n in decl.nestedDeclarations) { + visitDeclaration(n, cont); + } + + // visit protocols + for (var p in decl.conformedProtocols) { + visitProtocol(p.declaration, cont); + } + + // ensure generic types do not enter + cont.removeWhere( + (t) => decl.typeParams.map((type) => type.name).contains(t)); + + return cont; + } + + Set visitInitializer(InitializerDeclaration decl, + [Set? context]) { + final cont = context ??= {}; + + // similar to `visitMethod`, except no return type + for (var p in decl.params) { + visitParameter(p, cont); + } + + return cont; + } + + Set visitFunction(FunctionDeclaration decl, [Set? context]) { + final cont = context ??= {}; + + // visit parameters + for (var p in decl.params) { + visitParameter(p, cont); + } + + // ensure generic types do not enter + cont.removeWhere( + (t) => decl.typeParams.map((type) => type.name).contains(t)); + + // visit return type + visitType(decl.returnType, cont); + + return cont; + } + + Set visitParameter(Parameter decl, [Set? context]) { + final cont = context ??= {}; + + // just visit type of parameter + visitType(decl.type, cont); + + return cont; + } + + Set visitVariable(VariableDeclaration decl, [Set? context]) { + final cont = context ??= {}; + + // just return property type + visitType(decl.type, cont); + + return cont; + } + + Set visitType(ReferredType type, [Set? context]) { + final cont = context ??= {}; + + // we need to confirm the types located + // check what kind of type [type] is + switch (type) { + case DeclaredType(): + cont.add(type.id); + break; + case GenericType(): + // do nothing + break; + case OptionalType(): + visitType(type.child, cont); + } + return cont; + } +} diff --git a/pkgs/swift2objc/lib/src/transformer/_core/unique_namer.dart b/pkgs/swift2objc/lib/src/transformer/_core/unique_namer.dart index 9af08ae67..8a13e1202 100644 --- a/pkgs/swift2objc/lib/src/transformer/_core/unique_namer.dart +++ b/pkgs/swift2objc/lib/src/transformer/_core/unique_namer.dart @@ -1,9 +1,14 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import '../../ast/_core/interfaces/compound_declaration.dart'; class UniqueNamer { final Set _usedNames; - UniqueNamer(Iterable usedNames) : _usedNames = usedNames.toSet(); + UniqueNamer([Iterable usedNames = const []]) + : _usedNames = usedNames.toSet(); UniqueNamer.inCompound(CompoundDeclaration compoundDeclaration) : _usedNames = { diff --git a/pkgs/swift2objc/lib/src/transformer/_core/utils.dart b/pkgs/swift2objc/lib/src/transformer/_core/utils.dart index 8561d6a0f..e594a24ac 100644 --- a/pkgs/swift2objc/lib/src/transformer/_core/utils.dart +++ b/pkgs/swift2objc/lib/src/transformer/_core/utils.dart @@ -1,51 +1,79 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import '../../ast/_core/interfaces/declaration.dart'; import '../../ast/_core/shared/referred_type.dart'; import '../../ast/declarations/compounds/class_declaration.dart'; import '../transform.dart'; import 'unique_namer.dart'; +// TODO(https://github.com/dart-lang/native/issues/1358): These functions should +// probably be methods on ReferredType, but the transformDeclaration call makes +// that weird. Refactor this as part of the transformer refactor. + (String value, ReferredType type) maybeWrapValue( ReferredType type, - String valueIdentifier, + String value, UniqueNamer globalNamer, TransformationMap transformationMap, ) { - if (type is GenericType) { - throw UnimplementedError('Generic types are not implemented yet'); - } - - type as DeclaredType; - if (type.isObjCRepresentable) { - return (valueIdentifier, type); + return (value, type); } - final transformedTypeDeclaration = transformDeclaration( - type.declaration, - globalNamer, - transformationMap, - ); + if (type is GenericType) { + throw UnimplementedError('Generic types are not implemented yet'); + } else if (type is DeclaredType) { + final transformedTypeDeclaration = transformDeclaration( + type.declaration, + globalNamer, + transformationMap, + ); - return ( - '${transformedTypeDeclaration.name}($valueIdentifier)', - transformedTypeDeclaration.asDeclaredType - ); + return ( + '${transformedTypeDeclaration.name}($value)', + transformedTypeDeclaration.asDeclaredType + ); + } else if (type is OptionalType) { + final (newValue, newType) = + maybeWrapValue(type.child, '$value!', globalNamer, transformationMap); + return ( + '$value == nil ? nil : $newValue', + OptionalType(newType), + ); + } else { + throw UnimplementedError('Unknown type: $type'); + } } (String value, ReferredType type) maybeUnwrapValue( ReferredType type, - String valueIdentifier, + String value, ) { - if (type is GenericType) { - throw UnimplementedError('Generic types are not implemented yet'); + if (!type.isObjCRepresentable) { + return (value, type); } - final declaration = (type as DeclaredType).declaration; - - if (declaration is ClassDeclaration && declaration.wrappedInstance != null) { - final wrappedInstance = declaration.wrappedInstance; - return ('$valueIdentifier.${wrappedInstance!.name}', wrappedInstance.type); + if (type is GenericType) { + throw UnimplementedError('Generic types are not implemented yet'); + } else if (type is DeclaredType) { + final declaration = type.declaration; + if (declaration is ClassDeclaration) { + final wrappedInstance = declaration.wrappedInstance!; + return ('$value.${wrappedInstance.name}', wrappedInstance.type); + } else { + return (value, type); + } + } else if (type is OptionalType) { + final optValue = '$value?'; + var (newValue, newType) = maybeUnwrapValue(type.child, optValue); + if (newValue == optValue) { + // newValue is value?, so the ? isn't necessary and causes compile errors. + newValue = value; + } + return (newValue, OptionalType(newType)); } else { - return (valueIdentifier, type); + throw UnimplementedError('Unknown type: $type'); } } diff --git a/pkgs/swift2objc/lib/src/transformer/transform.dart b/pkgs/swift2objc/lib/src/transformer/transform.dart index e7d4618c5..750d2efcd 100644 --- a/pkgs/swift2objc/lib/src/transformer/transform.dart +++ b/pkgs/swift2objc/lib/src/transformer/transform.dart @@ -4,29 +4,44 @@ import '../ast/_core/interfaces/compound_declaration.dart'; import '../ast/_core/interfaces/declaration.dart'; +import '../ast/_core/interfaces/nestable_declaration.dart'; import '../ast/declarations/compounds/class_declaration.dart'; import '../ast/declarations/compounds/struct_declaration.dart'; import '../ast/declarations/globals/globals.dart'; +import '_core/dependencies.dart'; import '_core/unique_namer.dart'; import 'transformers/transform_compound.dart'; import 'transformers/transform_globals.dart'; typedef TransformationMap = Map; -List transform(List declarations) { - final TransformationMap transformationMap; +Set generateDependencies( + Iterable decls, Iterable allDecls) { + final visitor = DependencyVisitor(allDecls); + for (final dec in decls) { + visitor.visit(dec); + } + + return visitor.visitedDeclarations; +} - transformationMap = {}; +/// Transforms the given declarations into the desired ObjC wrapped declarations +List transform(List declarations, + {required bool Function(Declaration) filter}) { + final transformationMap = {}; + + final declarations0 = declarations.where(filter).toSet(); + declarations0.addAll(generateDependencies(declarations0, declarations)); final globalNamer = UniqueNamer( - declarations.map((declaration) => declaration.name), + declarations0.map((declaration) => declaration.name), ); final globals = Globals( - functions: declarations.whereType().toList(), - variables: declarations.whereType().toList(), + functions: declarations0.whereType().toList(), + variables: declarations0.whereType().toList(), ); - final nonGlobals = declarations + final nonGlobals = declarations0 .where( (declaration) => declaration is! GlobalFunctionDeclaration && @@ -48,17 +63,24 @@ List transform(List declarations) { Declaration transformDeclaration( Declaration declaration, - UniqueNamer globalNamer, - TransformationMap transformationMap, -) { + UniqueNamer parentNamer, + TransformationMap transformationMap, { + bool nested = false, +}) { if (transformationMap[declaration] != null) { return transformationMap[declaration]!; } + if (declaration is NestableDeclaration && declaration.nestingParent != null) { + // It's important that nested declarations are only transformed in the + // context of their parent, so that their parentNamer is correct. + assert(nested); + } + return switch (declaration) { ClassDeclaration() || StructDeclaration() => transformCompound( declaration as CompoundDeclaration, - globalNamer, + parentNamer, transformationMap, ), _ => throw UnimplementedError(), diff --git a/pkgs/swift2objc/lib/src/transformer/transformers/const.dart b/pkgs/swift2objc/lib/src/transformer/transformers/const.dart new file mode 100644 index 000000000..8881e8b21 --- /dev/null +++ b/pkgs/swift2objc/lib/src/transformer/transformers/const.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Certain methods are not allowed to be overriden in swift. +const disallowedMethods = { + 'hashValue', +}; diff --git a/pkgs/swift2objc/lib/src/transformer/transformers/transform_compound.dart b/pkgs/swift2objc/lib/src/transformer/transformers/transform_compound.dart index 1647997d5..cd06487a0 100644 --- a/pkgs/swift2objc/lib/src/transformer/transformers/transform_compound.dart +++ b/pkgs/swift2objc/lib/src/transformer/transformers/transform_compound.dart @@ -4,6 +4,7 @@ import '../../ast/_core/interfaces/compound_declaration.dart'; import '../../ast/_core/interfaces/declaration.dart'; +import '../../ast/_core/interfaces/nestable_declaration.dart'; import '../../ast/_core/shared/parameter.dart'; import '../../ast/declarations/built_in/built_in_declaration.dart'; import '../../ast/declarations/compounds/class_declaration.dart'; @@ -18,7 +19,7 @@ import 'transform_variable.dart'; ClassDeclaration transformCompound( CompoundDeclaration originalCompound, - UniqueNamer globalNamer, + UniqueNamer parentNamer, TransformationMap transformationMap, ) { final compoundNamer = UniqueNamer.inCompound(originalCompound); @@ -31,7 +32,7 @@ ClassDeclaration transformCompound( final transformedCompound = ClassDeclaration( id: originalCompound.id.addIdSuffix('wrapper'), - name: globalNamer.makeUnique('${originalCompound.name}Wrapper'), + name: parentNamer.makeUnique('${originalCompound.name}Wrapper'), hasObjCAnnotation: true, superClass: BuiltInDeclaration.swiftNSObject.asDeclaredType, isWrapper: true, @@ -41,13 +42,23 @@ ClassDeclaration transformCompound( transformationMap[originalCompound] = transformedCompound; + transformedCompound.nestedDeclarations = originalCompound.nestedDeclarations + .map((nested) => transformDeclaration( + nested, compoundNamer, transformationMap, nested: true) + as NestableDeclaration) + .toList() + ..sort((Declaration a, Declaration b) => a.id.compareTo(b.id)); + transformedCompound.nestedDeclarations + .fillNestingParents(transformedCompound); + transformedCompound.properties = originalCompound.properties .map((property) => transformProperty( property, wrappedCompoundInstance, - globalNamer, + parentNamer, transformationMap, )) + .nonNulls .toList() ..sort((Declaration a, Declaration b) => a.id.compareTo(b.id)); @@ -55,7 +66,7 @@ ClassDeclaration transformCompound( .map((initializer) => transformInitializer( initializer, wrappedCompoundInstance, - globalNamer, + parentNamer, transformationMap, )) .toList() @@ -65,9 +76,10 @@ ClassDeclaration transformCompound( .map((method) => transformMethod( method, wrappedCompoundInstance, - globalNamer, + parentNamer, transformationMap, )) + .nonNulls .toList() ..sort((Declaration a, Declaration b) => a.id.compareTo(b.id)); @@ -86,6 +98,10 @@ InitializerDeclaration _buildWrapperInitializer( type: wrappedClassInstance.type, ) ], + isOverriding: false, + isFailable: false, + throws: false, + async: false, statements: ['self.${wrappedClassInstance.name} = wrappedInstance'], hasObjCAnnotation: wrappedClassInstance.hasObjCAnnotation, ); diff --git a/pkgs/swift2objc/lib/src/transformer/transformers/transform_function.dart b/pkgs/swift2objc/lib/src/transformer/transformers/transform_function.dart index e0b42daaf..c5e375282 100644 --- a/pkgs/swift2objc/lib/src/transformer/transformers/transform_function.dart +++ b/pkgs/swift2objc/lib/src/transformer/transformers/transform_function.dart @@ -11,6 +11,7 @@ import '../../ast/declarations/globals/globals.dart'; import '../_core/unique_namer.dart'; import '../_core/utils.dart'; import '../transform.dart'; +import 'const.dart'; import 'transform_referred_type.dart'; // The main difference between generating a wrapper method for a global function @@ -19,12 +20,16 @@ import 'transform_referred_type.dart'; // wrapped class instance in the wrapper class. In global function case, // it can be referenced directly since it's not a member of any entity. -MethodDeclaration transformMethod( +MethodDeclaration? transformMethod( MethodDeclaration originalMethod, PropertyDeclaration wrappedClassInstance, UniqueNamer globalNamer, TransformationMap transformationMap, ) { + if (disallowedMethods.contains(originalMethod.name)) { + return null; + } + return _transformFunction( originalMethod, globalNamer, @@ -32,7 +37,7 @@ MethodDeclaration transformMethod( wrapperMethodName: originalMethod.name, originalCallStatementGenerator: (arguments) { final methodSource = originalMethod.isStatic - ? wrappedClassInstance.type.name + ? wrappedClassInstance.type.swiftType : wrappedClassInstance.name; return '$methodSource.${originalMethod.name}($arguments)'; }, @@ -79,17 +84,11 @@ MethodDeclaration _transformFunction( ) .toList(); - final ReferredType? transformedReturnType; - - if (originalFunction.returnType == null) { - transformedReturnType = null; - } else { - transformedReturnType = transformReferredType( - originalFunction.returnType!, - globalNamer, - transformationMap, - ); - } + final transformedReturnType = transformReferredType( + originalFunction.returnType, + globalNamer, + transformationMap, + ); final transformedMethod = MethodDeclaration( id: originalFunction.id, @@ -100,6 +99,8 @@ MethodDeclaration _transformFunction( isStatic: originalFunction is MethodDeclaration ? originalFunction.isStatic : true, + throws: originalFunction.throws, + async: originalFunction.async, ); transformedMethod.statements = _generateStatements( @@ -113,43 +114,51 @@ MethodDeclaration _transformFunction( return transformedMethod; } -List _generateStatements( - FunctionDeclaration originalFunction, - MethodDeclaration transformedMethod, - UniqueNamer globalNamer, - TransformationMap transformationMap, { - required String Function(String arguments) originalCallGenerator, -}) { - final argumentsList = []; +String generateInvocationParams(UniqueNamer localNamer, + List originalParams, List transformedParams) { + assert(originalParams.length == transformedParams.length); - for (var i = 0; i < originalFunction.params.length; i++) { - final originalParam = originalFunction.params[i]; - final transformedParam = transformedMethod.params[i]; + final argumentsList = []; + for (var i = 0; i < originalParams.length; i++) { + final originalParam = originalParams[i]; + final transformedParam = transformedParams[i]; - final transformedParamName = - transformedParam.internalName ?? transformedParam.name; + final transformedParamName = localNamer + .makeUnique(transformedParam.internalName ?? transformedParam.name); final (unwrappedParamValue, unwrappedType) = maybeUnwrapValue( transformedParam.type, transformedParamName, ); - assert(unwrappedType.id == originalParam.type.id); + assert(unwrappedType.sameAs(originalParam.type)); - var methodCallArg = '${originalParam.name}: $unwrappedParamValue'; - - argumentsList.add(methodCallArg); + argumentsList.add(originalParam.name == '_' + ? unwrappedParamValue + : '${originalParam.name}: $unwrappedParamValue'); } + return argumentsList.join(', '); +} - final arguments = argumentsList.join(', '); - - final originalMethodCall = originalCallGenerator(arguments); - - if (originalFunction.returnType == null) { - return [originalMethodCall]; +List _generateStatements( + FunctionDeclaration originalFunction, + MethodDeclaration transformedMethod, + UniqueNamer globalNamer, + TransformationMap transformationMap, { + required String Function(String arguments) originalCallGenerator, +}) { + final localNamer = UniqueNamer(); + final arguments = generateInvocationParams( + localNamer, originalFunction.params, transformedMethod.params); + var originalMethodCall = originalCallGenerator(arguments); + if (transformedMethod.async) { + originalMethodCall = 'await $originalMethodCall'; + } + if (transformedMethod.throws) { + originalMethodCall = 'try $originalMethodCall'; } - if (originalFunction.returnType!.id == transformedMethod.returnType?.id) { + if (originalFunction.returnType.sameAs(transformedMethod.returnType)) { return ['return $originalMethodCall']; } @@ -157,16 +166,17 @@ List _generateStatements( throw UnimplementedError('Generic types are not implemented yet'); } - final methodCallStmt = 'let result = $originalMethodCall'; + final resultName = localNamer.makeUnique('result'); + final methodCallStmt = 'let $resultName = $originalMethodCall'; final (wrappedResult, wrapperType) = maybeWrapValue( - originalFunction.returnType!, - 'result', + originalFunction.returnType, + resultName, globalNamer, transformationMap, ); - assert(transformedMethod.returnType?.id == wrapperType.id); + assert(wrapperType.sameAs(transformedMethod.returnType)); final returnStmt = 'return $wrappedResult'; diff --git a/pkgs/swift2objc/lib/src/transformer/transformers/transform_initializer.dart b/pkgs/swift2objc/lib/src/transformer/transformers/transform_initializer.dart index 584539013..293ec96fa 100644 --- a/pkgs/swift2objc/lib/src/transformer/transformers/transform_initializer.dart +++ b/pkgs/swift2objc/lib/src/transformer/transformers/transform_initializer.dart @@ -6,8 +6,8 @@ import '../../ast/_core/shared/parameter.dart'; import '../../ast/declarations/compounds/members/initializer_declaration.dart'; import '../../ast/declarations/compounds/members/property_declaration.dart'; import '../_core/unique_namer.dart'; -import '../_core/utils.dart'; import '../transform.dart'; +import 'transform_function.dart'; import 'transform_referred_type.dart'; InitializerDeclaration transformInitializer( @@ -31,10 +31,16 @@ InitializerDeclaration transformInitializer( .toList(); final transformedInitializer = InitializerDeclaration( - id: originalInitializer.id, - params: transformedParams, - hasObjCAnnotation: true, - ); + id: originalInitializer.id, + params: transformedParams, + hasObjCAnnotation: true, + isFailable: originalInitializer.isFailable, + throws: originalInitializer.throws, + async: originalInitializer.async, + // Because the wrapper class extends NSObject that has an initializer with + // no parameters. If we make a similar parameterless initializer we need + // to add `override` keyword. + isOverriding: transformedParams.isEmpty); transformedInitializer.statements = _generateInitializerStatements( originalInitializer, @@ -50,29 +56,27 @@ List _generateInitializerStatements( PropertyDeclaration wrappedClassInstance, InitializerDeclaration transformedInitializer, ) { - final argumentsList = []; - - for (var i = 0; i < originalInitializer.params.length; i++) { - final originalParam = originalInitializer.params[i]; - final transformedParam = transformedInitializer.params[i]; - - final transformedParamName = - transformedParam.internalName ?? transformedParam.name; - - final (unwrappedParamValue, unwrappedType) = maybeUnwrapValue( - transformedParam.type, - transformedParamName, - ); - - assert(unwrappedType.id == originalParam.type.id); - - var methodCallArg = '${originalParam.name}: $unwrappedParamValue'; - - argumentsList.add(methodCallArg); + final localNamer = UniqueNamer(); + final arguments = generateInvocationParams( + localNamer, originalInitializer.params, transformedInitializer.params); + var instanceConstruction = + '${wrappedClassInstance.type.swiftType}($arguments)'; + if (transformedInitializer.async) { + instanceConstruction = 'await $instanceConstruction'; + } + if (transformedInitializer.throws) { + instanceConstruction = 'try $instanceConstruction'; + } + if (originalInitializer.isFailable) { + final instance = localNamer.makeUnique('instance'); + return [ + 'if let $instance = $instanceConstruction {', + ' ${wrappedClassInstance.name} = $instance', + '} else {', + ' return nil', + '}', + ]; + } else { + return ['${wrappedClassInstance.name} = $instanceConstruction']; } - - final arguments = argumentsList.join(', '); - - final instanceConstruction = '${wrappedClassInstance.type.name}($arguments)'; - return ['${wrappedClassInstance.name} = $instanceConstruction']; } diff --git a/pkgs/swift2objc/lib/src/transformer/transformers/transform_referred_type.dart b/pkgs/swift2objc/lib/src/transformer/transformers/transform_referred_type.dart index 8ea30a15e..fcfd52f1f 100644 --- a/pkgs/swift2objc/lib/src/transformer/transformers/transform_referred_type.dart +++ b/pkgs/swift2objc/lib/src/transformer/transformers/transform_referred_type.dart @@ -7,24 +7,28 @@ import '../../ast/_core/shared/referred_type.dart'; import '../_core/unique_namer.dart'; import '../transform.dart'; -DeclaredType transformReferredType( - ReferredType referredType, +// TODO(https://github.com/dart-lang/native/issues/1358): Refactor this as a +// transformer or visitor. + +ReferredType transformReferredType( + ReferredType type, UniqueNamer globalNamer, TransformationMap transformationMap, ) { - if (referredType is GenericType) { + if (type.isObjCRepresentable) return type; + + if (type is GenericType) { throw UnimplementedError('Generic types are not supported yet'); + } else if (type is DeclaredType) { + return transformDeclaration( + type.declaration, + globalNamer, + transformationMap, + ).asDeclaredType; + } else if (type is OptionalType) { + return OptionalType( + transformReferredType(type.child, globalNamer, transformationMap)); + } else { + throw UnimplementedError('Unknown type: $type'); } - - referredType as DeclaredType; - - if (referredType.isObjCRepresentable) return referredType; - - final transformedDeclaration = transformDeclaration( - referredType.declaration, - globalNamer, - transformationMap, - ); - - return transformedDeclaration.asDeclaredType; } diff --git a/pkgs/swift2objc/lib/src/transformer/transformers/transform_variable.dart b/pkgs/swift2objc/lib/src/transformer/transformers/transform_variable.dart index 75382bfdd..c18e02a50 100644 --- a/pkgs/swift2objc/lib/src/transformer/transformers/transform_variable.dart +++ b/pkgs/swift2objc/lib/src/transformer/transformers/transform_variable.dart @@ -4,6 +4,7 @@ import '../../ast/declarations/globals/globals.dart'; import '../_core/unique_namer.dart'; import '../_core/utils.dart'; import '../transform.dart'; +import 'const.dart'; import 'transform_referred_type.dart'; // The main difference between generating a wrapper property for a global @@ -12,14 +13,18 @@ import 'transform_referred_type.dart'; // through the wrapped class instance in the wrapper class. In global variable // case, it can be referenced directly since it's not a member of any entity. -PropertyDeclaration transformProperty( +PropertyDeclaration? transformProperty( PropertyDeclaration originalProperty, PropertyDeclaration wrappedClassInstance, UniqueNamer globalNamer, TransformationMap transformationMap, ) { + if (disallowedMethods.contains(originalProperty.name)) { + return null; + } + final propertySource = originalProperty.isStatic - ? wrappedClassInstance.type.name + ? wrappedClassInstance.type.swiftType : wrappedClassInstance.name; return _transformVariable( @@ -76,6 +81,8 @@ PropertyDeclaration _transformVariable( ? originalVariable.isStatic : true, isConstant: originalVariable.isConstant, + throws: originalVariable.throws, + async: originalVariable.async, ); final getterStatements = _generateGetterStatements( @@ -115,7 +122,7 @@ List _generateGetterStatements( transformationMap, ); - assert(wrapperType.id == transformedProperty.type.id); + assert(wrapperType.sameAs(transformedProperty.type)); return [wrappedValue]; } @@ -132,7 +139,8 @@ List _generateSetterStatements( 'newValue', ); - assert(unwrappedType.id == originalVariable.type.id); + assert(unwrappedType.sameAs(originalVariable.type), + '$unwrappedType\tvs\t${originalVariable.type}'); return ['$variableReference = $unwrappedValue']; } diff --git a/pkgs/swift2objc/lib/swift2objc.dart b/pkgs/swift2objc/lib/swift2objc.dart index d3bf00e5d..20829e681 100644 --- a/pkgs/swift2objc/lib/swift2objc.dart +++ b/pkgs/swift2objc/lib/swift2objc.dart @@ -2,5 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -export 'src/config.dart' show Config, FilesInputConfig, ModuleInputConfig; +export 'src/config.dart' + show + Config, + FilesInputConfig, + InputConfig, + JsonFileInputConfig, + ModuleInputConfig; export 'src/generate_wrapper.dart'; diff --git a/pkgs/swift2objc/pubspec.yaml b/pkgs/swift2objc/pubspec.yaml index 5ce2f8a3d..f49adf983 100644 --- a/pkgs/swift2objc/pubspec.yaml +++ b/pkgs/swift2objc/pubspec.yaml @@ -6,6 +6,7 @@ name: swift2objc description: 'A tool for generating bindings that allow interop between Dart and Swift code.' version: 0.0.1-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/swiftgen/swift2objc +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aswift2objc topics: - interop @@ -14,11 +15,14 @@ topics: - codegen dependencies: + logging: ^1.3.0 + meta: ^1.16.0 path: ^1.9.0 environment: sdk: '>=3.3.0 <4.0.0' dev_dependencies: + args: ^2.6.0 dart_flutter_team_lints: ^2.0.0 test: ^1.21.1 diff --git a/pkgs/swift2objc/test/integration/async_input.swift b/pkgs/swift2objc/test/integration/async_input.swift new file mode 100644 index 000000000..44ebd6ef9 --- /dev/null +++ b/pkgs/swift2objc/test/integration/async_input.swift @@ -0,0 +1,12 @@ +import Foundation + +public class MyClass { + public func voidMethod() async {} + public func intMethod(y: Int) async -> MyClass { return MyClass() } + public func asyncThrowsMethod(y: Int) async throws -> MyClass { + return MyClass() + } +} + +public func voidFunc(x: Int, y: Int) async {} +public func intFunc() async -> MyClass { return MyClass() } diff --git a/pkgs/swift2objc/test/integration/async_output.swift b/pkgs/swift2objc/test/integration/async_output.swift new file mode 100644 index 000000000..d10445bb7 --- /dev/null +++ b/pkgs/swift2objc/test/integration/async_output.swift @@ -0,0 +1,39 @@ +// Test preamble text + +import Foundation + +@objc public class GlobalsWrapper: NSObject { + @objc static public func intFuncWrapper() async -> MyClassWrapper { + let result = await intFunc() + return MyClassWrapper(result) + } + + @objc static public func voidFuncWrapper(x: Int, y: Int) async { + return await voidFunc(x: x, y: y) + } + +} + +@objc public class MyClassWrapper: NSObject { + var wrappedInstance: MyClass + + init(_ wrappedInstance: MyClass) { + self.wrappedInstance = wrappedInstance + } + + @objc public func voidMethod() async { + return await wrappedInstance.voidMethod() + } + + @objc public func asyncThrowsMethod(y: Int) async throws -> MyClassWrapper { + let result = try await wrappedInstance.asyncThrowsMethod(y: y) + return MyClassWrapper(result) + } + + @objc public func intMethod(y: Int) async -> MyClassWrapper { + let result = await wrappedInstance.intMethod(y: y) + return MyClassWrapper(result) + } + +} + diff --git a/pkgs/swift2objc/test/integration/classes_and_initializers_input.swift b/pkgs/swift2objc/test/integration/classes_and_initializers_input.swift index e8ce0fbab..cfe87560f 100644 --- a/pkgs/swift2objc/test/integration/classes_and_initializers_input.swift +++ b/pkgs/swift2objc/test/integration/classes_and_initializers_input.swift @@ -8,6 +8,20 @@ public class MyClass { self.representableProperty = representableProperty self.customProperty = customProperty } + + public init(label1 name1: Int, label2: Int, _ name3: Int) { + self.representableProperty = name1 + self.customProperty = MyOtherClass() + } + + public init?(outerLabel x: Int) { + if x == 0 { + return nil + } else { + self.representableProperty = x + self.customProperty = MyOtherClass() + } + } } public class MyOtherClass {} diff --git a/pkgs/swift2objc/test/integration/classes_and_initializers_output.swift b/pkgs/swift2objc/test/integration/classes_and_initializers_output.swift index 7d4604b22..7387672d9 100644 --- a/pkgs/swift2objc/test/integration/classes_and_initializers_output.swift +++ b/pkgs/swift2objc/test/integration/classes_and_initializers_output.swift @@ -4,32 +4,47 @@ import Foundation @objc public class MyOtherClassWrapper: NSObject { var wrappedInstance: MyOtherClass - + init(_ wrappedInstance: MyOtherClass) { self.wrappedInstance = wrappedInstance } + } @objc public class MyClassWrapper: NSObject { var wrappedInstance: MyClass - + @objc public var customProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(wrappedInstance.customProperty) } } - + @objc public var representableProperty: Int { get { wrappedInstance.representableProperty } } - + init(_ wrappedInstance: MyClass) { self.wrappedInstance = wrappedInstance } - + @objc init(outerLabel representableProperty: Int, customProperty: MyOtherClassWrapper) { wrappedInstance = MyClass(outerLabel: representableProperty, customProperty: customProperty.wrappedInstance) } + + @objc init?(outerLabel x: Int) { + if let instance = MyClass(outerLabel: x) { + wrappedInstance = instance + } else { + return nil + } + } + + @objc init(label1 name1: Int, label2: Int, _ name3: Int) { + wrappedInstance = MyClass(label1: name1, label2: label2, name3) + } + } + diff --git a/pkgs/swift2objc/test/integration/classes_and_methods_input.swift b/pkgs/swift2objc/test/integration/classes_and_methods_input.swift index 448d22be2..c238a3546 100644 --- a/pkgs/swift2objc/test/integration/classes_and_methods_input.swift +++ b/pkgs/swift2objc/test/integration/classes_and_methods_input.swift @@ -1,7 +1,7 @@ import Foundation public class MyClass { - public func myMethod(label1 param1: Int, param2: MyOtherClass) -> MyOtherClass { + public func myMethod(label1 param1: Int, param2: MyOtherClass, _ param3: Int) -> MyOtherClass { return MyOtherClass() } diff --git a/pkgs/swift2objc/test/integration/classes_and_methods_output.swift b/pkgs/swift2objc/test/integration/classes_and_methods_output.swift index 02e76b506..e7bb6938d 100644 --- a/pkgs/swift2objc/test/integration/classes_and_methods_output.swift +++ b/pkgs/swift2objc/test/integration/classes_and_methods_output.swift @@ -4,29 +4,32 @@ import Foundation @objc public class MyOtherClassWrapper: NSObject { var wrappedInstance: MyOtherClass - + init(_ wrappedInstance: MyOtherClass) { self.wrappedInstance = wrappedInstance } + } @objc public class MyClassWrapper: NSObject { var wrappedInstance: MyClass - + init(_ wrappedInstance: MyClass) { self.wrappedInstance = wrappedInstance } - - @objc public func myMethod(label1 param1: Int, param2: MyOtherClassWrapper) -> MyOtherClassWrapper { - let result = wrappedInstance.myMethod(label1: param1, param2: param2.wrappedInstance) + + @objc public func myMethod(label1 param1: Int, param2: MyOtherClassWrapper, _ param3: Int) -> MyOtherClassWrapper { + let result = wrappedInstance.myMethod(label1: param1, param2: param2.wrappedInstance, param3) return MyOtherClassWrapper(result) } - - @objc public func myMethod2() -> Void { + + @objc public func myMethod2() { return wrappedInstance.myMethod2() } - + @objc public func myMethod3() { - wrappedInstance.myMethod3() + return wrappedInstance.myMethod3() } + } + diff --git a/pkgs/swift2objc/test/integration/classes_and_properties_output.swift b/pkgs/swift2objc/test/integration/classes_and_properties_output.swift index 828c5eb6d..550713da1 100644 --- a/pkgs/swift2objc/test/integration/classes_and_properties_output.swift +++ b/pkgs/swift2objc/test/integration/classes_and_properties_output.swift @@ -4,21 +4,22 @@ import Foundation @objc public class MyOtherClassWrapper: NSObject { var wrappedInstance: MyOtherClass - + init(_ wrappedInstance: MyOtherClass) { self.wrappedInstance = wrappedInstance } + } @objc public class MyClassWrapper: NSObject { var wrappedInstance: MyClass - + @objc public var customGetterProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(wrappedInstance.customGetterProperty) } } - + @objc public var customSetterProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(wrappedInstance.customSetterProperty) @@ -27,13 +28,13 @@ import Foundation wrappedInstance.customSetterProperty = newValue.wrappedInstance } } - + @objc public var customConstantProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(wrappedInstance.customConstantProperty) } } - + @objc public var customVariableProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(wrappedInstance.customVariableProperty) @@ -42,19 +43,19 @@ import Foundation wrappedInstance.customVariableProperty = newValue.wrappedInstance } } - + @objc public var implicitGetterProperty: Int { get { wrappedInstance.implicitGetterProperty } } - + @objc public var representableGetterProperty: Int { get { wrappedInstance.representableGetterProperty } } - + @objc public var representableSetterProperty: Int { get { wrappedInstance.representableSetterProperty @@ -63,13 +64,13 @@ import Foundation wrappedInstance.representableSetterProperty = newValue } } - + @objc public var representableConstantProperty: Int { get { wrappedInstance.representableConstantProperty } } - + @objc public var representableVariableProperty: Int { get { wrappedInstance.representableVariableProperty @@ -78,8 +79,10 @@ import Foundation wrappedInstance.representableVariableProperty = newValue } } - + init(_ wrappedInstance: MyClass) { self.wrappedInstance = wrappedInstance } + } + diff --git a/pkgs/swift2objc/test/integration/classes_and_static_methods_output.swift b/pkgs/swift2objc/test/integration/classes_and_static_methods_output.swift index 4a798ff59..137adc87a 100644 --- a/pkgs/swift2objc/test/integration/classes_and_static_methods_output.swift +++ b/pkgs/swift2objc/test/integration/classes_and_static_methods_output.swift @@ -4,29 +4,32 @@ import Foundation @objc public class MyOtherClassWrapper: NSObject { var wrappedInstance: MyOtherClass - + init(_ wrappedInstance: MyOtherClass) { self.wrappedInstance = wrappedInstance } + } @objc public class MyClassWrapper: NSObject { var wrappedInstance: MyClass - + init(_ wrappedInstance: MyClass) { self.wrappedInstance = wrappedInstance } - + @objc static public func myMethod(label1 param1: Int, param2: MyOtherClassWrapper) -> MyOtherClassWrapper { let result = MyClass.myMethod(label1: param1, param2: param2.wrappedInstance) return MyOtherClassWrapper(result) } - - @objc static public func myMethod2() -> Void { + + @objc static public func myMethod2() { return MyClass.myMethod2() } - + @objc static public func myMethod3() { - MyClass.myMethod3() + return MyClass.myMethod3() } + } + diff --git a/pkgs/swift2objc/test/integration/classes_and_static_properties_output.swift b/pkgs/swift2objc/test/integration/classes_and_static_properties_output.swift index bb6a4d13f..af4ee8130 100644 --- a/pkgs/swift2objc/test/integration/classes_and_static_properties_output.swift +++ b/pkgs/swift2objc/test/integration/classes_and_static_properties_output.swift @@ -4,21 +4,22 @@ import Foundation @objc public class MyOtherClassWrapper: NSObject { var wrappedInstance: MyOtherClass - + init(_ wrappedInstance: MyOtherClass) { self.wrappedInstance = wrappedInstance } + } @objc public class MyClassWrapper: NSObject { var wrappedInstance: MyClass - + @objc static public var customGetterVariable: MyOtherClassWrapper { get { MyOtherClassWrapper(MyClass.customGetterVariable) } } - + @objc static public var customSetterVariable: MyOtherClassWrapper { get { MyOtherClassWrapper(MyClass.customSetterVariable) @@ -27,13 +28,13 @@ import Foundation MyClass.customSetterVariable = newValue.wrappedInstance } } - + @objc static public var customConstantProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(MyClass.customConstantProperty) } } - + @objc static public var customVariableProperty: MyOtherClassWrapper { get { MyOtherClassWrapper(MyClass.customVariableProperty) @@ -42,13 +43,13 @@ import Foundation MyClass.customVariableProperty = newValue.wrappedInstance } } - + @objc static public var representableGetterVariable: Int { get { MyClass.representableGetterVariable } } - + @objc static public var representableSetterVariable: Int { get { MyClass.representableSetterVariable @@ -57,13 +58,13 @@ import Foundation MyClass.representableSetterVariable = newValue } } - + @objc static public var representableConstantProperty: Int { get { MyClass.representableConstantProperty } } - + @objc static public var representableVariableProperty: Int { get { MyClass.representableVariableProperty @@ -72,8 +73,10 @@ import Foundation MyClass.representableVariableProperty = newValue } } - + init(_ wrappedInstance: MyClass) { self.wrappedInstance = wrappedInstance } + } + diff --git a/pkgs/swift2objc/test/integration/global_variables_and_functions_input.swift b/pkgs/swift2objc/test/integration/global_variables_and_functions_input.swift index cd838a0df..8f7a222a6 100644 --- a/pkgs/swift2objc/test/integration/global_variables_and_functions_input.swift +++ b/pkgs/swift2objc/test/integration/global_variables_and_functions_input.swift @@ -6,6 +6,9 @@ public let globalRepresentableConstant = 1 public var globalCustomVariable = MyOtherClass() public let globalCustomConstant = MyOtherClass() +public var globalGetterVariable: Double { get { 123 } } +public var globalSetterVariable: Double { get { 123 } set {} } + public func globalCustomFunction(label1 param1: Int, param2: MyOtherClass) -> MyOtherClass { return MyOtherClass() } diff --git a/pkgs/swift2objc/test/integration/global_variables_and_functions_output.swift b/pkgs/swift2objc/test/integration/global_variables_and_functions_output.swift index 79e680af0..9a34ec514 100644 --- a/pkgs/swift2objc/test/integration/global_variables_and_functions_output.swift +++ b/pkgs/swift2objc/test/integration/global_variables_and_functions_output.swift @@ -8,7 +8,7 @@ import Foundation MyOtherClassWrapper(globalCustomConstant) } } - + @objc static public var globalCustomVariableWrapper: MyOtherClassWrapper { get { MyOtherClassWrapper(globalCustomVariable) @@ -17,13 +17,28 @@ import Foundation globalCustomVariable = newValue.wrappedInstance } } - + + @objc static public var globalGetterVariableWrapper: Double { + get { + globalGetterVariable + } + } + + @objc static public var globalSetterVariableWrapper: Double { + get { + globalSetterVariable + } + set { + globalSetterVariable = newValue + } + } + @objc static public var globalRepresentableConstantWrapper: Int { get { globalRepresentableConstant } } - + @objc static public var globalRepresentableVariableWrapper: Int { get { globalRepresentableVariable @@ -32,25 +47,28 @@ import Foundation globalRepresentableVariable = newValue } } - + @objc static public func globalCustomFunctionWrapper(label1 param1: Int, param2: MyOtherClassWrapper) -> MyOtherClassWrapper { let result = globalCustomFunction(label1: param1, param2: param2.wrappedInstance) return MyOtherClassWrapper(result) } - - @objc static public func globalRepresentableFunctionWrapper1() -> Void { + + @objc static public func globalRepresentableFunctionWrapper1() { return globalRepresentableFunction() } - + @objc static public func globalRepresentableFunctionWrapperWrapper() { - globalRepresentableFunctionWrapper() + return globalRepresentableFunctionWrapper() } + } @objc public class MyOtherClassWrapper: NSObject { var wrappedInstance: MyOtherClass - + init(_ wrappedInstance: MyOtherClass) { self.wrappedInstance = wrappedInstance } + } + diff --git a/pkgs/swift2objc/test/integration/integration_test.dart b/pkgs/swift2objc/test/integration/integration_test.dart index 2161068b6..b32e01ad6 100644 --- a/pkgs/swift2objc/test/integration/integration_test.dart +++ b/pkgs/swift2objc/test/integration/integration_test.dart @@ -2,33 +2,62 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// Tests that every *_input.swift in this directory produces *_output.swift. +// Also tests that the generated output compiles without errors. + +// This test is run in the usual way through dart test, but can also be run +// standalone, passing flags to run specific integration tests and to regenerate +// the expected outputs: +// dart test/integration/integration_test.dart --regen +// dart test/integration/integration_test.dart --regen nested_types +// dart test/integration/integration_test.dart nested_types structs_and_methods + import 'dart:io'; +import 'package:args/args.dart'; +import 'package:logging/logging.dart'; import 'package:path/path.dart' as path; import 'package:swift2objc/swift2objc.dart'; import 'package:test/test.dart'; -void main() { - group('Integration tests', () { - const inputSuffix = '_input.swift'; - const outputSuffix = '_output.swift'; +void main([List? args]) { + const inputSuffix = '_input.swift'; + const outputSuffix = '_output.swift'; - final thisDir = path.join(Directory.current.path, 'test/integration'); - final tempDir = path.join(thisDir, 'temp'); + final thisDir = path.join(Directory.current.path, 'test/integration'); + final tempDir = path.join(thisDir, 'temp'); - final names = []; + var regen = false; + final testNames = []; + if (args != null) { + final p = ArgParser()..addFlag('regen', callback: (value) => regen = value); + testNames.addAll(p.parse(args).rest); + } + if (testNames.isEmpty) { for (final entity in Directory(thisDir).listSync()) { final filename = path.basename(entity.path); if (filename.endsWith(inputSuffix)) { - names.add(filename.substring(0, filename.length - inputSuffix.length)); + testNames + .add(filename.substring(0, filename.length - inputSuffix.length)); } } + } - for (final name in names) { + var loggedErrors = 0; + Logger.root.onRecord.listen((record) { + stderr.writeln('${record.level.name}: ${record.message}'); + if (record.level >= Level.WARNING) ++loggedErrors; + }); + + group('Integration tests', () { + for (final name in testNames) { test(name, () async { + loggedErrors = 0; final inputFile = path.join(thisDir, '$name$inputSuffix'); final expectedOutputFile = path.join(thisDir, '$name$outputSuffix'); - final actualOutputFile = path.join(tempDir, '$name$outputSuffix'); + final actualOutputFile = regen + ? expectedOutputFile + : path.join(tempDir, '$name$outputSuffix'); await generateWrapper(Config( input: FilesInputConfig( @@ -43,6 +72,7 @@ void main() { final expectedOutput = File(expectedOutputFile).readAsStringSync(); expect(actualOutput, expectedOutput); + expect(loggedErrors, 0); // Try generating symbolgraph for input & output files // to make sure the result compiles. Input file must be included cause @@ -53,7 +83,7 @@ void main() { Uri.file(actualOutputFile), ], generatedModuleName: 'output_file_symbolgraph', - ).symbolgraphCommand; + ).symbolgraphCommand!; final processResult = await Process.run( symbolgraphCommand.executable, @@ -61,6 +91,10 @@ void main() { workingDirectory: tempDir, ); + if (processResult.exitCode != 0) { + print(processResult.stdout); + print(processResult.stderr); + } expect(processResult.exitCode, 0); }); } diff --git a/pkgs/swift2objc/test/integration/nested_types_input.swift b/pkgs/swift2objc/test/integration/nested_types_input.swift new file mode 100644 index 000000000..2d9173518 --- /dev/null +++ b/pkgs/swift2objc/test/integration/nested_types_input.swift @@ -0,0 +1,31 @@ +public class OuterClass { + public static func makeOuter() -> OuterClass { return OuterClass(); } + public static func makeInnerClass() -> InnerClass { return InnerClass(); } + public static func makeInnerStruct() -> InnerStruct { return InnerStruct(); } + + public class InnerClass { + public static func makeOuter() -> OuterClass { return OuterClass(); } + public static func makeInner() -> InnerClass { return InnerClass(); } + } + + public struct InnerStruct { + public static func makeOuter() -> OuterClass { return OuterClass(); } + public static func makeInner() -> InnerStruct { return InnerStruct(); } + } +} + +public struct OuterStruct { + public static func makeOuter() -> OuterStruct { return OuterStruct(); } + public static func makeInnerClass() -> InnerClass { return InnerClass(); } + public static func makeInnerStruct() -> InnerStruct { return InnerStruct(); } + + public class InnerClass { + public static func makeOuter() -> OuterStruct { return OuterStruct(); } + public static func makeInner() -> InnerClass { return InnerClass(); } + } + + public struct InnerStruct { + public static func makeOuter() -> OuterStruct { return OuterStruct(); } + public static func makeInner() -> InnerStruct { return InnerStruct(); } + } +} diff --git a/pkgs/swift2objc/test/integration/nested_types_output.swift b/pkgs/swift2objc/test/integration/nested_types_output.swift new file mode 100644 index 000000000..76654a4a5 --- /dev/null +++ b/pkgs/swift2objc/test/integration/nested_types_output.swift @@ -0,0 +1,128 @@ +// Test preamble text + +import Foundation + +@objc public class OuterClassWrapper: NSObject { + var wrappedInstance: OuterClass + + init(_ wrappedInstance: OuterClass) { + self.wrappedInstance = wrappedInstance + } + + @objc static public func makeOuter() -> OuterClassWrapper { + let result = OuterClass.makeOuter() + return OuterClassWrapper(result) + } + + @objc static public func makeInnerClass() -> OuterClassWrapper.InnerClassWrapper { + let result = OuterClass.makeInnerClass() + return InnerClassWrapper(result) + } + + @objc static public func makeInnerStruct() -> OuterClassWrapper.InnerStructWrapper { + let result = OuterClass.makeInnerStruct() + return InnerStructWrapper(result) + } + + @objc public class InnerClassWrapper: NSObject { + var wrappedInstance: OuterClass.InnerClass + + init(_ wrappedInstance: OuterClass.InnerClass) { + self.wrappedInstance = wrappedInstance + } + + @objc static public func makeOuter() -> OuterClassWrapper { + let result = OuterClass.InnerClass.makeOuter() + return OuterClassWrapper(result) + } + + @objc static public func makeInner() -> OuterClassWrapper.InnerClassWrapper { + let result = OuterClass.InnerClass.makeInner() + return InnerClassWrapper(result) + } + + } + + @objc public class InnerStructWrapper: NSObject { + var wrappedInstance: OuterClass.InnerStruct + + init(_ wrappedInstance: OuterClass.InnerStruct) { + self.wrappedInstance = wrappedInstance + } + + @objc static public func makeOuter() -> OuterClassWrapper { + let result = OuterClass.InnerStruct.makeOuter() + return OuterClassWrapper(result) + } + + @objc static public func makeInner() -> OuterClassWrapper.InnerStructWrapper { + let result = OuterClass.InnerStruct.makeInner() + return InnerStructWrapper(result) + } + + } + +} + +@objc public class OuterStructWrapper: NSObject { + var wrappedInstance: OuterStruct + + init(_ wrappedInstance: OuterStruct) { + self.wrappedInstance = wrappedInstance + } + + @objc static public func makeOuter() -> OuterStructWrapper { + let result = OuterStruct.makeOuter() + return OuterStructWrapper(result) + } + + @objc static public func makeInnerStruct() -> OuterStructWrapper.InnerStructWrapper { + let result = OuterStruct.makeInnerStruct() + return InnerStructWrapper(result) + } + + @objc static public func makeInnerClass() -> OuterStructWrapper.InnerClassWrapper { + let result = OuterStruct.makeInnerClass() + return InnerClassWrapper(result) + } + + @objc public class InnerStructWrapper: NSObject { + var wrappedInstance: OuterStruct.InnerStruct + + init(_ wrappedInstance: OuterStruct.InnerStruct) { + self.wrappedInstance = wrappedInstance + } + + @objc static public func makeOuter() -> OuterStructWrapper { + let result = OuterStruct.InnerStruct.makeOuter() + return OuterStructWrapper(result) + } + + @objc static public func makeInner() -> OuterStructWrapper.InnerStructWrapper { + let result = OuterStruct.InnerStruct.makeInner() + return InnerStructWrapper(result) + } + + } + + @objc public class InnerClassWrapper: NSObject { + var wrappedInstance: OuterStruct.InnerClass + + init(_ wrappedInstance: OuterStruct.InnerClass) { + self.wrappedInstance = wrappedInstance + } + + @objc static public func makeOuter() -> OuterStructWrapper { + let result = OuterStruct.InnerClass.makeOuter() + return OuterStructWrapper(result) + } + + @objc static public func makeInner() -> OuterStructWrapper.InnerClassWrapper { + let result = OuterStruct.InnerClass.makeInner() + return InnerClassWrapper(result) + } + + } + +} + diff --git a/pkgs/swift2objc/test/integration/optional_input.swift b/pkgs/swift2objc/test/integration/optional_input.swift new file mode 100644 index 000000000..af19d6dd7 --- /dev/null +++ b/pkgs/swift2objc/test/integration/optional_input.swift @@ -0,0 +1,36 @@ +import Foundation + +public func funcOptionalClassReturn() -> MyClass? { return MyClass(label: nil) } +public func funcOptionalStructReturn() -> MyStruct? { return nil } +public func funcOptionalArgs(label param: MyClass?) -> MyClass { return param! } +public func funcMultipleOptionalArgs( + label1 param1: MyClass?,label2 param2: Int, label3 param3: MyStruct?){} +public func funcOptionalStrings(str: String?) -> String? { return str; } + +public var globalOptional: MyStruct? + +public class MyClass { + public var optionalProperty: MyClass? + + public init(label param: MyClass?) { + self.optionalProperty = param + } + + public init(label1 param1: MyClass?, label2: Int, label3 param3: MyStruct?) { + self.optionalProperty = param1 + } + + public func methodOptionalReturn() -> MyClass? { return nil } + public func methodOptionalArgs(label param: MyClass?) {} +} + +public struct MyStruct { + public var optionalProperty: MyClass? + + public init(label param: MyClass?) { + self.optionalProperty = param + } + + public func methodOptionalReturn() -> MyStruct? { return nil } + public func methodOptionalArgs(label param: MyClass?) {} +} diff --git a/pkgs/swift2objc/test/integration/optional_output.swift b/pkgs/swift2objc/test/integration/optional_output.swift new file mode 100644 index 000000000..add55f0c4 --- /dev/null +++ b/pkgs/swift2objc/test/integration/optional_output.swift @@ -0,0 +1,105 @@ +// Test preamble text + +import Foundation + +@objc public class GlobalsWrapper: NSObject { + @objc static public var globalOptionalWrapper: MyStructWrapper? { + get { + globalOptional == nil ? nil : MyStructWrapper(globalOptional!) + } + set { + globalOptional = newValue?.wrappedInstance + } + } + + @objc static public func funcOptionalArgsWrapper(label param: MyClassWrapper?) -> MyClassWrapper { + let result = funcOptionalArgs(label: param?.wrappedInstance) + return MyClassWrapper(result) + } + + @objc static public func funcOptionalStringsWrapper(str: String?) -> String? { + return funcOptionalStrings(str: str) + } + + @objc static public func funcOptionalClassReturnWrapper() -> MyClassWrapper? { + let result = funcOptionalClassReturn() + return result == nil ? nil : MyClassWrapper(result!) + } + + @objc static public func funcMultipleOptionalArgsWrapper(label1 param1: MyClassWrapper?, label2 param2: Int, label3 param3: MyStructWrapper?) { + return funcMultipleOptionalArgs(label1: param1?.wrappedInstance, label2: param2, label3: param3?.wrappedInstance) + } + + @objc static public func funcOptionalStructReturnWrapper() -> MyStructWrapper? { + let result = funcOptionalStructReturn() + return result == nil ? nil : MyStructWrapper(result!) + } + +} + +@objc public class MyClassWrapper: NSObject { + var wrappedInstance: MyClass + + @objc public var optionalProperty: MyClassWrapper? { + get { + wrappedInstance.optionalProperty == nil ? nil : MyClassWrapper(wrappedInstance.optionalProperty!) + } + set { + wrappedInstance.optionalProperty = newValue?.wrappedInstance + } + } + + init(_ wrappedInstance: MyClass) { + self.wrappedInstance = wrappedInstance + } + + @objc init(label param: MyClassWrapper?) { + wrappedInstance = MyClass(label: param?.wrappedInstance) + } + + @objc init(label1 param1: MyClassWrapper?, label2: Int, label3 param3: MyStructWrapper?) { + wrappedInstance = MyClass(label1: param1?.wrappedInstance, label2: label2, label3: param3?.wrappedInstance) + } + + @objc public func methodOptionalArgs(label param: MyClassWrapper?) { + return wrappedInstance.methodOptionalArgs(label: param?.wrappedInstance) + } + + @objc public func methodOptionalReturn() -> MyClassWrapper? { + let result = wrappedInstance.methodOptionalReturn() + return result == nil ? nil : MyClassWrapper(result!) + } + +} + +@objc public class MyStructWrapper: NSObject { + var wrappedInstance: MyStruct + + @objc public var optionalProperty: MyClassWrapper? { + get { + wrappedInstance.optionalProperty == nil ? nil : MyClassWrapper(wrappedInstance.optionalProperty!) + } + set { + wrappedInstance.optionalProperty = newValue?.wrappedInstance + } + } + + init(_ wrappedInstance: MyStruct) { + self.wrappedInstance = wrappedInstance + } + + @objc init(label param: MyClassWrapper?) { + wrappedInstance = MyStruct(label: param?.wrappedInstance) + } + + @objc public func methodOptionalArgs(label param: MyClassWrapper?) { + return wrappedInstance.methodOptionalArgs(label: param?.wrappedInstance) + } + + @objc public func methodOptionalReturn() -> MyStructWrapper? { + let result = wrappedInstance.methodOptionalReturn() + return result == nil ? nil : MyStructWrapper(result!) + } + +} + diff --git a/pkgs/swift2objc/test/integration/structs_and_initializers_input.swift b/pkgs/swift2objc/test/integration/structs_and_initializers_input.swift index f8617f0e2..d41f5c364 100644 --- a/pkgs/swift2objc/test/integration/structs_and_initializers_input.swift +++ b/pkgs/swift2objc/test/integration/structs_and_initializers_input.swift @@ -1,13 +1,27 @@ import Foundation public class MyStruct { - let representableProperty: Int - let customProperty: MyOtherStruct + public let representableProperty: Int + public let customProperty: MyOtherStruct public init(outerLabel representableProperty: Int, customProperty: MyOtherStruct) { self.representableProperty = representableProperty self.customProperty = customProperty } + + public init(label1 name1: Int, label2: Int, _ name3: Int) { + self.representableProperty = name1 + self.customProperty = MyOtherStruct() + } + + public init?(outerLabel x: Int) { + if x == 0 { + return nil + } else { + self.representableProperty = x + self.customProperty = MyOtherStruct() + } + } } public struct MyOtherStruct {} diff --git a/pkgs/swift2objc/test/integration/structs_and_initializers_output.swift b/pkgs/swift2objc/test/integration/structs_and_initializers_output.swift index 72ee5e4ea..923d83a04 100644 --- a/pkgs/swift2objc/test/integration/structs_and_initializers_output.swift +++ b/pkgs/swift2objc/test/integration/structs_and_initializers_output.swift @@ -4,20 +4,47 @@ import Foundation @objc public class MyOtherStructWrapper: NSObject { var wrappedInstance: MyOtherStruct - + init(_ wrappedInstance: MyOtherStruct) { self.wrappedInstance = wrappedInstance } + } @objc public class MyStructWrapper: NSObject { var wrappedInstance: MyStruct - + + @objc public var customProperty: MyOtherStructWrapper { + get { + MyOtherStructWrapper(wrappedInstance.customProperty) + } + } + + @objc public var representableProperty: Int { + get { + wrappedInstance.representableProperty + } + } + init(_ wrappedInstance: MyStruct) { self.wrappedInstance = wrappedInstance } - + @objc init(outerLabel representableProperty: Int, customProperty: MyOtherStructWrapper) { wrappedInstance = MyStruct(outerLabel: representableProperty, customProperty: customProperty.wrappedInstance) } + + @objc init?(outerLabel x: Int) { + if let instance = MyStruct(outerLabel: x) { + wrappedInstance = instance + } else { + return nil + } + } + + @objc init(label1 name1: Int, label2: Int, _ name3: Int) { + wrappedInstance = MyStruct(label1: name1, label2: label2, name3) + } + } + diff --git a/pkgs/swift2objc/test/integration/structs_and_methods_input.swift b/pkgs/swift2objc/test/integration/structs_and_methods_input.swift index 6e756855e..c9e6e178b 100644 --- a/pkgs/swift2objc/test/integration/structs_and_methods_input.swift +++ b/pkgs/swift2objc/test/integration/structs_and_methods_input.swift @@ -1,7 +1,7 @@ import Foundation public struct MyStruct { - public func myMethod(label1 param1: Int, param2: MyOtherStruct) -> MyOtherStruct { + public func myMethod(label1 param1: Int, param2: MyOtherStruct, _ param3: Int) -> MyOtherStruct { return MyOtherStruct() } diff --git a/pkgs/swift2objc/test/integration/structs_and_methods_output.swift b/pkgs/swift2objc/test/integration/structs_and_methods_output.swift index 788b88e9a..c8600c9ee 100644 --- a/pkgs/swift2objc/test/integration/structs_and_methods_output.swift +++ b/pkgs/swift2objc/test/integration/structs_and_methods_output.swift @@ -4,29 +4,32 @@ import Foundation @objc public class MyOtherStructWrapper: NSObject { var wrappedInstance: MyOtherStruct - + init(_ wrappedInstance: MyOtherStruct) { self.wrappedInstance = wrappedInstance } + } @objc public class MyStructWrapper: NSObject { var wrappedInstance: MyStruct - + init(_ wrappedInstance: MyStruct) { self.wrappedInstance = wrappedInstance } - - @objc public func myMethod(label1 param1: Int, param2: MyOtherStructWrapper) -> MyOtherStructWrapper { - let result = wrappedInstance.myMethod(label1: param1, param2: param2.wrappedInstance) + + @objc public func myMethod(label1 param1: Int, param2: MyOtherStructWrapper, _ param3: Int) -> MyOtherStructWrapper { + let result = wrappedInstance.myMethod(label1: param1, param2: param2.wrappedInstance, param3) return MyOtherStructWrapper(result) } - - @objc public func myMethod2() -> Void { + + @objc public func myMethod2() { return wrappedInstance.myMethod2() } - + @objc public func myMethod3() { - wrappedInstance.myMethod3() + return wrappedInstance.myMethod3() } + } + diff --git a/pkgs/swift2objc/test/integration/structs_and_properties_output.swift b/pkgs/swift2objc/test/integration/structs_and_properties_output.swift index 535abb0cd..3203e8752 100644 --- a/pkgs/swift2objc/test/integration/structs_and_properties_output.swift +++ b/pkgs/swift2objc/test/integration/structs_and_properties_output.swift @@ -4,21 +4,22 @@ import Foundation @objc public class MyOtherStructWrapper: NSObject { var wrappedInstance: MyOtherStruct - + init(_ wrappedInstance: MyOtherStruct) { self.wrappedInstance = wrappedInstance } + } @objc public class MyStructWrapper: NSObject { var wrappedInstance: MyStruct - + @objc public var customGetterProperty: MyOtherStructWrapper { get { MyOtherStructWrapper(wrappedInstance.customGetterProperty) } } - + @objc public var customSetterProperty: MyOtherStructWrapper { get { MyOtherStructWrapper(wrappedInstance.customSetterProperty) @@ -27,13 +28,13 @@ import Foundation wrappedInstance.customSetterProperty = newValue.wrappedInstance } } - + @objc public var customConstantProperty: MyOtherStructWrapper { get { MyOtherStructWrapper(wrappedInstance.customConstantProperty) } } - + @objc public var customVariableProperty: MyOtherStructWrapper { get { MyOtherStructWrapper(wrappedInstance.customVariableProperty) @@ -42,19 +43,19 @@ import Foundation wrappedInstance.customVariableProperty = newValue.wrappedInstance } } - + @objc public var implicitGetterProperty: Int { get { wrappedInstance.implicitGetterProperty } } - + @objc public var representableGetterProperty: Int { get { wrappedInstance.representableGetterProperty } } - + @objc public var representableSetterProperty: Int { get { wrappedInstance.representableSetterProperty @@ -63,13 +64,13 @@ import Foundation wrappedInstance.representableSetterProperty = newValue } } - + @objc public var representableConstantProperty: Int { get { wrappedInstance.representableConstantProperty } } - + @objc public var representableVariableProperty: Int { get { wrappedInstance.representableVariableProperty @@ -78,8 +79,10 @@ import Foundation wrappedInstance.representableVariableProperty = newValue } } - + init(_ wrappedInstance: MyStruct) { self.wrappedInstance = wrappedInstance } + } + diff --git a/pkgs/swift2objc/test/integration/structs_and_static_methods_output.swift b/pkgs/swift2objc/test/integration/structs_and_static_methods_output.swift index 671a6088e..befac1910 100644 --- a/pkgs/swift2objc/test/integration/structs_and_static_methods_output.swift +++ b/pkgs/swift2objc/test/integration/structs_and_static_methods_output.swift @@ -4,29 +4,32 @@ import Foundation @objc public class MyOtherStructWrapper: NSObject { var wrappedInstance: MyOtherStruct - + init(_ wrappedInstance: MyOtherStruct) { self.wrappedInstance = wrappedInstance } + } @objc public class MyStructWrapper: NSObject { var wrappedInstance: MyStruct - + init(_ wrappedInstance: MyStruct) { self.wrappedInstance = wrappedInstance } - + @objc static public func myMethod(label1 param1: Int, param2: MyOtherStructWrapper) -> MyOtherStructWrapper { let result = MyStruct.myMethod(label1: param1, param2: param2.wrappedInstance) return MyOtherStructWrapper(result) } - - @objc static public func myMethod2() -> Void { + + @objc static public func myMethod2() { return MyStruct.myMethod2() } - + @objc static public func myMethod3() { - MyStruct.myMethod3() + return MyStruct.myMethod3() } + } + diff --git a/pkgs/swift2objc/test/integration/structs_and_static_properties_output.swift b/pkgs/swift2objc/test/integration/structs_and_static_properties_output.swift index 7633573ed..6518209f0 100644 --- a/pkgs/swift2objc/test/integration/structs_and_static_properties_output.swift +++ b/pkgs/swift2objc/test/integration/structs_and_static_properties_output.swift @@ -4,21 +4,22 @@ import Foundation @objc public class MyOtherStructWrapper: NSObject { var wrappedInstance: MyOtherStruct - + init(_ wrappedInstance: MyOtherStruct) { self.wrappedInstance = wrappedInstance } + } @objc public class MyStructWrapper: NSObject { var wrappedInstance: MyStruct - + @objc static public var customGetterVariable: MyOtherStructWrapper { get { MyOtherStructWrapper(MyStruct.customGetterVariable) } } - + @objc static public var customSetterVariable: MyOtherStructWrapper { get { MyOtherStructWrapper(MyStruct.customSetterVariable) @@ -27,13 +28,13 @@ import Foundation MyStruct.customSetterVariable = newValue.wrappedInstance } } - + @objc static public var customConstantProperty: MyOtherStructWrapper { get { MyOtherStructWrapper(MyStruct.customConstantProperty) } } - + @objc static public var customVariableProperty: MyOtherStructWrapper { get { MyOtherStructWrapper(MyStruct.customVariableProperty) @@ -42,13 +43,13 @@ import Foundation MyStruct.customVariableProperty = newValue.wrappedInstance } } - + @objc static public var representableGetterVariable: Int { get { MyStruct.representableGetterVariable } } - + @objc static public var representableSetterVariable: Int { get { MyStruct.representableSetterVariable @@ -57,13 +58,13 @@ import Foundation MyStruct.representableSetterVariable = newValue } } - + @objc static public var representableConstantProperty: Int { get { MyStruct.representableConstantProperty } } - + @objc static public var representableVariableProperty: Int { get { MyStruct.representableVariableProperty @@ -72,8 +73,10 @@ import Foundation MyStruct.representableVariableProperty = newValue } } - + init(_ wrappedInstance: MyStruct) { self.wrappedInstance = wrappedInstance } + } + diff --git a/pkgs/swift2objc/test/integration/throws_input.swift b/pkgs/swift2objc/test/integration/throws_input.swift new file mode 100644 index 000000000..53186dd80 --- /dev/null +++ b/pkgs/swift2objc/test/integration/throws_input.swift @@ -0,0 +1,11 @@ +import Foundation + +public class MyClass { + public init(y: Int) throws {} + + public func voidMethod() throws {} + public func intMethod(y: Int) throws -> MyClass { return try MyClass(y: 123) } +} + +public func voidFunc(x: Int, y: Int) throws {} +public func intFunc() throws -> MyClass { return try MyClass(y: 123) } diff --git a/pkgs/swift2objc/test/integration/throws_output.swift b/pkgs/swift2objc/test/integration/throws_output.swift new file mode 100644 index 000000000..dd1d16df2 --- /dev/null +++ b/pkgs/swift2objc/test/integration/throws_output.swift @@ -0,0 +1,38 @@ +// Test preamble text + +import Foundation + +@objc public class GlobalsWrapper: NSObject { + @objc static public func intFuncWrapper() throws -> MyClassWrapper { + let result = try intFunc() + return MyClassWrapper(result) + } + + @objc static public func voidFuncWrapper(x: Int, y: Int) throws { + return try voidFunc(x: x, y: y) + } + +} + +@objc public class MyClassWrapper: NSObject { + var wrappedInstance: MyClass + + init(_ wrappedInstance: MyClass) { + self.wrappedInstance = wrappedInstance + } + + @objc init(y: Int) throws { + wrappedInstance = try MyClass(y: y) + } + + @objc public func voidMethod() throws { + return try wrappedInstance.voidMethod() + } + + @objc public func intMethod(y: Int) throws -> MyClassWrapper { + let result = try wrappedInstance.intMethod(y: y) + return MyClassWrapper(result) + } + +} + diff --git a/pkgs/swift2objc/test/unit/filter_test.dart b/pkgs/swift2objc/test/unit/filter_test.dart new file mode 100644 index 000000000..3b7828c14 --- /dev/null +++ b/pkgs/swift2objc/test/unit/filter_test.dart @@ -0,0 +1,116 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:path/path.dart' as p; +import 'package:swift2objc/src/ast/declarations/compounds/class_declaration.dart'; +import 'package:swift2objc/swift2objc.dart'; +import 'package:test/test.dart'; + +import '../utils/utils.dart'; + +void main() { + group('Unit test for filter', () { + final thisDir = p.join(Directory.current.path, 'test/unit'); + + final file = p.join(thisDir, 'filter_test_input.swift'); + test('A: Specific Files', () async { + final output = p.join(thisDir, 'filter_test_output_a.swift'); + final actualOutputFile = p.join(thisDir, + '${p.basenameWithoutExtension(output)}.test${p.extension(output)}'); + + await generateWrapper(Config( + input: FilesInputConfig( + files: [Uri.file(file)], + ), + outputFile: Uri.file(actualOutputFile), + tempDir: Directory(thisDir).uri, + preamble: '// Test preamble text', + include: (declaration) => declaration.name == 'Engine', + )); + + final actualOutput = await File(actualOutputFile).readAsString(); + final expectedOutput = File(output).readAsStringSync(); + + expectString(actualOutput, expectedOutput); + }); + + test('B: Declarations of a specific type', () async { + final output = p.join(thisDir, 'filter_test_output_b.swift'); + final actualOutputFile = p.join(thisDir, + '${p.basenameWithoutExtension(output)}.test${p.extension(output)}'); + + await generateWrapper(Config( + input: FilesInputConfig( + files: [Uri.file(file)], + ), + outputFile: Uri.file(actualOutputFile), + tempDir: Directory(thisDir).uri, + preamble: '// Test preamble text', + include: (declaration) => declaration is ClassDeclaration, + )); + + final actualOutput = await File(actualOutputFile).readAsString(); + final expectedOutput = File(output).readAsStringSync(); + + expectString(actualOutput, expectedOutput); + }); + + test('C: Nonexistent declaration', () async { + final output = p.join(thisDir, 'filter_test_output_c.swift'); + final actualOutputFile = p.join(thisDir, + '${p.basenameWithoutExtension(output)}.test${p.extension(output)}'); + + await generateWrapper(Config( + input: FilesInputConfig( + files: [Uri.file(file)], + ), + outputFile: Uri.file(actualOutputFile), + tempDir: Directory(thisDir).uri, + preamble: '// Test preamble text', + // The following declaration does not exist, + // so none are produced in output + include: (declaration) => declaration.name == 'Ship', + )); + + final actualOutput = await File(actualOutputFile).readAsString(); + final expectedOutput = File(output).readAsStringSync(); + + expectString(actualOutput, expectedOutput); + }); + + tearDown(() { + if (File(p.join(thisDir, 'symbolgraph_module.abi.json')).existsSync()) { + File(p.join(thisDir, 'symbolgraph_module.abi.json')).deleteSync(); + } + if (File(p.join(thisDir, 'symbolgraph_module.swiftdoc')).existsSync()) { + File(p.join(thisDir, 'symbolgraph_module.swiftdoc')).deleteSync(); + } + if (File(p.join(thisDir, 'symbolgraph_module.swiftmodule')) + .existsSync()) { + File(p.join(thisDir, 'symbolgraph_module.swiftmodule')).deleteSync(); + } + if (File(p.join(thisDir, 'symbolgraph_module.swiftsource')) + .existsSync()) { + File(p.join(thisDir, 'symbolgraph_module.swiftsource')).deleteSync(); + } + if (File(p.join(thisDir, 'symbolgraph_module.symbols.json')) + .existsSync()) { + File(p.join(thisDir, 'symbolgraph_module.symbols.json')).deleteSync(); + } + if (File(p.join(thisDir, 'symbolgraph_module.swiftsourceinfo')) + .existsSync()) { + File(p.join(thisDir, 'symbolgraph_module.swiftsourceinfo')) + .deleteSync(); + } + + for (final file in Directory(thisDir) + .listSync() + .where((t) => p.extension(t.path, 2) == '.test.swift')) { + if (file is File) file.deleteSync(); + } + }); + }); +} diff --git a/pkgs/swift2objc/test/unit/filter_test_input.swift b/pkgs/swift2objc/test/unit/filter_test_input.swift new file mode 100644 index 000000000..40992e06a --- /dev/null +++ b/pkgs/swift2objc/test/unit/filter_test_input.swift @@ -0,0 +1,135 @@ +import Foundation + +public struct Engine { + public let type: String + public let horsepower: Int + + public init(type: String, horsepower: Int) { + self.type = type + self.horsepower = horsepower + } + + public func displaySpecs() { + print("Engine: \(type), \(horsepower) HP") + } +} + + +public struct Tire { + public let brand: String + public let size: Int + + public init(brand: String, size: Int) { + self.brand = brand + self.size = size + } + + public func displayInfo() { + print("Tire: \(brand), size \(size)") + } +} + + +public struct Dimensions { + public let length: Double + public let width: Double + public let height: Double + + public init(length: Double, width: Double, height: Double) { + self.length = length + self.width = width + self.height = height + } + + public func displayDimensions() { + print("Dimensions (LxWxH): \(length) x \(width) x \(height) meters") + } +} + + +public class Vehicle { + public var make: String + public var model: String + public var engine: Engine + public var dimensions: Dimensions + + public init(make: String, model: String, engine: Engine, dimensions: Dimensions) { + self.make = make + self.model = model + self.engine = engine + self.dimensions = dimensions + } + + public func displayInfo() { + print("Vehicle: \(make) \(model)") + engine.displaySpecs() + dimensions.displayDimensions() + } +} + + +public class Car: Vehicle { + public var numberOfDoors: Int + public var tires: [Tire] + + public init(make: String, model: String, engine: Engine, dimensions: Dimensions, numberOfDoors: Int, tires: [Tire]) { + self.numberOfDoors = numberOfDoors + self.tires = tires + super.init(make: make, model: model, engine: engine, dimensions: dimensions) + } + + public func honk() { + print("Car \(make) \(model) goes 'Beep Beep!'") + } +} + + +public class ElectricCar: Car { + public var batteryCapacity: Int // in kWh + + public init(make: String, model: String, dimensions: Dimensions, numberOfDoors: Int, tires: [Tire], batteryCapacity: Int) { + self.batteryCapacity = batteryCapacity + let electricEngine = Engine(type: "Electric", horsepower: batteryCapacity * 3) // Example calculation + super.init(make: make, model: model, engine: electricEngine, dimensions: dimensions, numberOfDoors: numberOfDoors, tires: tires) + } + + public func chargeBattery() { + print("Charging \(make) \(model)... Battery capacity: \(batteryCapacity) kWh") + } +} + +public class Bicycle { + public var brand: String + public var gearCount: Int + public var dimensions: Dimensions + + public init(brand: String, gearCount: Int, dimensions: Dimensions) { + self.brand = brand + self.gearCount = gearCount + self.dimensions = dimensions + } + + public func pedal() { + print("\(brand) bicycle is pedaling with \(gearCount) gears.") + dimensions.displayDimensions() + } +} + + +public class Garage { + private var vehicles: [Vehicle] = [] + + public init() {} + + public func addVehicle(_ vehicle: Vehicle) { + vehicles.append(vehicle) + print("Added \(vehicle.make) \(vehicle.model) to the garage.") + } + + public func listVehicles() { + print("Garage contains:") + for vehicle in vehicles { + print("- \(vehicle.make) \(vehicle.model)") + } + } +} diff --git a/pkgs/swift2objc/test/unit/filter_test_output_a.swift b/pkgs/swift2objc/test/unit/filter_test_output_a.swift new file mode 100644 index 000000000..55f24df43 --- /dev/null +++ b/pkgs/swift2objc/test/unit/filter_test_output_a.swift @@ -0,0 +1,33 @@ +// Test preamble text + +import Foundation + +@objc public class EngineWrapper: NSObject { + var wrappedInstance: Engine + + @objc public var horsepower: Int { + get { + wrappedInstance.horsepower + } + } + + @objc public var type: String { + get { + wrappedInstance.type + } + } + + init(_ wrappedInstance: Engine) { + self.wrappedInstance = wrappedInstance + } + + @objc init(type: String, horsepower: Int) { + wrappedInstance = Engine(type: type, horsepower: horsepower) + } + + @objc public func displaySpecs() { + return wrappedInstance.displaySpecs() + } + +} + diff --git a/pkgs/swift2objc/test/unit/filter_test_output_b.swift b/pkgs/swift2objc/test/unit/filter_test_output_b.swift new file mode 100644 index 000000000..1d0251927 --- /dev/null +++ b/pkgs/swift2objc/test/unit/filter_test_output_b.swift @@ -0,0 +1,230 @@ +// Test preamble text + +import Foundation + +@objc public class DimensionsWrapper: NSObject { + var wrappedInstance: Dimensions + + @objc public var width: Double { + get { + wrappedInstance.width + } + } + + @objc public var height: Double { + get { + wrappedInstance.height + } + } + + @objc public var length: Double { + get { + wrappedInstance.length + } + } + + init(_ wrappedInstance: Dimensions) { + self.wrappedInstance = wrappedInstance + } + + @objc init(length: Double, width: Double, height: Double) { + wrappedInstance = Dimensions(length: length, width: width, height: height) + } + + @objc public func displayDimensions() { + return wrappedInstance.displayDimensions() + } + +} + +@objc public class ElectricCarWrapper: NSObject { + var wrappedInstance: ElectricCar + + @objc public var batteryCapacity: Int { + get { + wrappedInstance.batteryCapacity + } + set { + wrappedInstance.batteryCapacity = newValue + } + } + + init(_ wrappedInstance: ElectricCar) { + self.wrappedInstance = wrappedInstance + } + + @objc public func chargeBattery() { + return wrappedInstance.chargeBattery() + } + +} + +@objc public class CarWrapper: NSObject { + var wrappedInstance: Car + + @objc public var numberOfDoors: Int { + get { + wrappedInstance.numberOfDoors + } + set { + wrappedInstance.numberOfDoors = newValue + } + } + + init(_ wrappedInstance: Car) { + self.wrappedInstance = wrappedInstance + } + + @objc public func honk() { + return wrappedInstance.honk() + } + +} + +@objc public class EngineWrapper: NSObject { + var wrappedInstance: Engine + + @objc public var horsepower: Int { + get { + wrappedInstance.horsepower + } + } + + @objc public var type: String { + get { + wrappedInstance.type + } + } + + init(_ wrappedInstance: Engine) { + self.wrappedInstance = wrappedInstance + } + + @objc init(type: String, horsepower: Int) { + wrappedInstance = Engine(type: type, horsepower: horsepower) + } + + @objc public func displaySpecs() { + return wrappedInstance.displaySpecs() + } + +} + +@objc public class GarageWrapper: NSObject { + var wrappedInstance: Garage + + init(_ wrappedInstance: Garage) { + self.wrappedInstance = wrappedInstance + } + + @objc override init() { + wrappedInstance = Garage() + } + + @objc public func addVehicle(_ vehicle: VehicleWrapper) { + return wrappedInstance.addVehicle(vehicle.wrappedInstance) + } + + @objc public func listVehicles() { + return wrappedInstance.listVehicles() + } + +} + +@objc public class BicycleWrapper: NSObject { + var wrappedInstance: Bicycle + + @objc public var dimensions: DimensionsWrapper { + get { + DimensionsWrapper(wrappedInstance.dimensions) + } + set { + wrappedInstance.dimensions = newValue.wrappedInstance + } + } + + @objc public var brand: String { + get { + wrappedInstance.brand + } + set { + wrappedInstance.brand = newValue + } + } + + @objc public var gearCount: Int { + get { + wrappedInstance.gearCount + } + set { + wrappedInstance.gearCount = newValue + } + } + + init(_ wrappedInstance: Bicycle) { + self.wrappedInstance = wrappedInstance + } + + @objc init(brand: String, gearCount: Int, dimensions: DimensionsWrapper) { + wrappedInstance = Bicycle(brand: brand, gearCount: gearCount, dimensions: dimensions.wrappedInstance) + } + + @objc public func pedal() { + return wrappedInstance.pedal() + } + +} + +@objc public class VehicleWrapper: NSObject { + var wrappedInstance: Vehicle + + @objc public var dimensions: DimensionsWrapper { + get { + DimensionsWrapper(wrappedInstance.dimensions) + } + set { + wrappedInstance.dimensions = newValue.wrappedInstance + } + } + + @objc public var make: String { + get { + wrappedInstance.make + } + set { + wrappedInstance.make = newValue + } + } + + @objc public var model: String { + get { + wrappedInstance.model + } + set { + wrappedInstance.model = newValue + } + } + + @objc public var engine: EngineWrapper { + get { + EngineWrapper(wrappedInstance.engine) + } + set { + wrappedInstance.engine = newValue.wrappedInstance + } + } + + init(_ wrappedInstance: Vehicle) { + self.wrappedInstance = wrappedInstance + } + + @objc init(make: String, model: String, engine: EngineWrapper, dimensions: DimensionsWrapper) { + wrappedInstance = Vehicle(make: make, model: model, engine: engine.wrappedInstance, dimensions: dimensions.wrappedInstance) + } + + @objc public func displayInfo() { + return wrappedInstance.displayInfo() + } + +} + diff --git a/pkgs/swift2objc/test/unit/filter_test_output_c.swift b/pkgs/swift2objc/test/unit/filter_test_output_c.swift new file mode 100644 index 000000000..fd38b9f0e --- /dev/null +++ b/pkgs/swift2objc/test/unit/filter_test_output_c.swift @@ -0,0 +1,4 @@ +// Test preamble text + +import Foundation + diff --git a/pkgs/swift2objc/test/unit/parse_function_info_test.dart b/pkgs/swift2objc/test/unit/parse_function_info_test.dart new file mode 100644 index 000000000..3d86a1b7b --- /dev/null +++ b/pkgs/swift2objc/test/unit/parse_function_info_test.dart @@ -0,0 +1,529 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:swift2objc/src/ast/_core/shared/parameter.dart'; +import 'package:swift2objc/src/ast/_core/shared/referred_type.dart'; +import 'package:swift2objc/src/ast/declarations/built_in/built_in_declaration.dart'; +import 'package:swift2objc/src/parser/_core/json.dart'; +import 'package:swift2objc/src/parser/_core/parsed_symbolgraph.dart'; +import 'package:swift2objc/src/parser/parsers/declaration_parsers/parse_function_declaration.dart'; +import 'package:test/test.dart'; + +void main() { + final parsedSymbols = { + for (final decl in BuiltInDeclaration.values) + decl.id: ParsedSymbol(json: Json(null), declaration: decl) + }; + final emptySymbolgraph = ParsedSymbolgraph(parsedSymbols, {}); + group('Valid json', () { + void expectEqualParams( + List actualParams, + List expectedParams, + ) { + expect(actualParams.length, expectedParams.length); + + for (var i = 0; i < actualParams.length; i++) { + final actualParam = actualParams[i]; + final expectedParam = expectedParams[i]; + + expect(actualParam.name, expectedParam.name); + expect(actualParam.internalName, expectedParam.internalName); + expect(actualParam.type.sameAs(expectedParam.type), isTrue); + } + } + + test('Two params with one internal name', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "outerLabel" }, + { "kind": "text", "spelling": " " }, + { "kind": "internalParam", "spelling": "internalLabel" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ", " }, + { "kind": "externalParam", "spelling": "singleLabel" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ")" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'outerLabel', + internalName: 'internalLabel', + type: intType, + ), + Parameter( + name: 'singleLabel', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('Three params with some optional', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "label1" }, + { "kind": "text", "spelling": " " }, + { "kind": "internalParam", "spelling": "param1" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": "?, " }, + { "kind": "externalParam", "spelling": "label2" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ", " }, + { "kind": "externalParam", "spelling": "label3" }, + { "kind": "text", "spelling": " " }, + { "kind": "internalParam", "spelling": "param3" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": "?)" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'label1', + internalName: 'param1', + type: OptionalType(intType), + ), + Parameter( + name: 'label2', + type: intType, + ), + Parameter( + name: 'label3', + internalName: 'param3', + type: OptionalType(intType), + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('One param', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "parameter" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ")" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'parameter', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('No params', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "()" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + expectEqualParams(info.params, []); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('Function with return type', () { + // parseFunctionInfo doesn't parse the return type, but it should be able + // to cope with one. + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "parameter" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ") -> " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'parameter', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('Function with no params with return type', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "() -> " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + expectEqualParams(info.params, []); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('Function with no params and no return type', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "()" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + expectEqualParams(info.params, []); + expect(info.throws, isFalse); + expect(info.async, isFalse); + }); + + test('Function with return type that throws', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "parameter" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ") " }, + { "kind": "keyword", "spelling": "throws" }, + { "kind": "text", "spelling": " -> " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'parameter', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isTrue); + expect(info.async, isFalse); + }); + + test('Function with no return type that throws', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "parameter" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ") " }, + { "kind": "keyword", "spelling": "throws" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'parameter', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isTrue); + expect(info.async, isFalse); + }); + + test('Function with no params that throws', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "() " }, + { "kind": "keyword", "spelling": "throws" } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + expectEqualParams(info.params, []); + expect(info.throws, isTrue); + expect(info.async, isFalse); + }); + + test('Function with async annotation', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "parameter" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ") " }, + { "kind": "keyword", "spelling": "async" }, + { "kind": "text", "spelling": " -> " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'parameter', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isFalse); + expect(info.async, isTrue); + }); + + test('Function with async and throws annotations', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "func" }, + { "kind": "text", "spelling": " " }, + { "kind": "identifier", "spelling": "foo" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "parameter" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ") " }, + { "kind": "keyword", "spelling": "async" }, + { "kind": "text", "spelling": " " }, + { "kind": "keyword", "spelling": "throws" }, + { "kind": "text", "spelling": " -> " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final info = parseFunctionInfo(json, emptySymbolgraph); + + final expectedParams = [ + Parameter( + name: 'parameter', + type: intType, + ), + ]; + + expectEqualParams(info.params, expectedParams); + expect(info.throws, isTrue); + expect(info.async, isTrue); + }); + }); + + group('Invalid json', () { + test('Parameter with no outer label', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "(" }, + { "kind": "internalParam", "spelling": "internalLabel" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ")" } + ] + ''', + )); + + expect( + () => parseFunctionInfo(json, emptySymbolgraph), + throwsA(isA()), + ); + }); + + test('Parameter with no type', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "(" }, + { "kind": "externalParam", "spelling": "outerLabel" }, + { "kind": "text", "spelling": " " }, + { "kind": "internalParam", "spelling": "internalLabel" }, + { "kind": "text", "spelling": ")" } + ] + ''', + )); + + expect( + () => parseFunctionInfo(json, emptySymbolgraph), + throwsA(isA()), + ); + }); + + test('Parameter with just a type (no label)', () { + final json = Json(jsonDecode( + ''' + [ + { "kind": "keyword", "spelling": "init" }, + { "kind": "text", "spelling": "(" }, + { "kind": "text", "spelling": ": " }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { "kind": "text", "spelling": ")" } + ] + ''', + )); + + expect( + () => parseFunctionInfo(json, emptySymbolgraph), + throwsA(isA()), + ); + }); + }); +} diff --git a/pkgs/swift2objc/test/unit/parse_initializer_param_input.json b/pkgs/swift2objc/test/unit/parse_initializer_param_input.json deleted file mode 100644 index d5fbdfd6d..000000000 --- a/pkgs/swift2objc/test/unit/parse_initializer_param_input.json +++ /dev/null @@ -1,73 +0,0 @@ -[ - { - "testName": "Two params with one internal name", - "inputJson": { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "externalParam", "spelling": "outerLabel" }, - { "kind": "text", "spelling": " " }, - { "kind": "internalParam", "spelling": "representableProperty" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ", " }, - { "kind": "externalParam", "spelling": "customProperty" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ")" } - ] - }, - "outputParams": [ - { - "name": "outerLabel", - "internalName": "representableProperty", - "typeId": "s:Si" - }, - { - "name": "customProperty", - "typeId": "s:Si" - } - ] - }, - { - "testName": "One param", - "inputJson": { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "externalParam", "spelling": "property" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ")" } - ] - }, - "outputParams": [ - { - "name": "property", - "typeId": "s:Si" - } - ] - }, - { - "testName": "No params", - "inputJson": { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "()" } - ] - }, - "outputParams": [] - } -] diff --git a/pkgs/swift2objc/test/unit/parse_initializer_param_test.dart b/pkgs/swift2objc/test/unit/parse_initializer_param_test.dart deleted file mode 100644 index 05693aa35..000000000 --- a/pkgs/swift2objc/test/unit/parse_initializer_param_test.dart +++ /dev/null @@ -1,204 +0,0 @@ -import 'dart:convert'; - -import 'package:swift2objc/src/ast/_core/interfaces/declaration.dart'; -import 'package:swift2objc/src/ast/_core/shared/parameter.dart'; -import 'package:swift2objc/src/ast/declarations/built_in/built_in_declaration.dart'; -import 'package:swift2objc/src/parser/_core/json.dart'; -import 'package:swift2objc/src/parser/_core/parsed_symbolgraph.dart'; -import 'package:swift2objc/src/parser/parsers/declaration_parsers/parse_initializer_declaration.dart'; -import 'package:test/test.dart'; - -void main() { - final parsedSymbols = { - for (final decl in BuiltInDeclaration.values) - decl.id: ParsedSymbol(json: Json(null), declaration: decl) - }; - final emptySymbolgraph = ParsedSymbolgraph(parsedSymbols, {}); - group('Valid json', () { - void expectEqualParams( - List actualParams, - List expectedParams, - ) { - expect(actualParams.length, expectedParams.length); - - for (var i = 0; i < actualParams.length; i++) { - final actualParam = actualParams[i]; - final expectedParam = expectedParams[i]; - - expect(actualParam.name, expectedParam.name); - expect(actualParam.internalName, expectedParam.internalName); - expect(actualParam.type.id, expectedParam.type.id); - } - } - - test('Two params with one internal name', () { - final json = Json(jsonDecode( - ''' - { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "externalParam", "spelling": "outerLabel" }, - { "kind": "text", "spelling": " " }, - { "kind": "internalParam", "spelling": "internalLabel" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ", " }, - { "kind": "externalParam", "spelling": "singleLabel" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ")" } - ] - } - ''', - )); - - final outputParams = parseInitializerParams(json, emptySymbolgraph); - - final expectedParams = [ - Parameter( - name: 'outerLabel', - internalName: 'internalLabel', - type: BuiltInDeclaration.swiftInt.asDeclaredType, - ), - Parameter( - name: 'singleLabel', - type: BuiltInDeclaration.swiftInt.asDeclaredType, - ), - ]; - - expectEqualParams(outputParams, expectedParams); - }); - test('One param', () { - final json = Json(jsonDecode( - ''' - { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "externalParam", "spelling": "parameter" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ")" } - ] - } - ''', - )); - - final outputParams = parseInitializerParams(json, emptySymbolgraph); - - final expectedParams = [ - Parameter( - name: 'parameter', - type: BuiltInDeclaration.swiftInt.asDeclaredType, - ), - ]; - - expectEqualParams(outputParams, expectedParams); - }); - - test('No params', () { - final json = Json(jsonDecode( - ''' - { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "()" } - ] - } - ''', - )); - - final outputParams = parseInitializerParams(json, emptySymbolgraph); - - expectEqualParams(outputParams, []); - }); - }); - - group('Invalid json', () { - test('Parameter with no outer label', () { - final json = Json(jsonDecode( - ''' - { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "internalParam", "spelling": "internalLabel" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ")" } - ] - } - ''', - )); - - expect( - () => parseInitializerParams(json, emptySymbolgraph), - throwsA(isA()), - ); - }); - - test('Parameter with no type', () { - final json = Json(jsonDecode( - ''' - { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "externalParam", "spelling": "outerLabel" }, - { "kind": "text", "spelling": " " }, - { "kind": "internalParam", "spelling": "internalLabel" }, - { "kind": "text", "spelling": ")" } - ] - } - ''', - )); - - expect( - () => parseInitializerParams(json, emptySymbolgraph), - throwsA(isA()), - ); - }); - - test('Parameter with just a type (no label)', () { - final json = Json(jsonDecode( - ''' - { - "declarationFragments": [ - { "kind": "keyword", "spelling": "init" }, - { "kind": "text", "spelling": "(" }, - { "kind": "text", "spelling": ": " }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" - }, - { "kind": "text", "spelling": ")" } - ] - } - ''', - )); - - expect( - () => parseInitializerParams(json, emptySymbolgraph), - throwsA(isA()), - ); - }); - }); -} diff --git a/pkgs/swift2objc/test/unit/parse_type_test.dart b/pkgs/swift2objc/test/unit/parse_type_test.dart new file mode 100644 index 000000000..309de86f6 --- /dev/null +++ b/pkgs/swift2objc/test/unit/parse_type_test.dart @@ -0,0 +1,187 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:swift2objc/src/ast/_core/interfaces/declaration.dart'; +import 'package:swift2objc/src/ast/_core/shared/referred_type.dart'; +import 'package:swift2objc/src/ast/declarations/built_in/built_in_declaration.dart'; +import 'package:swift2objc/src/ast/declarations/compounds/class_declaration.dart'; +import 'package:swift2objc/src/parser/_core/json.dart'; +import 'package:swift2objc/src/parser/_core/parsed_symbolgraph.dart'; +import 'package:swift2objc/src/parser/_core/token_list.dart'; +import 'package:swift2objc/src/parser/parsers/parse_type.dart'; +import 'package:test/test.dart'; + +void main() { + final classFoo = ClassDeclaration(id: 'Foo', name: 'Foo'); + final classBar = ClassDeclaration(id: 'Bar', name: 'Bar'); + + final testDecls = [ + ...BuiltInDeclaration.values, + classFoo, + classBar, + ]; + final parsedSymbols = ParsedSymbolgraph({ + for (final decl in testDecls) + decl.id: ParsedSymbol(json: Json(null), declaration: decl), + }, {}); + + test('Type identifier', () { + final fragments = Json(jsonDecode( + ''' + [ + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final (type, remaining) = parseType(parsedSymbols, TokenList(fragments)); + + expect(type.sameAs(intType), isTrue); + expect(remaining.length, 0); + }); + + test('Empty tuple', () { + final fragments = Json(jsonDecode( + ''' + [ + { + "kind": "text", + "spelling": "()" + } + ] + ''', + )); + + final (type, remaining) = parseType(parsedSymbols, TokenList(fragments)); + + expect(type.sameAs(voidType), isTrue); + expect(remaining.length, 0); + }); + + test('Optional', () { + final fragments = Json(jsonDecode( + ''' + [ + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { + "kind": "text", + "spelling": "?" + } + ] + ''', + )); + + final (type, remaining) = parseType(parsedSymbols, TokenList(fragments)); + + expect(type.sameAs(OptionalType(intType)), isTrue); + expect(remaining.length, 0); + }); + + test('Nested type', () { + final fragments = Json(jsonDecode( + ''' + [ + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "Foo" + }, + { + "kind": "text", + "spelling": "." + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "Bar" + } + ] + ''', + )); + + final (type, remaining) = parseType(parsedSymbols, TokenList(fragments)); + + expect(type.sameAs(classBar.asDeclaredType), isTrue); + expect(remaining.length, 0); + }); + + test('Multiple suffixes', () { + // This test is verifying that we can parse multiple suffix operators in a + // row. Nested OptionalTypes don't really make sense though. So in future if + // we start collapsing nested OptionalTypes, change this test to use a + // different suffix type. + final fragments = Json(jsonDecode( + ''' + [ + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { + "kind": "text", + "spelling": "?" + }, + { + "kind": "text", + "spelling": "?" + }, + { + "kind": "text", + "spelling": "?" + } + ] + ''', + )); + + final (type, remaining) = parseType(parsedSymbols, TokenList(fragments)); + + expect(type.sameAs(OptionalType(intType)), isFalse); + expect( + type.sameAs(OptionalType(OptionalType(OptionalType(intType)))), isTrue); + expect(remaining.length, 0); + }); + + test('Stop parsing when we find a non-type token', () { + final fragments = Json(jsonDecode( + ''' + [ + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + }, + { + "kind": "text", + "spelling": "?" + }, + { + "kind": "text", + "spelling": "," + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + ''', + )); + + final (type, remaining) = parseType(parsedSymbols, TokenList(fragments)); + + expect(type.sameAs(OptionalType(intType)), isTrue); + expect(remaining.length, 2); + }); +} diff --git a/pkgs/swift2objc/test/unit/token_list_test.dart b/pkgs/swift2objc/test/unit/token_list_test.dart new file mode 100644 index 000000000..e3b115f40 --- /dev/null +++ b/pkgs/swift2objc/test/unit/token_list_test.dart @@ -0,0 +1,100 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:swift2objc/src/parser/_core/json.dart'; +import 'package:swift2objc/src/parser/_core/token_list.dart'; +import 'package:test/test.dart'; + +void main() { + String spelling(Iterable tokens) => + [...tokens.map((t) => t['spelling'])].toString(); + + test('Slicing', () { + final list = TokenList(Json(jsonDecode(''' +[ + { "spelling": "a" }, + { "spelling": "b" }, + { "spelling": "c" }, + { "spelling": "d" }, + { "spelling": "e" }, + { "spelling": "f" } +] +'''))); + + expect(list.length, 6); + expect(list.slice(3).length, 3); + expect(list.slice(2, 4).length, 2); + expect(list.slice(3, 3).length, 0); + + expect(list.isEmpty, isFalse); + expect(list.slice(3).isEmpty, isFalse); + expect(list.slice(2, 4).isEmpty, isFalse); + expect(list.slice(3, 3).isEmpty, isTrue); + + expect(spelling(list), '["a", "b", "c", "d", "e", "f"]'); + expect(spelling(list.slice(3)), '["d", "e", "f"]'); + expect(spelling(list.slice(2, 4)), '["c", "d"]'); + expect(spelling(list.slice(3, 3)), '[]'); + + expect(list[2].toString(), '{"spelling":"c"}'); + expect(list.slice(2, 4)[1].toString(), '{"spelling":"d"}'); + + expect(list.indexWhere((tok) => tok['spelling'].get() == 'd'), 3); + expect( + list + .slice(2, 4) + .indexWhere((tok) => tok['spelling'].get() == 'd'), + 1); + }); + + test('Split one token', () { + List split(String json) => + TokenList.splitToken(Json(jsonDecode(json))).toList(); + expect(spelling(split('{ "kind": "text", "spelling": "a" }')), '["a"]'); + expect(spelling(split('{ "kind": "text", "spelling": "" }')), '[""]'); + expect(spelling(split('{ "kind": "text", "spelling": " " }')), '[""]'); + expect(spelling(split('{ "kind": "text", "spelling": "?" }')), '["?"]'); + expect(spelling(split('{ "kind": "text", "spelling": "???" }')), + '["?", "?", "?"]'); + expect( + spelling(split('{ "kind": "text", "spelling": "()" }')), '["(", ")"]'); + expect(spelling(split('{ "kind": "text", "spelling": " ?) -> () " }')), + '["?", ")", "->", "(", ")"]'); + expect(spelling(split('{ "kind": "typeIdentifier", "spelling": "?)" }')), + '["?)"]'); + + // splitToken gives up as soon as it finds a non-matching prefix. Ideally + // we'd keep splitting out any other tokens we find in the text, but that's + // more complicated to implement (we're writing a full tokenizer at that + // point), and we haven't seen a symbolgraph where that's necessary yet. + expect(spelling(split('{ "kind": "text", "spelling": "?)>-??" }')), + '["?", ")", ">-??"]'); + expect(spelling(split('{ "kind": "text", "spelling": "?)abc??" }')), + '["?", ")", "abc??"]'); + }); + + test('Split list', () { + final list = TokenList(Json(jsonDecode(''' +[ + { "kind": "text", "spelling": "a" }, + { "kind": "text", "spelling": "?(" }, + { "kind": "text", "spelling": "b" }, + { "kind": "text", "spelling": "c" }, + { "kind": "text", "spelling": "?)" }, + { "kind": "text", "spelling": "?, " }, + { "kind": "text", "spelling": "d" }, + { "kind": "typeIdentifier", "spelling": "?(" }, + { "kind": "text", "spelling": "e" } +] +'''))); + + expect(spelling(list), + '["a", "?", "(", "b", "c", "?", ")", "?", ",", "d", "?(", "e"]'); + + // If kind != "text", the token isn't changed. + expect(list[10].toString(), '{"kind":"typeIdentifier","spelling":"?("}'); + }); +} diff --git a/pkgs/swift2objc/test/utils/utils.dart b/pkgs/swift2objc/test/utils/utils.dart new file mode 100644 index 000000000..27ea25ad4 --- /dev/null +++ b/pkgs/swift2objc/test/utils/utils.dart @@ -0,0 +1,8 @@ +import 'package:test/test.dart'; + +void expectString(String a, String b) { + final trimmedA = a.replaceAll(RegExp(r'\s+'), ''); + final trimmedB = b.replaceAll(RegExp(r'\s+'), ''); + + expect(trimmedA, trimmedB); +} diff --git a/pkgs/swiftgen/pubspec.yaml b/pkgs/swiftgen/pubspec.yaml index 20f4c3c48..664fd220c 100644 --- a/pkgs/swiftgen/pubspec.yaml +++ b/pkgs/swiftgen/pubspec.yaml @@ -6,6 +6,7 @@ name: swiftgen description: 'A tool for generating bindings that allow interop between Dart and Swift code.' version: 0.0.1-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/swiftgen +issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aswiftgen topics: - interop